// // Copyright (C) Stanislaw Adaszewski, 2020 // Contact: s.adaszewski@gmail.com // Website: https://adared.ch/wba // License: GNU Affero General Public License, Version 3 // import { h, Component } from 'preact'; import WBTable from 'wb-table'; import makeArvadosRequest from 'make-arvados-request'; import arvadosTypeName from 'arvados-type-name'; import arvadosObjectName from 'arvados-object-name'; import urlForObject from 'url-for-object'; import wbFormatDate from 'wb-format-date'; import WBNameAndUuid from 'wb-name-and-uuid'; import WBAccordion from 'wb-accordion'; import WBJsonViewer from 'wb-json-viewer'; class WBContainerFields extends Component { componentDidMount() { this.prepareRows(); } componentWillReceiveProps(nextProps) { this.props = nextProps; this.prepareRows(); } prepareRows() { let { uuid, app } = this.props; let { arvHost, arvToken } = app.state; let item; let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/containers/' + uuid); prom = prom.then(xhr => (item = xhr.response)); prom = prom.then(() => { let rows = [ [ 'State', item.state ], [ 'Started At', wbFormatDate(item.started_at) ], [ 'Finished At', wbFormatDate(item.started_at) ], [ 'Log', item.log ? ( ) : ( { String(item.log) } ) ], [ 'Environment', ( ) ], [ 'Working Directory', item.cwd ], [ 'Command', ( ) ], [ 'Output Path', item.output_path ], [ 'Mounts', ( { Object.keys(item.mounts).map(k => ( )) } ) ], [ 'Runtime Constraints', ( ) ], [ 'Runtime Status', ( ) ], [ 'Scheduling Parameters', ( ) ], [ 'Output', item.output ? ( ) : ( { String(item.output) } )], [ 'Container Image', ( ) ], [ 'Progress', item.progress ], [ 'Priority', item.priority ], [ 'Exit Code', item.exit_code === null ? ( null ) : item.exit_code ], [ 'Auth UUID', item.auth_uuid === null ? ( null ) : item.auth_uuid ], [ 'Locked by UUID', item.locked_by_uuid === null ? ( null ) : item.locked_by_uuid ] ]; rows = rows.map(r => [r[0], r[1] ? r[1] : ({ String(r[1]) })]); this.setState({ 'rows': rows }); }); } render({}, { rows }) { return ( rows ? ( ) : (
Loading...
) ); } } export default WBContainerFields;