mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
fix(editor): Fix credential sharing issues handler when no matching id or name (#4879)
* fix: fix credential sharing issues handler when no matching id or name * feat: Show erroring credential name as placeholder when available * feat: Add (unavailable) descriptor for unavailable credentials
This commit is contained in:
parent
74b831b9b7
commit
1cce8eaf16
|
@ -17,7 +17,7 @@
|
|||
>
|
||||
<div v-if="readonly || isReadOnly">
|
||||
<n8n-input
|
||||
:value="selected && selected[credentialTypeDescription.name] && selected[credentialTypeDescription.name].name"
|
||||
:value="getSelectedName(credentialTypeDescription.name)"
|
||||
disabled
|
||||
size="small"
|
||||
/>
|
||||
|
@ -26,7 +26,12 @@
|
|||
v-else
|
||||
:class="issues.length ? $style.hasIssues : $style.input"
|
||||
>
|
||||
<n8n-select :value="getSelectedId(credentialTypeDescription.name)" @change="(value) => onCredentialSelected(credentialTypeDescription.name, value)" :placeholder="$locale.baseText('nodeCredentials.selectCredential')" size="small">
|
||||
<n8n-select
|
||||
:value="getSelectedId(credentialTypeDescription.name)"
|
||||
@change="(value) => onCredentialSelected(credentialTypeDescription.name, value)"
|
||||
:placeholder="getSelectPlaceholder(credentialTypeDescription.name, issues)"
|
||||
size="small"
|
||||
>
|
||||
<n8n-option
|
||||
v-for="(item) in getCredentialOptions(credentialTypeDescription.name)"
|
||||
:key="item.id"
|
||||
|
@ -180,6 +185,14 @@ export default mixins(
|
|||
}
|
||||
return undefined;
|
||||
},
|
||||
getSelectedName(type: string) {
|
||||
return this.selected?.[type]?.name;
|
||||
},
|
||||
getSelectPlaceholder(type: string, issues: string[]) {
|
||||
return issues.length && this.getSelectedName(type)
|
||||
? this.$locale.baseText('nodeCredentials.selectedCredentialUnavailable', { interpolate: { name: this.getSelectedName(type) } })
|
||||
: this.$locale.baseText('nodeCredentials.selectCredential');
|
||||
},
|
||||
credentialInputWrapperStyle (credentialType: string) {
|
||||
let deductWidth = 0;
|
||||
const styles = {
|
||||
|
|
|
@ -343,7 +343,8 @@ export const nodeHelpers = mixins(
|
|||
}
|
||||
|
||||
if (nameMatches.length === 0) {
|
||||
if (!this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.WorkflowSharing)) {
|
||||
const isCredentialUsedInWorkflow = this.workflowsStore.usedCredentials?.[selectedCredentials.id as string];
|
||||
if (!isCredentialUsedInWorkflow) {
|
||||
foundIssues[credentialTypeDescription.name] = [this.$locale.baseText('nodeIssues.credentials.doNotExist', { interpolate: { name: selectedCredentials.name, type: credentialDisplayName } }), this.$locale.baseText('nodeIssues.credentials.doNotExist.hint')];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -724,6 +724,7 @@
|
|||
"nodeCredentials.credentialFor": "Credential for {credentialType}",
|
||||
"nodeCredentials.issues": "Issues",
|
||||
"nodeCredentials.selectCredential": "Select Credential",
|
||||
"nodeCredentials.selectedCredentialUnavailable": "{name} (unavailable)",
|
||||
"nodeCredentials.showMessage.message": "Nodes that used credential \"{oldCredentialName}\" have been updated to use \"{newCredentialName}\"",
|
||||
"nodeCredentials.showMessage.title": "Node credential updated",
|
||||
"nodeCredentials.updateCredential": "Update Credential",
|
||||
|
|
Loading…
Reference in a new issue