feat: Persistent link of vault tag with local credential item#10221
Open
cwangsmv wants to merge 4 commits into
Open
feat: Persistent link of vault tag with local credential item#10221cwangsmv wants to merge 4 commits into
cwangsmv wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
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.
✅ Circular References ReportGenerated at: 2026-07-13T02:52:00.827Z Summary
Click to view all circular references in PR (9)Click to view all circular references in base branch (9)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
cwangsmv
force-pushed
the
spike/link-vault-tag-with-local-item
branch
from
July 13, 2026 02:42
735b704 to
ff33276
Compare
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
INS-2732