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 WBContainerRequestFields 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/container_requests/' + uuid);
prom = prom.then(xhr => (item = xhr.response));
prom = prom.then(() => {
let rows = [
[ 'Name', item.name ],
[ 'Description', item.description || ({ String(item.description) }) ],
[ 'Properties', (
{ JSON.stringify(item.properties, null, 2) }
{ JSON.stringify(item.mounts[k], null, 2) }
)) }
{ JSON.stringify(item.runtime_constraints, null, 2) }
{ JSON.stringify(item.scheduling_parameters, null, 2) }
{ JSON.stringify(item.environment, null, 2) }
{ JSON.stringify(item.command) }) ], [ 'Output Path', item.output_path ], [ 'Output Name', item.output_name ], [ 'Output TTL', item.output_ttl ], [ 'Priority', item.priority ], [ 'Expires At', wbFormatDate(item.expires_at) ], [ 'Use Existing', String(item.use_existing) ], [ 'Log', (
{ item.filters }) : ({ String(item.filters) }) ) ], [ 'Runtime Token', item.runtime_token || ({ String(item.runtime_token) }) ], [ 'Runtime User', (
{ JSON.stringify(item.runtime_auth_scopes, null, 2) }) : ( { String(item.runtime_auth_scopes) } ) ) ] ]; rows = rows.map(r => [r[0], r[1] ? r[1] : ({ String(r[1]) })]); this.setState({ 'rows': rows }); }); } render({}, { rows }) { return ( rows ? (