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.

66 lines
1.9KB

  1. import { h, Component } from 'preact';
  2. import WBTable from 'wb-table';
  3. import makeArvadosRequest from 'make-arvados-request';
  4. import WBAccordion from 'wb-accordion';
  5. import WBJsonViewer from 'wb-json-viewer';
  6. import wbFormatSpecialValue from 'wb-format-special-value';
  7. import WBLazyInlineName from 'wb-lazy-inline-name';
  8. import wbFormatDate from 'wb-format-date';
  9. class WBProjectFields extends Component {
  10. componentDidMount() {
  11. this.prepareRows();
  12. }
  13. componentWillReceiveProps(nextProps) {
  14. this.props = nextProps;
  15. this.prepareRows();
  16. }
  17. prepareRows() {
  18. let { uuid, app } = this.props;
  19. let { arvHost, arvToken } = app.state;
  20. let prom = makeArvadosRequest(arvHost, arvToken,
  21. '/arvados/v1/groups/' + uuid);
  22. prom = prom.then(xhr => {
  23. const item = xhr.response;
  24. const rows = [
  25. [ 'Name', wbFormatSpecialValue(item.name) ],
  26. [ 'Description', wbFormatSpecialValue(item.description) ],
  27. [ 'Properties', (
  28. <WBAccordion names={[ 'Properties' ]} cardHeaderClass="card-header-sm">
  29. <WBJsonViewer app={ app } value={ item.properties } />
  30. </WBAccordion>
  31. ) ],
  32. [ 'Writable by', item.writable_by
  33. .map(a => (<WBLazyInlineName app={ app } identifier={ a } />))
  34. .reduce((a, b) => [].concat(a).concat(', ').concat(b))
  35. ],
  36. [ 'Trash At', wbFormatDate(item.trash_at) ],
  37. [ 'Delete At', wbFormatDate(item.delete_at) ],
  38. [ 'Is Trashed', wbFormatSpecialValue(item.is_trashed) ]
  39. ];
  40. this.setState({ 'rows': rows });
  41. });
  42. }
  43. render({}, { rows }) {
  44. return (
  45. rows ? (
  46. <WBTable columns={ [ "Name", "Value" ] }
  47. headerClasses={ [ "col-sm-2", "col-sm-4" ] }
  48. rows={ rows }
  49. verticalHeader={ true } />
  50. ) : (
  51. <div>Loading...</div>
  52. )
  53. );
  54. }
  55. }
  56. export default WBProjectFields;