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 kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

wb-container-request-fields.js 4.5KB

vor 4 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. rows = rows.map(r => [r[0], r[1] ? r[1] : (<i>{ String(r[1]) }</i>)]);
  103. this.setState({ 'rows': rows });
  104. });
  105. }
  106. render({}, { rows }) {
  107. return (
  108. rows ? (
  109. <WBTable columns={ [ "Name", "Value" ] }
  110. headerClasses={ [ "col-sm-2", "col-sm-4" ] }
  111. rows={ rows }
  112. verticalHeader={ true } />
  113. ) : (
  114. <div>Loading...</div>
  115. )
  116. );
  117. }
  118. }
  119. export default WBContainerRequestFields;