Skip to content

Commit

Permalink
Merge pull request #2306 from posit-dev/dotnomad/conditional-secrets-…
Browse files Browse the repository at this point in the history
…clear

Only show clear secrets button when values present
  • Loading branch information
dotNomad authored Sep 25, 2024
2 parents a3f5f09 + d303246 commit 8f2f461
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ import Secret from "src/components/views/secrets/Secret.vue";
const home = useHomeStore();
const sectionActions = computed<ActionButton[]>(() => [
{
label: "Clear Values for all Secrets",
codicon: "codicon-clear-all",
fn: () => {
home.secrets.forEach((_, key) => {
home.secrets.set(key, undefined);
});
},
},
]);
const sectionActions = computed<ActionButton[]>(() => {
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;
});
</script>

0 comments on commit 8f2f461

Please sign in to comment.