Skip to content

feat: Persistent link of vault tag with local credential item#10221

Open
cwangsmv wants to merge 4 commits into
developfrom
spike/link-vault-tag-with-local-item
Open

feat: Persistent link of vault tag with local credential item#10221
cwangsmv wants to merge 4 commits into
developfrom
spike/link-vault-tag-with-local-item

Conversation

@cwangsmv

@cwangsmv cwangsmv commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Changes:

  • Each vault tag will be assigned a unique ID when create.
  • Legacy tags will generate the unique ID when user edits the tag.
  • The mapping between a vault tag and its credential item will be stored in the local plugin store instead of the vault tag itself.

INS-2732

Copilot AI review requested due to automatic review settings July 8, 2026 02:42
@cwangsmv
cwangsmv marked this pull request as draft July 8, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to support work around reliably identifying and associating credential-related entities by introducing an ID-shape helper in the data model, alongside a small UI-side adjustment in the CodeMirror one-line editor.

Changes:

  • Added isCloudCredentialId() helper to detect Cloud Credential IDs by prefix.
  • Updated the one-line editor with an additional constants import (currently unused) and fixed a comment typo (“enterprise”).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/insomnia/src/ui/components/.client/codemirror/one-line-editor.tsx Adds a constants import and adjusts a comment in the Nunjucks context-menu handler.
packages/insomnia-data/src/models/cloud-credential.ts Adds an isCloudCredentialId helper based on the model prefix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/insomnia/src/ui/components/.client/codemirror/one-line-editor.tsx Outdated
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

✅ Circular References Report

Generated at: 2026-07-13T02:52:00.827Z
Status: ✅ NO CHANGE

Summary

Metric Base (develop) PR Change
Total Circular References 9 9 0 (0.00%)
Click to view all circular references in PR (9)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/main/prompt-bridge.ts -> insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx
Click to view all circular references in base branch (9)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/main/prompt-bridge.ts -> insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx

Analysis

No Change: This PR does not introduce or remove any circular references.


This report was generated automatically by comparing against the develop branch.

@cwangsmv
cwangsmv requested a review from a team July 13, 2026 02:30
@cwangsmv
cwangsmv force-pushed the spike/link-vault-tag-with-local-item branch from 735b704 to ff33276 Compare July 13, 2026 02:42
@cwangsmv
cwangsmv requested a review from Copilot July 13, 2026 02:47
@cwangsmv
cwangsmv marked this pull request as ready for review July 13, 2026 02:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +414 to +426
const getModelValue = () => {
if (typeof strValue === 'string') {
if (modelName === cloudCredentialModelType) {
return models.cloudCredential.isCloudCredentialId(strValue)
? // legacy version to save cloud credential id in tag
strValue
: // new version to save cloud credential id in pluginData, and each tag will have a unique id as key to get the cloud credential id as value from pluginData
state.vaultPluginData.find(data => data.key === strValue)?.value || '';
}
return strValue;
}
return 'unknown';
};
Comment on lines +442 to +458
const selectedCredentialId = event.currentTarget.value;
let tagUniqueId = strValue;
if (models.cloudCredential.isCloudCredentialId(strValue) || !strValue) {
// legacy version to save cloud credential id in tag or default empty value, generate a unique id as key to save in pluginData
tagUniqueId = generateId('externalVaultTag');
let argIndex = -1;
if (event.currentTarget.parentNode instanceof HTMLElement) {
const index = event.currentTarget.parentNode?.dataset.argIndex;
argIndex = typeof index === 'string' ? Number.parseInt(index, 10) : -1;
}
// update the tag arg value to the unique id so that we can use it as key to get the selected cloud credential id from pluginData
updateArg(tagUniqueId, argIndex);
}
// Update the link between the unique id and the selected cloud credential id in pluginData
return services.pluginData
.upsertByKey(vaultPluginName, tagUniqueId, selectedCredentialId)
.then(refreshVaultPluginData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants