mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
refactor(editor): Clean all instances of isDesktopDeployment
(#10884)
This commit is contained in:
parent
693fb7e580
commit
26a653a79a
|
@ -261,9 +261,7 @@ export class FrontendService {
|
|||
Object.assign(this.settings.userManagement, {
|
||||
quota: this.license.getUsersLimit(),
|
||||
authenticationMethod: getCurrentAuthenticationMethod(),
|
||||
showSetupOnFirstLoad:
|
||||
!config.getEnv('userManagement.isInstanceOwnerSetUp') &&
|
||||
!config.getEnv('deployment.type').startsWith('desktop_'),
|
||||
showSetupOnFirstLoad: !config.getEnv('userManagement.isInstanceOwnerSetUp'),
|
||||
});
|
||||
|
||||
let dismissedBanners: string[] = [];
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
import userEvent from '@testing-library/user-event';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import { getDropdownItems, mockedStore } from '@/__tests__/utils';
|
||||
import { createUser } from '@/__tests__/data/users';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { getDropdownItems } from '@/__tests__/utils';
|
||||
import PersonalizationModal from '@/components/PersonalizationModal.vue';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import {
|
||||
COMPANY_TYPE_KEY,
|
||||
EMAIL_KEY,
|
||||
COMPANY_INDUSTRY_EXTENDED_KEY,
|
||||
OTHER_COMPANY_INDUSTRY_EXTENDED_KEY,
|
||||
MARKETING_AUTOMATION_GOAL_KEY,
|
||||
|
@ -42,18 +38,6 @@ describe('PersonalizationModal', () => {
|
|||
expect(getByTitle('Customize n8n to you')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows user input when needed for desktop deployment', () => {
|
||||
const pinia = createTestingPinia();
|
||||
const usersStore = mockedStore(useUsersStore);
|
||||
usersStore.currentUser = createUser({ firstName: undefined });
|
||||
|
||||
const settingsStore = mockedStore(useSettingsStore);
|
||||
settingsStore.isDesktopDeployment = true;
|
||||
|
||||
const { getByTestId } = renderModal({ pinia });
|
||||
expect(getByTestId(EMAIL_KEY)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('Company field', () => {
|
||||
it('allows completion of company related fields', async () => {
|
||||
const { getByTestId } = renderModal({ pinia: createTestingPinia() });
|
||||
|
|
|
@ -25,7 +25,6 @@ import {
|
|||
TELECOMS_INDUSTRY,
|
||||
OTHER_AUTOMATION_GOAL,
|
||||
COMPANY_TYPE_KEY,
|
||||
EMAIL_KEY,
|
||||
SAAS_COMPANY_TYPE,
|
||||
ECOMMERCE_COMPANY_TYPE,
|
||||
MSP_INDUSTRY,
|
||||
|
@ -85,7 +84,6 @@ import {
|
|||
import { useToast } from '@/composables/useToast';
|
||||
import Modal from '@/components/Modal.vue';
|
||||
import type { IFormInputs, IPersonalizationLatestVersion } from '@/Interface';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useRootStore } from '@/stores/root.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { createEventBus, createFormEventBus } from 'n8n-design-system/utils';
|
||||
|
@ -102,7 +100,6 @@ const formBus = createFormEventBus();
|
|||
const { showError } = useToast();
|
||||
const i18n = useI18n();
|
||||
const rootStore = useRootStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const usersStore = useUsersStore();
|
||||
const posthogStore = usePostHog();
|
||||
const route = useRoute();
|
||||
|
@ -112,15 +109,6 @@ const formValues = ref<Record<string, string>>({});
|
|||
const isSaving = ref(false);
|
||||
|
||||
const survey = computed<IFormInputs>(() => [
|
||||
{
|
||||
name: EMAIL_KEY,
|
||||
properties: {
|
||||
label: i18n.baseText('personalizationModal.yourEmailAddress'),
|
||||
type: 'text',
|
||||
placeholder: i18n.baseText('personalizationModal.email'),
|
||||
},
|
||||
shouldDisplay: () => settingsStore.isDesktopDeployment && !usersStore.currentUser?.firstName,
|
||||
},
|
||||
{
|
||||
name: COMPANY_TYPE_KEY,
|
||||
properties: {
|
||||
|
|
|
@ -1597,7 +1597,6 @@
|
|||
"settings.communityNodes.empty.description.no-packages": "Install node packages contributed by our community.",
|
||||
"settings.communityNodes.empty.installPackageLabel": "Install a community node",
|
||||
"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",
|
||||
|
@ -1788,8 +1787,6 @@
|
|||
"settings.usageAndPlan.license.activation.error.title": "Activation failed",
|
||||
"settings.usageAndPlan.license.activation.success.title": "License activated",
|
||||
"settings.usageAndPlan.license.activation.success.message": "Your {name} {type} has been successfully activated.",
|
||||
"settings.usageAndPlan.desktop.title": "Upgrade to n8n Cloud for the full experience",
|
||||
"settings.usageAndPlan.desktop.description": "Cloud plans allow you to collaborate with teammates. Plus you don’t need to leave this app open all the time for your workflows to run.",
|
||||
"settings.externalSecrets.title": "External Secrets",
|
||||
"settings.externalSecrets.info": "Connect external secrets tools for centralized credentials management across environments, and to enhance system security.",
|
||||
"settings.externalSecrets.info.link": "More info",
|
||||
|
@ -2317,47 +2314,32 @@
|
|||
"variables.modals.deleteConfirm.cancelButton": "Cancel",
|
||||
"contextual.credentials.sharing.unavailable.title": "Upgrade to collaborate",
|
||||
"contextual.credentials.sharing.unavailable.title.cloud": "Upgrade to collaborate",
|
||||
"contextual.credentials.sharing.unavailable.title.desktop": "Upgrade to n8n Cloud to collaborate",
|
||||
"contextual.credentials.sharing.unavailable.description": "You can share credentials with others when you upgrade your plan.",
|
||||
"contextual.credentials.sharing.unavailable.description.cloud": "You can share credentials with others when you upgrade your plan.",
|
||||
"contextual.credentials.sharing.unavailable.description.desktop": "Sharing features are available on selected Cloud plans",
|
||||
"contextual.credentials.sharing.unavailable.button": "View plans",
|
||||
"contextual.credentials.sharing.unavailable.button.cloud": "Upgrade now",
|
||||
"contextual.credentials.sharing.unavailable.button.desktop": "View plans",
|
||||
"contextual.workflows.sharing.title": "Sharing",
|
||||
"contextual.workflows.sharing.unavailable.title": "Sharing",
|
||||
"contextual.workflows.sharing.unavailable.title.cloud": "Upgrade to collaborate",
|
||||
"contextual.workflows.sharing.unavailable.title.desktop": "Upgrade to n8n Cloud to collaborate",
|
||||
"contextual.workflows.sharing.unavailable.description.modal": "You can collaborate with others on workflows when you upgrade your plan.",
|
||||
"contextual.workflows.sharing.unavailable.description.modal.cloud": "You can collaborate with others on workflows when you upgrade your plan.",
|
||||
"contextual.workflows.sharing.unavailable.description.modal.desktop": "Upgrade to n8n Cloud to collaborate on workflows: sharing features are available on selected plans.",
|
||||
"contextual.workflows.sharing.unavailable.description.tooltip": "You can collaborate with others on workflows when you upgrade your plan. {action}",
|
||||
"contextual.workflows.sharing.unavailable.description.tooltip.cloud": "You can collaborate with others on workflows when you upgrade your plan. {action}",
|
||||
"contextual.workflows.sharing.unavailable.description.tooltip.desktop": "Upgrade to n8n Cloud to collaborate on workflows: sharing features are available on selected plans. {action}",
|
||||
"contextual.workflows.sharing.unavailable.button": "View plans",
|
||||
"contextual.workflows.sharing.unavailable.button.cloud": "Upgrade now",
|
||||
"contextual.workflows.sharing.unavailable.button.desktop": "View plans",
|
||||
"contextual.variables.unavailable.title": "Available on the Enterprise plan",
|
||||
"contextual.variables.unavailable.title.cloud": "Available on Pro plan",
|
||||
"contextual.variables.unavailable.title.desktop": "Upgrade to n8n Cloud to collaborate",
|
||||
"contextual.variables.unavailable.description": "Variables can be used to store and access data across workflows. Reference them in n8n using the prefix <code>$vars</code> (e.g. <code>$vars.myVariable</code>). Variables are immutable and cannot be modified within your workflows.<br/><a href=\"https://docs.n8n.io/environments/variables/\" target=\"_blank\">Learn more in the docs.</a>",
|
||||
"contextual.variables.unavailable.button": "View plans",
|
||||
"contextual.variables.unavailable.button.cloud": "Upgrade now",
|
||||
"contextual.variables.unavailable.button.desktop": "View plans",
|
||||
"contextual.users.settings.unavailable.title": "Upgrade to add users",
|
||||
"contextual.users.settings.unavailable.title.cloud": "Upgrade to add users",
|
||||
"contextual.users.settings.unavailable.title.desktop": "Upgrade to add users",
|
||||
"contextual.users.settings.unavailable.description": "Create multiple users on our higher plans and share workflows and credentials to collaborate",
|
||||
"contextual.users.settings.unavailable.description.cloud": "Create multiple users on our higher plans and share workflows and credentials to collaborate",
|
||||
"contextual.users.settings.unavailable.description.desktop": "Create multiple users on our higher plans and share workflows and credentials to collaborate",
|
||||
"contextual.users.settings.unavailable.button": "View plans",
|
||||
"contextual.users.settings.unavailable.button.cloud": "Upgrade now",
|
||||
"contextual.users.settings.unavailable.button.desktop": "View plans",
|
||||
"contextual.communityNodes.unavailable.description.desktop": "Community nodes feature is unavailable on desktop. Please choose one of our available self-hosting plans.",
|
||||
"contextual.communityNodes.unavailable.button.desktop": "View plans",
|
||||
"contextual.feature.unavailable.title": "Available on the Enterprise Plan",
|
||||
"contextual.feature.unavailable.title.cloud": "Available on the Pro Plan",
|
||||
"contextual.feature.unavailable.title.desktop": "Available on cloud hosting",
|
||||
"settings.ldap": "LDAP",
|
||||
"settings.ldap.note": "LDAP allows users to authenticate with their centralized account. It's compatible with services that provide an LDAP interface like Active Directory, Okta and Jumpcloud.",
|
||||
"settings.ldap.infoTip": "Learn more about <a href='https://docs.n8n.io/user-management/ldap/' target='_blank'>LDAP in the Docs</a>",
|
||||
|
|
|
@ -576,12 +576,8 @@ export const routes: RouteRecordRaw[] = [
|
|||
settingsView: SettingsSso,
|
||||
},
|
||||
meta: {
|
||||
middleware: ['authenticated', 'rbac', 'custom'],
|
||||
middleware: ['authenticated', 'rbac'],
|
||||
middlewareOptions: {
|
||||
custom: () => {
|
||||
const settingsStore = useSettingsStore();
|
||||
return !settingsStore.isDesktopDeployment;
|
||||
},
|
||||
rbac: {
|
||||
scope: 'saml:manage',
|
||||
},
|
||||
|
@ -693,11 +689,7 @@ export const routes: RouteRecordRaw[] = [
|
|||
custom: () => {
|
||||
const settingsStore = useSettingsStore();
|
||||
const ssoStore = useSSOStore();
|
||||
return (
|
||||
ssoStore.isEnterpriseSamlEnabled &&
|
||||
!settingsStore.isCloudDeployment &&
|
||||
!settingsStore.isDesktopDeployment
|
||||
);
|
||||
return ssoStore.isEnterpriseSamlEnabled && !settingsStore.isCloudDeployment;
|
||||
},
|
||||
},
|
||||
telemetry: {
|
||||
|
|
|
@ -92,10 +92,6 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, () => {
|
|||
|
||||
const deploymentType = computed(() => settings.value.deployment?.type || 'default');
|
||||
|
||||
const isDesktopDeployment = computed(() =>
|
||||
settings.value.deployment?.type.startsWith('desktop_'),
|
||||
);
|
||||
|
||||
const isCloudDeployment = computed(() => settings.value.deployment?.type === 'cloud');
|
||||
|
||||
const isSmtpSetup = computed(() => userManagement.value.smtpSetup);
|
||||
|
@ -395,7 +391,6 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, () => {
|
|||
isSamlLoginEnabled,
|
||||
showSetupPage,
|
||||
deploymentType,
|
||||
isDesktopDeployment,
|
||||
isCloudDeployment,
|
||||
isSmtpSetup,
|
||||
isPersonalizationSurveyEnabled,
|
||||
|
|
|
@ -224,11 +224,9 @@ export const useUIStore = defineStore(STORES.UI, () => {
|
|||
const contextBasedTranslationKeys = computed(() => {
|
||||
const deploymentType = settingsStore.deploymentType;
|
||||
|
||||
let contextKey: '' | '.cloud' | '.desktop' = '';
|
||||
let contextKey: '' | '.cloud' = '';
|
||||
if (deploymentType === 'cloud') {
|
||||
contextKey = '.cloud';
|
||||
} else if (deploymentType === 'desktop_mac' || deploymentType === 'desktop_win') {
|
||||
contextKey = '.desktop';
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -122,6 +122,5 @@ export const useUsageStore = defineStore('usage', () => {
|
|||
usage: executionCount.value,
|
||||
quota: executionLimit.value,
|
||||
})),
|
||||
isDesktop: computed(() => settingsStore.isDesktopDeployment),
|
||||
};
|
||||
});
|
||||
|
|
|
@ -41,10 +41,6 @@ const uiStore = useUIStore();
|
|||
const getEmptyStateDescription = computed(() => {
|
||||
const packageCount = communityNodesStore.availablePackageCount;
|
||||
|
||||
if (settingsStore.isDesktopDeployment) {
|
||||
return i18n.baseText('contextual.communityNodes.unavailable.description.desktop');
|
||||
}
|
||||
|
||||
return packageCount < PACKAGE_COUNT_THRESHOLD
|
||||
? i18n.baseText('settings.communityNodes.empty.description.no-packages', {
|
||||
interpolate: {
|
||||
|
@ -60,14 +56,10 @@ const getEmptyStateDescription = computed(() => {
|
|||
});
|
||||
|
||||
const shouldShowInstallButton = computed(() => {
|
||||
return settingsStore.isDesktopDeployment || settingsStore.isNpmAvailable;
|
||||
return settingsStore.isNpmAvailable;
|
||||
});
|
||||
|
||||
const getEmptyStateButtonText = computed(() => {
|
||||
if (settingsStore.isDesktopDeployment) {
|
||||
return i18n.baseText('contextual.communityNodes.unavailable.button.desktop');
|
||||
}
|
||||
|
||||
return shouldShowInstallButton.value
|
||||
? i18n.baseText('settings.communityNodes.empty.installPackageLabel')
|
||||
: '';
|
||||
|
@ -91,15 +83,7 @@ const actionBoxConfig = computed(() => {
|
|||
};
|
||||
});
|
||||
|
||||
const goToUpgrade = () => {
|
||||
void uiStore.goToUpgrade('community-nodes', 'upgrade-community-nodes');
|
||||
};
|
||||
|
||||
const onClickEmptyStateButton = () => {
|
||||
if (settingsStore.isDesktopDeployment) {
|
||||
return goToUpgrade();
|
||||
}
|
||||
|
||||
openInstallModal();
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import { useUsageStore } from '@/stores/usage.store';
|
|||
import { telemetry } from '@/plugins/telemetry';
|
||||
import { i18n as locale } from '@/plugins/i18n';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { N8N_PRICING_PAGE_URL } from '@/constants';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { hasPermission } from '@/utils/rbac/permissions';
|
||||
|
||||
|
@ -65,10 +64,6 @@ const onLicenseActivation = async () => {
|
|||
};
|
||||
|
||||
onMounted(async () => {
|
||||
if (usageStore.isDesktop) {
|
||||
return;
|
||||
}
|
||||
|
||||
usageStore.setLoading(true);
|
||||
if (route.query.key) {
|
||||
try {
|
||||
|
@ -123,25 +118,12 @@ const onDialogClosed = () => {
|
|||
const onDialogOpened = () => {
|
||||
activationKeyInput.value?.focus();
|
||||
};
|
||||
|
||||
const openPricingPage = () => {
|
||||
sendUsageTelemetry('desktop_view_plans');
|
||||
window.open(N8N_PRICING_PAGE_URL, '_blank');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="settings-usage-and-plan">
|
||||
<n8n-heading size="2xlarge">{{ locale.baseText('settings.usageAndPlan.title') }}</n8n-heading>
|
||||
<n8n-action-box
|
||||
v-if="usageStore.isDesktop"
|
||||
:class="$style.actionBox"
|
||||
:heading="locale.baseText('settings.usageAndPlan.desktop.title')"
|
||||
:description="locale.baseText('settings.usageAndPlan.desktop.description')"
|
||||
:button-text="locale.baseText('settings.usageAndPlan.button.plans')"
|
||||
@click:button="openPricingPage"
|
||||
/>
|
||||
<div v-if="!usageStore.isDesktop && !usageStore.isLoading">
|
||||
<div v-if="!usageStore.isLoading">
|
||||
<n8n-heading :class="$style.title" size="large">
|
||||
<i18n-t keypath="settings.usageAndPlan.description" tag="span">
|
||||
<template #name>{{ usageStore.planName }}</template>
|
||||
|
|
|
@ -43,18 +43,10 @@ const emailLabel = computed(() => {
|
|||
return label;
|
||||
});
|
||||
|
||||
const redirectLink = computed(() => {
|
||||
if (!settingsStore.isDesktopDeployment) {
|
||||
return '/forgot-password';
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
const formConfig: IFormBoxConfig = reactive({
|
||||
title: locale.baseText('auth.signin'),
|
||||
buttonText: locale.baseText('auth.signin'),
|
||||
redirectText: locale.baseText('forgotPassword'),
|
||||
redirectLink: redirectLink.value,
|
||||
inputs: [
|
||||
{
|
||||
name: 'email',
|
||||
|
|
Loading…
Reference in a new issue