From 12e821528b41eaa457dd068bd301e18678f9dc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 13 Oct 2022 13:42:12 +0200 Subject: [PATCH] refactor(editor): disable community nodes on desktop (#4335) * :zap: Disable community nodes on desktop * :fire: Remove logging --- packages/editor-ui/src/modules/settings.ts | 3 +++ .../editor-ui/src/plugins/i18n/locales/en.json | 1 + .../src/views/SettingsCommunityNodesView.vue | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/modules/settings.ts b/packages/editor-ui/src/modules/settings.ts index cc9e91ff4e..d0b4232100 100644 --- a/packages/editor-ui/src/modules/settings.ts +++ b/packages/editor-ui/src/modules/settings.ts @@ -57,6 +57,9 @@ const module: Module = { getPromptsData(state: ISettingsState) { return state.promptsData; }, + isDesktopDeployment(state: ISettingsState) { + return state.settings.deployment?.type.startsWith('desktop_'); + }, isCloudDeployment(state: ISettingsState) { return state.settings.deployment && state.settings.deployment.type === 'cloud'; }, diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index ee5e448b1f..97f1215608 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -801,6 +801,7 @@ "settings.communityNodes.empty.installPackageLabel": "Install a community node", "settings.communityNodes.queueMode.warning": "You need to install community nodes manually because your instance is running in queue mode. More info", "settings.communityNodes.npmUnavailable.warning": "To use this feature, please install npm and restart n8n.", + "settings.communityNodes.notAvailableOnDesktop": "Feature unavailable on desktop. Please self-host to use community nodes.", "settings.communityNodes.packageNodes.label": "{count} node | {count} nodes", "settings.communityNodes.updateAvailable.tooltip": "A newer version is available", "settings.communityNodes.viewDocsAction.label": "Documentation", diff --git a/packages/editor-ui/src/views/SettingsCommunityNodesView.vue b/packages/editor-ui/src/views/SettingsCommunityNodesView.vue index ee5a57074a..1128293482 100644 --- a/packages/editor-ui/src/views/SettingsCommunityNodesView.vue +++ b/packages/editor-ui/src/views/SettingsCommunityNodesView.vue @@ -36,7 +36,7 @@ :heading="$locale.baseText('settings.communityNodes.empty.title')" :description="getEmptyStateDescription" :buttonText=" - isNpmAvailable + shouldShowInstallButton ? $locale.baseText('settings.communityNodes.empty.installPackageLabel') : '' " @@ -146,7 +146,21 @@ export default mixins( }, }); }, + isDesktopDeployment() { + return this.$store.getters['settings/isDesktopDeployment']; + }, + shouldShowInstallButton() { + return !this.isDesktopDeployment && this.isNpmAvailable; + }, actionBoxConfig() { + if (this.isDesktopDeployment) { + return { + calloutText: this.$locale.baseText('settings.communityNodes.notAvailableOnDesktop'), + calloutTheme: 'warning', + hideButton: true, + }; + } + if (!this.isNpmAvailable) { return { calloutText: this.$locale.baseText(