diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index 1fd364182..c796d099c 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -467,6 +467,7 @@ export default function () { this.get('/credential-stores/:id'); this.post('/credential-stores'); this.patch('/credential-stores/:id'); + this.del('/credential-stores/:id'); // credential-libraries diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index cc9fed978..56baf2d3d 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -278,4 +278,4 @@ credential-library: messages: none: title: No Credential Libraries Available - description: No Credential Libraries available in this credential store. \ No newline at end of file + description: No Credential Libraries available in this credential store. diff --git a/ui/admin/app/routes/scopes/scope/credential-stores.js b/ui/admin/app/routes/scopes/scope/credential-stores.js index 4bac020b1..8bfce1b1d 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores.js @@ -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 ScopesScopeCredentialStoresRoute extends Route { @@ -44,4 +45,19 @@ export default class ScopesScopeCredentialStoresRoute extends Route { credentialStore.rollbackAttributes(); if (isNew) this.transitionTo('scopes.scope.credential-stores'); } + + /** + * Deletes the credential store and redirects to index + * @param {CredentialStoreModel} credentialStore + */ + @action + @loading + @confirm('questions.delete-confirm') + @notifyError(({ message }) => message, { catch: true }) + @notifySuccess('notifications.delete-success') + async delete(credentialStore) { + await credentialStore.destroyRecord(); + await this.replaceWith('scopes.scope.credential-stores'); + this.refresh(); + } } diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js index 307c11079..d217736fc 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js @@ -25,5 +25,10 @@ export default class ScopesScopeCredentialStoresCredentialStoreRoute extends Rou into: 'scopes/scope/credential-stores/credential-store', outlet: 'navigation', }); + + this.render('scopes/scope/credential-stores/credential-store/-actions', { + into: 'scopes/scope/credential-stores/credential-store', + outlet: 'actions', + }); } } diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs index a6ecd7f81..efc46641a 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs @@ -15,7 +15,7 @@ - {{!-- {{outlet 'actions'}} --}} + {{outlet 'actions'}} diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-actions.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-actions.hbs new file mode 100644 index 000000000..165b709ca --- /dev/null +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-actions.hbs @@ -0,0 +1,17 @@ + + + {{t 'resources.credential-store.actions.create'}} + + + + {{t 'resources.credential-store.actions.delete'}} + + \ No newline at end of file