From d303246e09016c5ef5ffa4f25968567c46b73115 Mon Sep 17 00:00:00 2001 From: Jordan Jensen Date: Tue, 24 Sep 2024 12:00:09 -0700 Subject: [PATCH] Only show clear secrets button when values present --- .../src/components/views/secrets/Secrets.vue | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/extensions/vscode/webviews/homeView/src/components/views/secrets/Secrets.vue b/extensions/vscode/webviews/homeView/src/components/views/secrets/Secrets.vue index 8fdfa2539..f8946a69d 100644 --- a/extensions/vscode/webviews/homeView/src/components/views/secrets/Secrets.vue +++ b/extensions/vscode/webviews/homeView/src/components/views/secrets/Secrets.vue @@ -24,15 +24,21 @@ import Secret from "src/components/views/secrets/Secret.vue"; const home = useHomeStore(); -const sectionActions = computed(() => [ - { - label: "Clear Values for all Secrets", - codicon: "codicon-clear-all", - fn: () => { - home.secrets.forEach((_, key) => { - home.secrets.set(key, undefined); - }); - }, - }, -]); +const sectionActions = computed(() => { + const result: ActionButton[] = []; + + if (home.secretsWithValueCount > 0) { + result.push({ + label: "Clear Values for all Secrets", + codicon: "codicon-clear-all", + fn: () => { + home.secrets.forEach((_, key) => { + home.secrets.set(key, undefined); + }); + }, + }); + } + + return result; +});