Skip to content

Commit

Permalink
JSON stringify vscode-context for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
dotNomad committed Aug 22, 2024
1 parent d5ed8c9 commit 4650335
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
: 'codicon-key'
"
align-icon-with-twisty
:data-vscode-context="
credential.guid === CredentialGUIs.EnvironmentGUID
? undefined
: `{"webviewSection": "credentials-tree-item", "credentialGUID": "${credential.guid}", "credentialName": "${credential.name}", "preventDefaultContextMenuItems": true}`
"
:data-vscode-context="vscodeContext(credential)"
/>
</TreeSection>
</template>
Expand All @@ -32,6 +28,7 @@ import WelcomeView from "src/components/WelcomeView.vue";
import { useHomeStore } from "src/stores/home";
import { useHostConduitService } from "src/HostConduitService";
import { Credential } from "../../../../../src/api";
import { CredentialGUIs } from "../../../../../src/constants";
import { WebviewToHostMessageType } from "../../../../../src/types/messages/webviewToHostMessages";
Expand All @@ -58,4 +55,17 @@ const sectionActions = computed(() => {
},
];
});
const vscodeContext = (credential: Credential) => {
if (credential.guid === CredentialGUIs.EnvironmentGUID) {
return undefined;
}
return JSON.stringify({
credentialGUID: credential.guid,
credentialName: credential.name,
webviewSection: "credentials-tree-item",
preventDefaultContextMenuItems: true,
});
};
</script>

0 comments on commit 4650335

Please sign in to comment.