diff --git a/package-lock.json b/package-lock.json index 6f1a247568c32..cd2848757712a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13560,6 +13560,15 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -13595,6 +13604,21 @@ } } }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "optional": true + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -13657,6 +13681,58 @@ "worker-rpc": "^0.1.0" } }, + "fork-ts-checker-webpack-plugin-v5": { + "version": "npm:fork-ts-checker-webpack-plugin@5.2.1", + "resolved": "https://registry.npmjs.org/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-5.2.1.tgz", + "integrity": "sha512-SVi+ZAQOGbtAsUWrZvGzz38ga2YqjWvca1pXQFUArIVXqli0lLoDQ8uS0wg0kSpcwpZmaW5jVCZXQebkyUQSsw==", + "optional": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@types/json-schema": "^7.0.5", + "chalk": "^4.1.0", + "cosmiconfig": "^6.0.0", + "deepmerge": "^4.2.2", + "fs-extra": "^9.0.0", + "memfs": "^3.1.2", + "minimatch": "^3.0.4", + "schema-utils": "2.7.0", + "semver": "^7.3.2", + "tapable": "^1.0.0" + }, + "dependencies": { + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "optional": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "optional": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -13691,6 +13767,12 @@ "slash": "^2.0.0" } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "optional": true + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -13719,6 +13801,16 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "optional": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -13754,6 +13846,17 @@ } } }, + "schema-utils": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz", + "integrity": "sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==", + "optional": true, + "requires": { + "@types/json-schema": "^7.0.4", + "ajv": "^6.12.2", + "ajv-keywords": "^3.4.1" + } + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -13764,6 +13867,15 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "to-regex-range": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", @@ -13857,6 +13969,12 @@ "requires": { "tslib": "^1.8.1" } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "optional": true } } }, @@ -23356,124 +23474,6 @@ } } }, - "fork-ts-checker-webpack-plugin-v5": { - "version": "npm:fork-ts-checker-webpack-plugin@5.2.1", - "resolved": "https://registry.npmjs.org/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-5.2.1.tgz", - "integrity": "sha512-SVi+ZAQOGbtAsUWrZvGzz38ga2YqjWvca1pXQFUArIVXqli0lLoDQ8uS0wg0kSpcwpZmaW5jVCZXQebkyUQSsw==", - "optional": true, - "requires": { - "@babel/code-frame": "^7.8.3", - "@types/json-schema": "^7.0.5", - "chalk": "^4.1.0", - "cosmiconfig": "^6.0.0", - "deepmerge": "^4.2.2", - "fs-extra": "^9.0.0", - "memfs": "^3.1.2", - "minimatch": "^3.0.4", - "schema-utils": "2.7.0", - "semver": "^7.3.2", - "tapable": "^1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "optional": true - }, - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "optional": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "optional": true - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "optional": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "schema-utils": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz", - "integrity": "sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==", - "optional": true, - "requires": { - "@types/json-schema": "^7.0.4", - "ajv": "^6.12.2", - "ajv-keywords": "^3.4.1" - } - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "optional": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "optional": true - } - } - }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 1fb8ecf7ea6cf..2fb3d71077adc 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -150,7 +150,7 @@ import { InternalHooksManager } from './InternalHooksManager'; import { TagEntity } from './databases/entities/TagEntity'; import { WorkflowEntity } from './databases/entities/WorkflowEntity'; import { NameRequest } from './WorkflowHelpers'; -import { getNodeTranslationPath } from './TranslationHelpers'; +import { getCredentialTranslationPath, getNodeTranslationPath } from './TranslationHelpers'; require('body-parser-xml')(bodyParser); @@ -1178,6 +1178,27 @@ class App { ), ); + this.app.get( + `/${this.restEndpoint}/credential-translation`, + ResponseHelper.send( + async ( + req: express.Request & { query: { credentialType: string } }, + res: express.Response, + ): Promise => { + const translationPath = getCredentialTranslationPath({ + locale: this.frontendSettings.defaultLocale, + credentialType: req.query.credentialType, + }); + + try { + return require(translationPath); + } catch (error) { + return null; + } + }, + ), + ); + // Returns node information based on node names and versions this.app.post( `/${this.restEndpoint}/node-types`, @@ -1201,13 +1222,17 @@ class App { nodeTypes: INodeTypeDescription[], ) { const { description, sourcePath } = NodeTypes().getWithSourcePath(name, version); - const translationPath = await getNodeTranslationPath(sourcePath, defaultLocale); + const translationPath = await getNodeTranslationPath({ + nodeSourcePath: sourcePath, + longNodeType: description.name, + locale: defaultLocale, + }); try { const translation = await readFile(translationPath, 'utf8'); description.translation = JSON.parse(translation); } catch (error) { - // ignore - no translation at expected translation path + // ignore - no translation exists at path } nodeTypes.push(description); diff --git a/packages/cli/src/TranslationHelpers.ts b/packages/cli/src/TranslationHelpers.ts index 547c3e9c305aa..bcd3fa76f9d4e 100644 --- a/packages/cli/src/TranslationHelpers.ts +++ b/packages/cli/src/TranslationHelpers.ts @@ -2,7 +2,7 @@ import { join, dirname } from 'path'; import { readdir } from 'fs/promises'; import { Dirent } from 'fs'; -const ALLOWED_VERSIONED_DIRNAME_LENGTH = [2, 3]; // v1, v10 +const ALLOWED_VERSIONED_DIRNAME_LENGTH = [2, 3]; // e.g. v1, v10 function isVersionedDirname(dirent: Dirent) { if (!dirent.isDirectory()) return false; @@ -26,14 +26,39 @@ async function getMaxVersion(from: string) { return Math.max(...dirnames.map((d) => parseInt(d.charAt(1), 10))); } -export async function getNodeTranslationPath( - nodeSourcePath: string, - language: string, -): Promise { +/** + * Get the full path to a node translation file in `/dist`. + */ +export async function getNodeTranslationPath({ + nodeSourcePath, + longNodeType, + locale, +}: { + nodeSourcePath: string; + longNodeType: string; + locale: string; +}): Promise { const nodeDir = dirname(nodeSourcePath); const maxVersion = await getMaxVersion(nodeDir); + const nodeType = longNodeType.replace('n8n-nodes-base.', ''); return maxVersion - ? join(nodeDir, `v${maxVersion}`, 'translations', `${language}.json`) - : join(nodeDir, 'translations', `${language}.json`); + ? join(nodeDir, `v${maxVersion}`, 'translations', locale, `${nodeType}.json`) + : join(nodeDir, 'translations', locale, `${nodeType}.json`); +} + +/** + * Get the full path to a credential translation file in `/dist`. + */ +export function getCredentialTranslationPath({ + locale, + credentialType, +}: { + locale: string; + credentialType: string; +}): string { + const packagesPath = join(__dirname, '..', '..', '..'); + const credsPath = join(packagesPath, 'nodes-base', 'dist', 'credentials'); + + return join(credsPath, 'translations', locale, `${credentialType}.json`); } diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 35af2e6b3e8a8..57ed602bf6332 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -163,6 +163,7 @@ export interface IRestApi { getPastExecutions(filter: object, limit: number, lastId?: string | number, firstId?: string | number): Promise; stopCurrentExecution(executionId: string): Promise; makeRestApiRequest(method: string, endpoint: string, data?: any): Promise; // tslint:disable-line:no-any + getCredentialTranslation(credentialType: string): Promise; getNodeTranslationHeaders(): Promise; getNodeTypes(onlyLatest?: boolean): Promise; getNodesInformation(nodeInfos: INodeTypeNameVersion[]): Promise; @@ -646,9 +647,9 @@ export interface IRootState { activeExecutions: IExecutionsCurrentSummaryExtended[]; activeWorkflows: string[]; activeActions: string[]; + activeCredentialType: string | null; activeNode: string | null; baseUrl: string; - credentialTextRenderKeys: { nodeType: string; credentialType: string; } | null; defaultLocale: string; endpointWebhook: string; endpointWebhookTest: string; diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index ad2eb3417d0dc..aa07a78180c1b 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -4,7 +4,7 @@ append-to-body :close-on-click-modal="false" width="80%" - :title="`${$locale.baseText('codeEdit.edit')} ${$locale.nodeText().topParameterDisplayName(parameter)}`" + :title="`${$locale.baseText('codeEdit.edit')} ${$locale.nodeText().inputLabelDisplayName(parameter, path)}`" :before-close="closeDialog" >
@@ -39,7 +39,7 @@ export default mixins( workflowHelpers, ).extend({ name: 'CodeEdit', - props: ['codeAutocomplete', 'parameter', 'type', 'value'], + props: ['codeAutocomplete', 'parameter', 'path', 'type', 'value'], data() { return { monacoInstance: null as monaco.editor.IStandaloneCodeEditor | null, diff --git a/packages/editor-ui/src/components/CollectionParameter.vue b/packages/editor-ui/src/components/CollectionParameter.vue index 35361227c7e48..ae2dcbd2baf6d 100644 --- a/packages/editor-ui/src/components/CollectionParameter.vue +++ b/packages/editor-ui/src/components/CollectionParameter.vue @@ -19,7 +19,7 @@ @@ -67,7 +67,7 @@ export default mixins( }, computed: { getPlaceholderText (): string { - const placeholder = this.$locale.nodeText().placeholder(this.parameter); + const placeholder = this.$locale.nodeText().placeholder(this.parameter, this.path); return placeholder ? placeholder : this.$locale.baseText('collectionParameter.choose'); }, getProperties (): INodeProperties[] { diff --git a/packages/editor-ui/src/components/CopyInput.vue b/packages/editor-ui/src/components/CopyInput.vue index 1512548410eb6..baad3bb8c947d 100644 --- a/packages/editor-ui/src/components/CopyInput.vue +++ b/packages/editor-ui/src/components/CopyInput.vue @@ -38,7 +38,7 @@ export default mixins(copyPaste, showMessage).extend({ this.copyToClipboard(this.$props.copyContent); this.$showMessage({ - title: this.$locale.baseText('credentialsEdit.showMessage.title'), + title: this.$locale.baseText('credentialEdit.credentialEdit.showMessage.title'), message: this.$props.successMessage, type: 'success', }); diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialConfig.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialConfig.vue index 2da9b398144e8..210ee9a506e4b 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialConfig.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialConfig.vue @@ -81,7 +81,7 @@ import CopyInput from '../CopyInput.vue'; import CredentialInputs from './CredentialInputs.vue'; import OauthButton from './OauthButton.vue'; import { restApi } from '@/components/mixins/restApi'; -import { addNodeTranslation } from '@/plugins/i18n'; +import { addCredentialTranslation } from '@/plugins/i18n'; import mixins from 'vue-typed-mixins'; export default mixins(restApi).extend({ @@ -128,10 +128,20 @@ export default mixins(restApi).extend({ }, }, async beforeMount() { - if (this.$store.getters.defaultLocale !== 'en') { - await this.findCredentialTextRenderKeys(); - await this.addNodeTranslationForCredential(); - } + if (this.$store.getters.defaultLocale === 'en') return; + + this.$store.commit('setActiveCredentialType', this.credentialType.name); + + const key = `n8n-nodes-base.credentials.${this.credentialType.name}`; + + if (this.$locale.exists(key)) return; + + const credTranslation = await this.restApi().getCredentialTranslation(this.credentialType.name); + + addCredentialTranslation( + { [this.credentialType.name]: credTranslation }, + this.$store.getters.defaultLocale, + ); }, computed: { appName(): string { @@ -139,6 +149,8 @@ export default mixins(restApi).extend({ return ''; } + + const appName = getAppNameFromCredType( (this.credentialType as ICredentialType).displayName, ); @@ -177,47 +189,6 @@ export default mixins(restApi).extend({ }, }, methods: { - /** - * Find the keys needed by the mixin to render credential text, and place them in the Vuex store. - */ - async findCredentialTextRenderKeys() { - const nodeTypes = await this.restApi().getNodeTypes(); - - // credential type name β†’ node type name - const map = nodeTypes.reduce>((acc, cur) => { - if (!cur.credentials) return acc; - - cur.credentials.forEach(cred => { - if (acc[cred.name]) return; - acc[cred.name] = cur.name; - }); - - return acc; - }, {}); - - const renderKeys = { - nodeType: map[this.credentialType.name], - credentialType: this.credentialType.name, - }; - - this.$store.commit('setCredentialTextRenderKeys', renderKeys); - }, - - /** - * Add to the translation object the node translation for the credential in the modal. - */ - async addNodeTranslationForCredential() { - const { nodeType }: { nodeType: string } = this.$store.getters.credentialTextRenderKeys; - const version = await this.getCurrentNodeVersion(nodeType); - const nodeToBeFetched = [{ name: nodeType, version }]; - const nodesInfo = await this.restApi().getNodesInformation(nodeToBeFetched); - const nodeInfo = nodesInfo.pop(); - - if (nodeInfo && nodeInfo.translation) { - addNodeTranslation(nodeInfo.translation, this.$store.getters.defaultLocale); - } - }, - /** * Get the current version for a node type. */ diff --git a/packages/editor-ui/src/components/Error/NodeErrorView.vue b/packages/editor-ui/src/components/Error/NodeErrorView.vue index 6b762781adf93..83bf6fe918b0a 100644 --- a/packages/editor-ui/src/components/Error/NodeErrorView.vue +++ b/packages/editor-ui/src/components/Error/NodeErrorView.vue @@ -1,7 +1,7 @@