Skip to content
Snippets Groups Projects
Commit 0e5b99cb authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-12451 : Navigation - show V3 API entity json as a tab content

parent 3a2cd770
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -3,6 +3,7 @@ import { withStyles } from '@material-ui/core/styles' ...@@ -3,6 +3,7 @@ import { withStyles } from '@material-ui/core/styles'
import Content from '@src/js/components/common/content/Content.jsx' import Content from '@src/js/components/common/content/Content.jsx'
import DatabaseBrowser from '@src/js/components/database/browser/DatabaseBrowser.jsx' import DatabaseBrowser from '@src/js/components/database/browser/DatabaseBrowser.jsx'
import DatabaseTab from '@src/js/components/database/DatabaseTab.jsx' import DatabaseTab from '@src/js/components/database/DatabaseTab.jsx'
import DatabaseComponent from '@src/js/components/database/DatabaseComponent.jsx'
import pages from '@src/js/common/consts/pages.js' import pages from '@src/js/common/consts/pages.js'
import logger from '@src/js/common/logger.js' import logger from '@src/js/common/logger.js'
...@@ -31,8 +32,8 @@ class Database extends React.PureComponent { ...@@ -31,8 +32,8 @@ class Database extends React.PureComponent {
) )
} }
renderComponent() { renderComponent(tab) {
return null return <DatabaseComponent object={tab.object} />
} }
renderTab(tab) { renderTab(tab) {
......
import React from 'react'
import Container from '@src/js/components/common/form/Container.jsx'
import openbis from '@src/js/services/openbis.js'
import objectType from '@src/js/common/consts/objectType.js'
import logger from '@src/js/common/logger.js'
class DatabaseComponent extends React.PureComponent {
constructor(props) {
super(props)
this.state = {
json: null
}
}
async componentDidMount() {
const { object } = this.props
let json = null
if (object.type === objectType.SPACE) {
const spaces = await openbis.getSpaces(
[new openbis.SpacePermId(object.id)],
new openbis.SpaceFetchOptions()
)
json = spaces[object.id]
} else if (object.type === objectType.PROJECT) {
const projects = await openbis.getProjects(
[new openbis.ProjectPermId(object.id)],
new openbis.ProjectFetchOptions()
)
json = projects[object.id]
} else if (object.type === objectType.COLLECTION) {
const experiments = await openbis.getExperiments(
[new openbis.ExperimentPermId(object.id)],
new openbis.ExperimentFetchOptions()
)
json = experiments[object.id]
} else if (object.type === objectType.OBJECT) {
const samples = await openbis.getSamples(
[new openbis.SamplePermId(object.id)],
new openbis.SampleFetchOptions()
)
json = samples[object.id]
} else if (object.type === objectType.DATA_SET) {
const dataSets = await openbis.getDataSets(
[new openbis.DataSetPermId(object.id)],
new openbis.DataSetFetchOptions()
)
json = dataSets[object.id]
}
this.setState({
json
})
}
render() {
logger.log(logger.DEBUG, 'DatabaseComponent.render')
return (
<Container>
<pre>{JSON.stringify(this.state.json, null, 2)}</pre>
</Container>
)
}
}
export default DatabaseComponent
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment