feat: 🎸 delete action for storage bucket (#191)
* feat: 🎸 delete action for storage bucket ✅ Closes: ICU-8229
This commit is contained in:
1 parent
33af4cd7ea
commit
c91a33a796
4 files changed
+192
No files matched your search
@@ -7,6 +7,7 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { loading } from 'ember-loading';
|
||||
import { confirm } from 'core/decorators/confirm';
|
||||
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
|
||||
export default class ScopesScopeStorageBucketsRoute extends Route {
|
||||
@@ -71,4 +72,20 @@ export default class ScopesScopeStorageBucketsRoute extends Route {
|
||||
storageBucket.rollbackAttributes();
|
||||
if (isNew) this.router.transitionTo('scopes.scope.storage-buckets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the storage bucket.
|
||||
* @param {StorageBucketModel} storageBucket
|
||||
*/
|
||||
@action
|
||||
@loading
|
||||
@confirm('resources.storage-bucket.questions.delete-storage-bucket.message', {
|
||||
title: 'resources.storage-bucket.questions.delete-storage-bucket.title',
|
||||
confirm: 'resources.storage-bucket.actions.delete',
|
||||
})
|
||||
@notifyError(({ message }) => message, { catch: true })
|
||||
@notifySuccess('notifications.delete-success')
|
||||
async delete(storageBucket) {
|
||||
await storageBucket.destroyRecord();
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,14 @@
|
||||
@model={{B.data.id}}
|
||||
@text={{t 'actions.edit'}}
|
||||
/>
|
||||
{{#if (can 'delete model' B.data)}}
|
||||
<dd.Separator />
|
||||
<dd.Interactive
|
||||
@text={{t 'resources.storage-bucket.actions.delete'}}
|
||||
@color='critical'
|
||||
{{on 'click' (route-action 'delete' B.data)}}
|
||||
/>
|
||||
{{/if}}
|
||||
</Hds::Dropdown>
|
||||
</B.Td>
|
||||
</B.Tr>
|
||||
|
||||
Reference in new issue
Block a user