From bd23a60c99e35dbc9d77d6cadef89bb3315cfdcd Mon Sep 17 00:00:00 2001 From: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> Date: Fri, 23 Feb 2024 12:01:21 -0600 Subject: [PATCH] UI: Fix delete from list using Item.callMethod (#25608) * Fix multiple confirm modals showing on delete auth item * fix muliple confirm modals on KMIP items delete * fix multiple modals on namespace list --- ui/app/components/generated-item-list.js | 9 +--- .../components/generated-item-list.hbs | 48 ++++++++----------- .../vault/cluster/access/namespaces/index.hbs | 10 ++-- .../addon/templates/credentials/index.hbs | 8 ++-- ui/lib/kmip/addon/templates/scope/roles.hbs | 14 +++--- ui/lib/kmip/addon/templates/scopes/index.hbs | 14 +++--- 6 files changed, 44 insertions(+), 59 deletions(-) diff --git a/ui/app/components/generated-item-list.js b/ui/app/components/generated-item-list.js index 6339b1e5cd..ca6a09cf2b 100644 --- a/ui/app/components/generated-item-list.js +++ b/ui/app/components/generated-item-list.js @@ -27,14 +27,7 @@ import { tracked } from '@glimmer/tracking'; export default class GeneratedItemList extends Component { @service router; @service store; - @tracked showConfirmModal = false; - - get model() { - return this.args.model || null; - } - get itemType() { - return this.args.itemType || null; - } + @tracked itemToDelete = null; @action refreshItemList() { diff --git a/ui/app/templates/components/generated-item-list.hbs b/ui/app/templates/components/generated-item-list.hbs index 7a5c6d5f81..786ed50428 100644 --- a/ui/app/templates/components/generated-item-list.hbs +++ b/ui/app/templates/components/generated-item-list.hbs @@ -37,37 +37,30 @@ Create - {{singularize this.itemType}} + {{singularize @itemType}} - + {{#if list.empty}} {{else if list.item}} - + {{list.item.id}} @@ -80,39 +73,38 @@ data-test-popup-menu-trigger /> - - {{#if this.showConfirmModal}} + {{#if (eq list.item this.itemToDelete)}} {{/if}} diff --git a/ui/app/templates/vault/cluster/access/namespaces/index.hbs b/ui/app/templates/vault/cluster/access/namespaces/index.hbs index d68832f9ca..169753405e 100644 --- a/ui/app/templates/vault/cluster/access/namespaces/index.hbs +++ b/ui/app/templates/vault/cluster/access/namespaces/index.hbs @@ -46,18 +46,18 @@ {{/if}} {{/let}} - + - {{#if this.showConfirmModal}} + {{#if (eq this.nsToDelete list.item)}} {{/if}} - {{#if this.showConfirmModal}} + {{#if (eq this.credToRevoke list.item)}} {{/if}} {{/if}} - {{#if this.showConfirmModal}} + {{#if (eq this.roleToDelete list.item)}} {{/if}} diff --git a/ui/lib/kmip/addon/templates/scopes/index.hbs b/ui/lib/kmip/addon/templates/scopes/index.hbs index 2eccaa146b..4af903b79d 100644 --- a/ui/lib/kmip/addon/templates/scopes/index.hbs +++ b/ui/lib/kmip/addon/templates/scopes/index.hbs @@ -69,24 +69,24 @@ {{/if}} - {{#if this.showConfirmModal}} + {{#if (eq this.scopeToDelete list.item)}}