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';
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 ? (
{ JSON.stringify(item.environment, null, 2) }
{ JSON.stringify(item.command) }) ], [ 'Output Path', item.output_path ], [ 'Mounts', (
{ JSON.stringify(item.mounts[k], null, 2) })) }
{ JSON.stringify(item.runtime_constraints, null, 2) }
{ JSON.stringify(item.runtime_status, null, 2) }
{ JSON.stringify(item.scheduling_parameters, null, 2) }