| 
				
				
					
				
				
				 | 
			
			 | 
			@@ -7,6 +7,11 @@ import WBCheckboxes from 'wb-checkboxes'; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import wbFormatDate from 'wb-format-date';
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import wbFetchObjects from 'wb-fetch-objects';
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import WBNameAndUuid from 'wb-name-and-uuid';
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import WBProcessState from 'wb-process-state';
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			function maskRows(rows) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  return rows.map(r => r.map(c => '-'));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			class WBProcessListing extends Component {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -15,9 +20,7 @@ class WBProcessListing extends Component { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.state.rows = [];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.state.numPages = 0;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.state.requestStates = [ 'Uncommitted', 'Committed', 'Final' ];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // this.state.containerStates = [ 'Queued', 'Locked', 'Running', 'Cancelled', 'Complete' ];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.state.reqStateMask = [ true, true, true ];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // this.state.contStateMask = [ true, true, true, true, true ];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  componentDidMount() {
 | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -25,14 +28,8 @@ class WBProcessListing extends Component { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  prepareRows(requests, containerLookup, ownerLookup, outputLookup) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    const { renderRenameLink, renderDeleteButton } = this.props;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    const { app, renderRenameLink, renderDeleteButton } = this.props;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return requests.map(item => {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      const container = item.container_uuid in containerLookup ?
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        containerLookup[item.container_uuid] : null;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      const runtimeStatus = container ? container.runtime_status : null;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      const error = runtimeStatus ? runtimeStatus.error : null;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      const warning = runtimeStatus ? runtimeStatus.warning : null;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return ( [
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        (<div>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          <div>
 | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -42,22 +39,10 @@ class WBProcessListing extends Component { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          </div>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          <div>{ item['uuid'] }</div>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        </div>),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        ( <div>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            { item['state'] }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            { item.container_uuid ?
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			              container ?
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			              [ " / ", container.state ] :
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			              [ " / ", <i>Container Not Found</i> ] :
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			              null }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            { !(error || warning) && container && container.state === 'Complete' ? " / Success" : null }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            { error ? [" / ", <a href={ '/container/' + container.uuid }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			              title={ error }>E</a> ] : null }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            { warning ? [ " / ", <a href={ '/container/' + container.uuid }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			              title={ warning }>W</a> ] : null }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          </div> ),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        ( <WBNameAndUuid uuid={ item['owner_uuid'] } lookup={ ownerLookup } /> ),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        ( <WBProcessState app={ app } process={ item } /> ),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        ( <WBNameAndUuid app={ app } uuid={ item['owner_uuid'] } /> ),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        wbFormatDate(item['created_at']),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        ( <WBNameAndUuid uuid={ item['output_uuid'] } lookup={ outputLookup } /> ),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        ( <WBNameAndUuid app={ app } uuid={ item['output_uuid'] } /> ),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        (<div>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          { renderDeleteButton(item, () => this.fetchItems()) }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        </div>)
 | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -78,64 +63,22 @@ class WBProcessListing extends Component { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      filters.push([ 'state', 'in', requestStates.filter((_, idx) => reqStateMask[idx]) ]);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (ownerUuid)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      filters.push([ 'owner_uuid', '=', ownerUuid ]);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    //if (requestingContainerUuid)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      //filters.push();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    let prom = makeArvadosRequest(arvHost, arvToken,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      '/arvados/v1/container_requests?filters=' + encodeURIComponent(JSON.stringify(filters)) +
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      '&limit=' + itemsPerPage +
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      '&offset=' + (itemsPerPage * activePage));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    let requests;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    let numPages;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    prom = prom.then(xhr => {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      requests = xhr.response.items;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      numPages = Math.ceil(xhr.response['items_available'] / xhr.response['limit']);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      /* container_uuids = requests.map(r => r.container_uuid);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      container_uuids = container_uuids.filter(uuid => uuid);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      const filters_1 = [
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        [ 'uuid', 'in', container_uuids ]
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      ];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return makeArvadosRequest(arvHost, arvToken,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        '/arvados/v1/containers?filters=' +
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        encodeURIComponent(JSON.stringify(filters_1)));*/
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return wbFetchObjects(arvHost, arvToken,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        requests.map(r => r.container_uuid).filter(uuid => uuid));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    });
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    let containerLookup;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    prom = prom.then(lookup => {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      containerLookup = lookup;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      // const containers = xhr.response.items;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      // containers.map(c => (containerLookup[c.uuid] = c));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return wbFetchObjects(arvHost, arvToken,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        requests.map(r => r.owner_uuid).filter(uuid => uuid));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    });
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    let ownerLookup;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    prom = prom.then(lookup => {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      ownerLookup = lookup;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      return wbFetchObjects(arvHost, arvToken,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        requests.map(r => r.output_uuid).filter(uuid => uuid));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    });
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    let outputLookup;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    prom = prom.then(lookup => (outputLookup = lookup));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // prom = prom.then(() => makeArvadosRequest(arvHost, arvToken,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    //  '/arvados/v1/'))
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    prom = prom.then(() =>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    prom = prom.then(xhr =>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      this.setState({
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        'numPages': numPages,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        'rows': this.prepareRows(requests, containerLookup,
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			          ownerLookup, outputLookup)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        'numPages': Math.ceil(xhr.response['items_available'] / xhr.response['limit']),
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        'rows': this.prepareRows(xhr.response.items)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      }));
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  componentWillReceiveProps(nextProps, nextState) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    // this.setState({ 'rows': [] }); // .rows = [];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.props = nextProps;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.setState({ 'rows': maskRows(this.state.rows) });
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    this.fetchItems();
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
	
		
			
				| 
				
					
				
				
				
				 | 
			
			 | 
			
  |