feat: 🎸 add delete cred library action

This commit is contained in:
dharini committed 2021-07-23 15:33:29 -07:00
1 parent 9931b8d3ca
commit a7a84d64b9
3 files changed
+34 -1

No files matched your search

@@ -279,6 +279,7 @@ credential-library:
description: A credential library is a resource that provides credentials.
actions:
create: New Credential Library
delete: Delete Credential Library
messages:
none:
title: No Credential Libraries Available
@@ -1,6 +1,7 @@
import Route from '@ember/routing/route';
import { action } from '@ember/object';
import loading from 'ember-loading/decorator';
import { confirm } from 'core/decorators/confirm';
import { notifySuccess, notifyError } from 'core/decorators/notify';
export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesRoute extends Route {
@@ -50,4 +51,22 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
);
this.refresh();
}
}
/**
* Handle delete of a credential library
* @param {CredentialLibraryModel} credentialLibrary
*/
@action
@loading
@confirm('questions.delete-confirm')
@notifyError(({ message }) => message)
@notifyError(({ message }) => message, { catch: true })
async delete(credentialLibrary) {
await credentialLibrary.destroyRecord();
await this.replaceWith(
'scopes.scope.credential-stores.credential-store.credential-libraries'
);
this.refresh();
}
}
@@ -0,0 +1,13 @@
<Rose::Dropdown
@text={{t 'actions.manage'}}
@dropdownRight={{true}}
as |dropdown|
>
<dropdown.button
@style='danger'
@disabled={{@model.canSave}}
{{on 'click' (route-action 'delete' @model)}}
>
{{t 'resources.credential-library.actions.delete'}}
</dropdown.button>
</Rose::Dropdown>