From 75efaf09fbe17405e84428de91507f36249bf786 Mon Sep 17 00:00:00 2001 From: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Date: Wed, 8 Mar 2023 09:37:53 -0800 Subject: [PATCH] UI: fix delete for SSH engine config (#19448) * fix delete not working for ssh config * add test * add changelog; --- changelog/19448.txt | 3 ++ ui/app/components/configure-ssh-secret.js | 22 ++++++---- .../settings/configure-secret-backend.js | 4 +- .../components/configure-ssh-secret.hbs | 18 ++++----- .../settings/configure-secret-backend.hbs | 7 +++- .../configure-ssh-secret-test.js | 40 +++++++++++++++++++ 6 files changed, 76 insertions(+), 18 deletions(-) create mode 100644 changelog/19448.txt create mode 100644 ui/tests/acceptance/settings/configure-secret-backends/configure-ssh-secret-test.js diff --git a/changelog/19448.txt b/changelog/19448.txt new file mode 100644 index 0000000000..8c75b79f14 --- /dev/null +++ b/changelog/19448.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: fixes SSH engine config deletion +``` diff --git a/ui/app/components/configure-ssh-secret.js b/ui/app/components/configure-ssh-secret.js index 41832e10ee..961bbe4267 100644 --- a/ui/app/components/configure-ssh-secret.js +++ b/ui/app/components/configure-ssh-secret.js @@ -6,20 +6,28 @@ import { action } from '@ember/object'; * * @example * ```js - * + * * ``` * * @param {string} model - ssh secret engine model * @param {Function} saveConfig - parent action which updates the configuration - * + * @param {boolean} loading - property in parent that updates depending on status of parent's action + * */ export default class ConfigureSshSecretComponent extends Component { @action - saveConfig(data, event) { + delete() { + this.args.saveConfig({ delete: true }); + } + + @action + saveConfig(event) { event.preventDefault(); - this.args.saveConfig(data); + this.args.saveConfig({ delete: false }); } } diff --git a/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js b/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js index 402eb873b2..69829cffdb 100644 --- a/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js +++ b/ui/app/controllers/vault/cluster/settings/configure-secret-backend.js @@ -31,7 +31,6 @@ export default Controller.extend(CONFIG_ATTRS, { this.model .saveCA({ isDelete }) .then(() => { - this.set('loading', false); this.send('refreshRoute'); this.set('configured', !isDelete); if (isDelete) { @@ -43,6 +42,9 @@ export default Controller.extend(CONFIG_ATTRS, { .catch((error) => { const errorMessage = error.errors ? error.errors.join('. ') : error; this.flashMessages.danger(errorMessage); + }) + .finally(() => { + this.set('loading', false); }); } }, diff --git a/ui/app/templates/components/configure-ssh-secret.hbs b/ui/app/templates/components/configure-ssh-secret.hbs index ae0823b082..94136fe9bc 100644 --- a/ui/app/templates/components/configure-ssh-secret.hbs +++ b/ui/app/templates/components/configure-ssh-secret.hbs @@ -31,14 +31,14 @@ Delete {{else}} -
+
@@ -58,13 +58,13 @@
-