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:
Alex Grozav
2022-12-12 14:46:10 +02:00
committed by GitHub
parent 74b831b9b7
commit 1cce8eaf16
3 changed files with 18 additions and 3 deletions

View File

@@ -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 = {