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!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5KB

  1. import { h, Component, createRef } from 'preact';
  2. import WBDialog from 'wb-dialog';
  3. import WBArvadosCrumbs from 'wb-arvados-crumbs';
  4. import linkState from 'linkstate';
  5. import wbDeleteObject from 'wb-delete-object';
  6. import arvadosTypeName from 'arvados-type-name';
  7. class WBDeleteDialog extends Component {
  8. constructor(...args) {
  9. super(...args);
  10. this.dialogRef = createRef();
  11. }
  12. show(item, callback) {
  13. this.setState({
  14. 'item': item,
  15. 'callback': callback || (() => {})
  16. });
  17. this.dialogRef.current.show();
  18. }
  19. hide() {
  20. this.dialogRef.current.hide();
  21. }
  22. render({ app }, { item, callback }) {
  23. const { arvHost, arvToken } = app.state;
  24. return (
  25. <WBDialog title="Delete" ref={ this.dialogRef }>
  26. <div>
  27. <div class="mb-3">
  28. Are you sure you want to delete the following { item ? arvadosTypeName(item.uuid) : null }:
  29. </div>
  30. { item ? <WBArvadosCrumbs app={ app } uuid={ item.uuid } /> : null }
  31. <div>???</div>
  32. </div>
  33. <div>
  34. <input type="submit" class="btn btn-danger mr-2" value="Delete"
  35. onclick={ e => { e.preventDefault(); this.hide();
  36. wbDeleteObject(arvHost, arvToken, item.uuid).then(callback); } } />
  37. <button class="btn btn-secondary mr-2" onclick={ e => { e.preventDefault();
  38. this.hide(); } }>
  39. Cancel
  40. </button>
  41. </div>
  42. </WBDialog>
  43. );
  44. }
  45. }
  46. export default WBDeleteDialog;