IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Browse Source

Added lazy mode to WBNameAndUuid and WBProcessState.

master
parent
commit
cfdbb532f7
3 changed files with 36 additions and 13 deletions
  1. +18
    -5
      frontend/src/js/component/wb-name-and-uuid.js
  2. +3
    -3
      frontend/src/js/component/wb-process-listing.js
  3. +15
    -5
      frontend/src/js/component/wb-process-state.js

+ 18
- 5
frontend/src/js/component/wb-name-and-uuid.js View File

@@ -76,17 +76,26 @@ class WBNameAndUuid extends Component {
} }
componentDidMount() { componentDidMount() {
this.fetchData();
if (this.props.lazy)
;//this.setState({ item: { uuid: this.props.uuid }});
else
this.fetchData();
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (this.props.uuid !== nextProps.uuid) {
if (this.props.uuid === nextProps.uuid)
return;
if (nextProps.lazy) {
this.setState({ item: { uuid: nextProps.uuid }});
} else {
this.props = nextProps; this.props = nextProps;
this.fetchData(); this.fetchData();
} }
} }
render({ uuid, onLinkClicked }, { error, item }) {
render({ uuid, onLinkClicked, lazy }, { error, item }) {
if (!uuid) if (!uuid)
return ( return (
<div><i>{ String(uuid) }</i></div> <div><i>{ String(uuid) }</i></div>
@@ -97,10 +106,14 @@ class WBNameAndUuid extends Component {
<div> <div>
{ error ? error : (item ? ( { error ? error : (item ? (
<a href={ urlForObject(item) } onclick={ onLinkClicked }>{ arvadosObjectName(item) }</a> <a href={ urlForObject(item) } onclick={ onLinkClicked }>{ arvadosObjectName(item) }</a>
) : 'Loading...') }
) : (lazy ? null : 'Loading...')) }
</div> </div>
<div> <div>
{ uuid }
{ uuid } { (lazy && !item) ? (
<a href="#" title="Look up" onclick={ e => { e.preventDefault(); this.fetchData(); } }>
<i class="fas fa-search"></i>
</a>
) : null }
</div> </div>
</div> </div>
); );


+ 3
- 3
frontend/src/js/component/wb-process-listing.js View File

@@ -58,10 +58,10 @@ class WBProcessListing extends Component {
{ item.description } { renderEditDescription(item, () => this.fetchItems()) } { item.description } { renderEditDescription(item, () => this.fetchItems()) }
</div> </div>
</div>), </div>),
( <WBProcessState app={ app } process={ item } /> ),
( <WBNameAndUuid app={ app } uuid={ item['owner_uuid'] } /> ),
( <WBProcessState app={ app } process={ item } lazy={ true } /> ),
( <WBNameAndUuid app={ app } uuid={ item['owner_uuid'] } lazy={ true } /> ),
wbFormatDate(item['created_at']), wbFormatDate(item['created_at']),
( <WBNameAndUuid app={ app } uuid={ item['output_uuid'] } /> ),
( <WBNameAndUuid app={ app } uuid={ item['output_uuid'] } lazy={ true } /> ),
(<div> (<div>
<button class="btn btn-outline-warning m-1" onclick={ () => this.cancelProcess(item.uuid) }> <button class="btn btn-outline-warning m-1" onclick={ () => this.cancelProcess(item.uuid) }>
<i class="fas fa-stop-circle"></i> <i class="fas fa-stop-circle"></i>


+ 15
- 5
frontend/src/js/component/wb-process-state.js View File

@@ -3,12 +3,18 @@ import makeArvadosRequest from 'make-arvados-request';
class WBProcessState extends Component { class WBProcessState extends Component {
componentDidMount() { componentDidMount() {
this.fetchData();
if (!this.props.lazy)
this.fetchData();
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
this.props = nextProps;
this.fetchData();
if (this.props.lazy) {
this.setState({ container: null, apiError: null });
} else {
this.props = nextProps;
this.fetchData();
}
} }
fetchData() { fetchData() {
@@ -24,7 +30,7 @@ class WBProcessState extends Component {
prom = prom.catch(() => this.setState({ 'apiError': 'Failed to fetch container' })); prom = prom.catch(() => this.setState({ 'apiError': 'Failed to fetch container' }));
} }
render({ process }, { container, apiError }) {
render({ process, lazy }, { container, apiError }) {
const runtimeStatus = container ? container.runtime_status : null; const runtimeStatus = container ? container.runtime_status : null;
const error = runtimeStatus ? runtimeStatus.error : null; const error = runtimeStatus ? runtimeStatus.error : null;
const warning = runtimeStatus ? runtimeStatus.warning : null; const warning = runtimeStatus ? runtimeStatus.warning : null;
@@ -38,7 +44,11 @@ class WBProcessState extends Component {
{ error ? [" / ", <a href={ '/container/' + container.uuid } { error ? [" / ", <a href={ '/container/' + container.uuid }
title={ error }>E</a> ] : null } title={ error }>E</a> ] : null }
{ warning ? [ " / ", <a href={ '/container/' + container.uuid } { warning ? [ " / ", <a href={ '/container/' + container.uuid }
title={ warning }>W</a> ] : null }
title={ warning }>W</a> ] : null } { lazy && !container && !apiError ? (
<a href="#" title="Look up" onclick={ e => { e.preventDefault(); this.fetchData(); } }>
<i class="fas fa-search"></i>
</a>
) : null }
</div> </div>
); );
} }


Loading…
Cancel
Save