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';
class WBCommonFields extends Component {
componentDidMount() {
this.prepareRows();
}
componentWillReceiveProps(nextProps) {
this.props = nextProps;
// this.setState({ 'rows': null });
this.prepareRows();
}
prepareRows() {
let { uuid, app } = this.props;
let { arvHost, arvToken } = app.state;
const filters = [
['uuid', '=', uuid]
];
let prom = makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/' + arvadosTypeName(uuid) +
's?filters=' + encodeURIComponent(JSON.stringify(filters)));
prom = prom.then(xhr => {
const item = xhr.response.items[0];
if (!item)
throw Error('Item not found');
let rows = [
[ 'UUID', item.uuid ],
[ 'Kind', item.kind ],
[ 'Owner', (