diff --git a/frontend/src/js/component/wb-collection-fields.js b/frontend/src/js/component/wb-collection-fields.js index e660eb5..8888f4a 100644 --- a/frontend/src/js/component/wb-collection-fields.js +++ b/frontend/src/js/component/wb-collection-fields.js @@ -8,6 +8,14 @@ import wbFormatDate from 'wb-format-date'; import WBNameAndUuid from 'wb-name-and-uuid'; import WBAccordion from 'wb-accordion'; +function formatSpecialValue(value) { + if (value === null) return (null); + if (value === undefined) return (undefined); + if (typeof(value) === 'boolean') return ({ String(value) }); + if (value === '') return '-'; + return String(value); +} + class WBCollectionFields extends Component { componentDidMount() { this.prepareRows(); @@ -25,7 +33,7 @@ class WBCollectionFields extends Component { const filters = [ ['uuid', '=', uuid] ]; - + let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/collections?filters=' + encodeURIComponent(JSON.stringify(filters))); @@ -35,7 +43,7 @@ class WBCollectionFields extends Component { throw Error('Item not found'); let rows = [ [ 'Name', item.name ], - [ 'Description', item.description || ({ String(item.description) }) ], + [ 'Description', formatSpecialValue(item.description) ], [ 'Properties', (
{ JSON.stringify(item.properties, null, 2) }
diff --git a/frontend/src/js/component/wb-common-fields.js b/frontend/src/js/component/wb-common-fields.js index d895bdc..da75ad7 100644 --- a/frontend/src/js/component/wb-common-fields.js +++ b/frontend/src/js/component/wb-common-fields.js @@ -22,18 +22,14 @@ class WBCommonFields extends Component { let { uuid, app } = this.props; let { arvHost, arvToken } = app.state; - const filters = [ - ['uuid', '=', uuid] - ]; + const typeName = arvadosTypeName(uuid); let prom = makeArvadosRequest(arvHost, arvToken, - '/arvados/v1/' + arvadosTypeName(uuid) + - 's?filters=' + encodeURIComponent(JSON.stringify(filters))); + '/arvados/v1/' + typeName + 's/' + + encodeURIComponent(uuid)); prom = prom.then(xhr => { - const item = xhr.response.items[0]; - if (!item) - throw Error('Item not found'); + const item = xhr.response; let rows = [ [ 'UUID', item.uuid ], [ 'Kind', item.kind ], @@ -43,14 +39,14 @@ class WBCommonFields extends Component { [ 'Created at', wbFormatDate(item.created_at) ], [ 'Modified at', wbFormatDate(item.modified_at) ], [ 'Modified by User', ( - + item.modified_by_user_uuid ? () : '-' ) ], [ 'Modified by Client', ( - + item.modified_by_client_uuid ? () : '-' ) ], [ 'API Url', ( - - { 'https://' + app.state.arvHost + '/arvados/v1' + item.href } + + { 'https://' + app.state.arvHost + '/arvados/v1/' + typeName + 's/' + uuid } ) ], [ 'ETag', item.etag ] diff --git a/frontend/src/js/component/wb-name-and-uuid.js b/frontend/src/js/component/wb-name-and-uuid.js index 2c45b57..2e9cc45 100644 --- a/frontend/src/js/component/wb-name-and-uuid.js +++ b/frontend/src/js/component/wb-name-and-uuid.js @@ -87,7 +87,7 @@ class WBNameAndUuid extends Component { return; if (nextProps.lazy) { - this.setState({ item: { uuid: nextProps.uuid }}); + this.setState({ item: null }); } else { this.props = nextProps; diff --git a/frontend/src/js/component/wb-project-listing.js b/frontend/src/js/component/wb-project-listing.js index e0bf9ee..0d2eb52 100644 --- a/frontend/src/js/component/wb-project-listing.js +++ b/frontend/src/js/component/wb-project-listing.js @@ -3,6 +3,7 @@ import { route } from 'preact-router'; import makeArvadosRequest from 'make-arvados-request'; import WBTable from 'wb-table'; import WBPagination from 'wb-pagination'; +import WBNameAndUuid from 'wb-name-and-uuid'; class WBProjectListing extends Component { @@ -34,7 +35,7 @@ class WBProjectListing extends Component { (
{ item['description'] } { renderEditDescription(item, () => this.fetchItems()) }
), - item['owner_uuid'], + ( ), (
{ renderDeleteButton(item, () => this.fetchItems()) } { renderSharingButton(item) } diff --git a/frontend/src/js/misc/wb-format-special-value.js b/frontend/src/js/misc/wb-format-special-value.js new file mode 100644 index 0000000..b4d89b9 --- /dev/null +++ b/frontend/src/js/misc/wb-format-special-value.js @@ -0,0 +1,9 @@ +function wbFormatSpecialValue(value) { + if (value === null) return (null); + if (value === undefined) return (undefined); + if (typeof(value) === 'boolean') return ({ String(value) }); + if (value === '') return '-'; + return String(value); +} + +export default wbFormatSpecialValue;