// // Copyright (C) Stanislaw Adaszewski, 2020 // Contact: s.adaszewski@gmail.com // Website: https://adared.ch/wba // License: GNU Affero General Public License, Version 3 // import { h, Component, createRef } from 'preact'; import WBDialog from 'wb-dialog'; import WBArvadosCrumbs from 'wb-arvados-crumbs'; import linkState from 'linkstate'; import wbDeleteObject from 'wb-delete-object'; import arvadosTypeName from 'arvados-type-name'; class WBDeleteDialog extends Component { constructor(...args) { super(...args); this.dialogRef = createRef(); } show(item, callback) { this.setState({ 'item': item, 'callback': callback || (() => {}) }); this.dialogRef.current.show(); } hide() { this.dialogRef.current.hide(); } render({ app }, { item, callback }) { const { arvHost, arvToken } = app.state; return (
Are you sure you want to delete the following { item ? arvadosTypeName(item.uuid) : null }:
{ item ? : null }
???
{ e.preventDefault(); this.hide(); wbDeleteObject(arvHost, arvToken, item.uuid).then(callback); } } />
); } } export default WBDeleteDialog;