refactor(editor): disable community nodes on desktop (#4335)

*  Disable community nodes on desktop

* 🔥 Remove logging
This commit is contained in:
Iván Ovejero 2022-10-13 13:42:12 +02:00 committed by GitHub
parent d45bc4999c
commit 12e821528b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -57,6 +57,9 @@ const module: Module<ISettingsState, IRootState> = {
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';
},

View file

@ -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. <a href=\"{docURL}\" target=\"_blank\" title=\"Read the n8n docs\">More info</a>",
"settings.communityNodes.npmUnavailable.warning": "To use this feature, please <a href=\"{npmUrl}\" target=\"_blank\" title=\"How to install npm\">install npm</a> 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",

View file

@ -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(