From 5ad6b025508fb933139007e33897c04707f8c86a Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 19 Aug 2020 17:10:48 -0400 Subject: [PATCH] chore: Add Manage>Delete dropdown to an auth method --- ui/core/app/routes/scopes/scope/auth-methods.js | 17 +++++++++++++++++ .../scope/auth-methods/auth-method/index.hbs | 12 ++++++++++++ ui/core/tests/acceptance/auth-methods-test.js | 4 ++++ ui/core/translations/en-us.yaml | 1 + 4 files changed, 34 insertions(+) diff --git a/ui/core/app/routes/scopes/scope/auth-methods.js b/ui/core/app/routes/scopes/scope/auth-methods.js index 0e35b2c28..7527ac784 100644 --- a/ui/core/app/routes/scopes/scope/auth-methods.js +++ b/ui/core/app/routes/scopes/scope/auth-methods.js @@ -58,4 +58,21 @@ export default class ScopesScopeAuthMethodsRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } + + /** + * Delete an auth method in current scope and redirect to index + * @param {AuthMethodModel} authMethod + */ + @action + async delete(authMethod) { + try { + await authMethod.destroyRecord(); + this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); + this.transitionTo('scopes.scope.auth-methods'); + } catch (error) { + //TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } } diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs index c08c3fd4a..753e4fdf2 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs @@ -18,6 +18,18 @@ + + + + {{t 'actions.delete-auth-method'}} + + + +