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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

125 lines
4.4KB

  1. import { h, Component } from 'preact';
  2. import WBTable from 'wb-table';
  3. import makeArvadosRequest from 'make-arvados-request';
  4. import arvadosTypeName from 'arvados-type-name';
  5. import arvadosObjectName from 'arvados-object-name';
  6. import urlForObject from 'url-for-object';
  7. import wbFormatDate from 'wb-format-date';
  8. import WBNameAndUuid from 'wb-name-and-uuid';
  9. import WBAccordion from 'wb-accordion';
  10. class WBContainerRequestFields extends Component {
  11. componentDidMount() {
  12. this.prepareRows();
  13. }
  14. componentWillReceiveProps(nextProps) {
  15. this.props = nextProps;
  16. this.prepareRows();
  17. }
  18. prepareRows() {
  19. let { uuid, app } = this.props;
  20. let { arvHost, arvToken } = app.state;
  21. let item;
  22. let prom = makeArvadosRequest(arvHost, arvToken,
  23. '/arvados/v1/container_requests/' + uuid);
  24. prom = prom.then(xhr => (item = xhr.response));
  25. prom = prom.then(() => {
  26. let rows = [
  27. [ 'Name', item.name ],
  28. [ 'Description', item.description || (<i>{ String(item.description) }</i>) ],
  29. [ 'Properties', (
  30. <WBAccordion names={ ['Properties'] } cardHeaderClass="card-header-sm">
  31. <pre class="word-wrap">{ JSON.stringify(item.properties, null, 2) }</pre>
  32. </WBAccordion>
  33. ) ],
  34. [ 'State', item.state ],
  35. [ 'Requesting Container', (
  36. <WBNameAndUuid app={ app } uuid={ item.requesting_container_uuid } />
  37. ) ],
  38. [ 'Container', (
  39. <WBNameAndUuid app={ app } uuid={ item.container_uuid } />
  40. ) ],
  41. [ 'Container Count Max', item.container_count_max ],
  42. [ 'Mounts', (
  43. <WBAccordion names={ Object.keys(item.mounts) }
  44. cardHeaderClass="card-header-sm">
  45. { Object.keys(item.mounts).map(k => (
  46. <pre class="word-wrap">{ JSON.stringify(item.mounts[k], null, 2) }</pre>
  47. )) }
  48. </WBAccordion>
  49. ) ],
  50. [ 'Runtime Constraints', (
  51. <WBAccordion names={ ['Runtime Constraints'] }
  52. cardHeaderClass="card-header-sm">
  53. <pre class="word-wrap">{ JSON.stringify(item.runtime_constraints, null, 2) }</pre>
  54. </WBAccordion>
  55. ) ],
  56. [ 'Scheduling Parameters', (
  57. <WBAccordion names={ ['Scheduling Parameters'] }
  58. cardHeaderClass="card-header-sm">
  59. <pre class="word-wrap">{ JSON.stringify(item.scheduling_parameters, null, 2) }</pre>
  60. </WBAccordion>
  61. ) ],
  62. [ 'Container Image', (
  63. <WBNameAndUuid app={ app } uuid={ item.container_image } />
  64. ) ],
  65. [ 'Environment', (
  66. <WBAccordion names={ ['Environment'] }
  67. cardHeaderClass="card-header-sm">
  68. <pre class="word-wrap">{ JSON.stringify(item.environment, null, 2) }</pre>
  69. </WBAccordion>
  70. ) ],
  71. [ 'Working Directory', item.cwd ],
  72. [ 'Command', (
  73. <pre class="word-wrap">{ JSON.stringify(item.command) }</pre>
  74. ) ],
  75. [ 'Output Path', item.output_path ],
  76. [ 'Output Name', item.output_name ],
  77. [ 'Output TTL', item.output_ttl ],
  78. [ 'Priority', item.priority ],
  79. [ 'Expires At', wbFormatDate(item.expires_at) ],
  80. [ 'Use Existing', String(item.use_existing) ],
  81. [ 'Log', (
  82. <WBNameAndUuid app={ app } uuid={ item.log_uuid } />
  83. ) ],
  84. [ 'Output', (
  85. <WBNameAndUuid app={ app } uuid={ item.output_uuid } />
  86. ) ],
  87. [ 'Filters', (
  88. item.filters ? (<pre class="word-wrap">{ item.filters }</pre>) : (<i>{ String(item.filters) }</i>)
  89. ) ],
  90. [ 'Runtime Token', item.runtime_token || (<i>{ String(item.runtime_token) }</i>) ],
  91. [ 'Runtime User', (
  92. <WBNameAndUuid app={ app } uuid={ item.runtime_user } />
  93. ) ],
  94. [ 'Runtime Auth Scopes', (
  95. item.runtime_auth_scopes ? (
  96. <pre class="word-wrap">{ JSON.stringify(item.runtime_auth_scopes, null, 2) }</pre>
  97. ) : (
  98. <i>{ String(item.runtime_auth_scopes) }</i>
  99. )
  100. ) ]
  101. ];
  102. this.setState({ 'rows': rows });
  103. });
  104. }
  105. render({}, { rows }) {
  106. return (
  107. rows ? (
  108. <WBTable columns={ [ "Name", "Value" ] }
  109. headerClasses={ [ "col-sm-2", "col-sm-4" ] }
  110. rows={ rows } />
  111. ) : (
  112. <div>Loading...</div>
  113. )
  114. );
  115. }
  116. }
  117. export default WBContainerRequestFields;