refactor(editor): Apply Prettier (no-changelog) (#4920)
* ⚡ Adjust `format` script * 🔥 Remove exemption for `editor-ui` * 🎨 Prettify * 👕 Fix lint
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
import { createApiKey, deleteApiKey, getApiKey } from "@/api/api-keys";
|
||||
import { getPromptsData, getSettings, submitContactInfo, submitValueSurvey } from "@/api/settings";
|
||||
import { testHealthEndpoint } from "@/api/templates";
|
||||
import { CONTACT_PROMPT_MODAL_KEY, EnterpriseEditionFeature, STORES, VALUE_SURVEY_MODAL_KEY } from "@/constants";
|
||||
import { ILogLevel, IN8nPromptResponse, IN8nPrompts, IN8nUISettings, IN8nValueSurveyData, ISettingsState, WorkflowCallerPolicyDefaultOption } from "@/Interface";
|
||||
import { store } from "@/store";
|
||||
import { ITelemetrySettings } from "n8n-workflow";
|
||||
import { defineStore } from "pinia";
|
||||
import Vue from "vue";
|
||||
import { useRootStore } from "./n8nRootStore";
|
||||
import { useUIStore } from "./ui";
|
||||
import { useUsersStore } from "./users";
|
||||
import { useVersionsStore } from "./versions";
|
||||
import { createApiKey, deleteApiKey, getApiKey } from '@/api/api-keys';
|
||||
import { getPromptsData, getSettings, submitContactInfo, submitValueSurvey } from '@/api/settings';
|
||||
import { testHealthEndpoint } from '@/api/templates';
|
||||
import {
|
||||
CONTACT_PROMPT_MODAL_KEY,
|
||||
EnterpriseEditionFeature,
|
||||
STORES,
|
||||
VALUE_SURVEY_MODAL_KEY,
|
||||
} from '@/constants';
|
||||
import {
|
||||
ILogLevel,
|
||||
IN8nPromptResponse,
|
||||
IN8nPrompts,
|
||||
IN8nUISettings,
|
||||
IN8nValueSurveyData,
|
||||
ISettingsState,
|
||||
WorkflowCallerPolicyDefaultOption,
|
||||
} from '@/Interface';
|
||||
import { store } from '@/store';
|
||||
import { ITelemetrySettings } from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useUIStore } from './ui';
|
||||
import { useUsersStore } from './users';
|
||||
import { useVersionsStore } from './versions';
|
||||
|
||||
export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
state: (): ISettingsState => ({
|
||||
@@ -34,7 +47,7 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
}),
|
||||
getters: {
|
||||
isEnterpriseFeatureEnabled() {
|
||||
return (feature: EnterpriseEditionFeature) : boolean => this.settings.enterprise[feature];
|
||||
return (feature: EnterpriseEditionFeature): boolean => this.settings.enterprise[feature];
|
||||
},
|
||||
versionCli(): string {
|
||||
return this.settings.versionCli;
|
||||
@@ -51,58 +64,64 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
publicApiPath(): string {
|
||||
return this.api.path;
|
||||
},
|
||||
showSetupPage() : boolean {
|
||||
showSetupPage(): boolean {
|
||||
return this.userManagement.showSetupOnFirstLoad === true;
|
||||
},
|
||||
isDesktopDeployment() : boolean {
|
||||
isDesktopDeployment(): boolean {
|
||||
if (!this.settings.deployment) {
|
||||
return false;
|
||||
}
|
||||
return this.settings.deployment?.type.startsWith('desktop_');
|
||||
},
|
||||
isCloudDeployment() : boolean {
|
||||
isCloudDeployment(): boolean {
|
||||
if (!this.settings.deployment) {
|
||||
return false;
|
||||
}
|
||||
return this.settings.deployment.type === 'cloud';
|
||||
},
|
||||
isSmtpSetup() : boolean {
|
||||
isSmtpSetup(): boolean {
|
||||
return this.userManagement.smtpSetup;
|
||||
},
|
||||
isPersonalizationSurveyEnabled() : boolean {
|
||||
return (this.settings.telemetry && this.settings.telemetry.enabled) && this.settings.personalizationSurveyEnabled;
|
||||
isPersonalizationSurveyEnabled(): boolean {
|
||||
return (
|
||||
this.settings.telemetry &&
|
||||
this.settings.telemetry.enabled &&
|
||||
this.settings.personalizationSurveyEnabled
|
||||
);
|
||||
},
|
||||
telemetry() : ITelemetrySettings {
|
||||
telemetry(): ITelemetrySettings {
|
||||
return this.settings.telemetry;
|
||||
},
|
||||
logLevel() : ILogLevel {
|
||||
logLevel(): ILogLevel {
|
||||
return this.settings.logLevel;
|
||||
},
|
||||
isTelemetryEnabled() : boolean {
|
||||
isTelemetryEnabled(): boolean {
|
||||
return this.settings.telemetry && this.settings.telemetry.enabled;
|
||||
},
|
||||
areTagsEnabled() : boolean {
|
||||
return this.settings.workflowTagsDisabled !== undefined ? !this.settings.workflowTagsDisabled : true;
|
||||
areTagsEnabled(): boolean {
|
||||
return this.settings.workflowTagsDisabled !== undefined
|
||||
? !this.settings.workflowTagsDisabled
|
||||
: true;
|
||||
},
|
||||
isHiringBannerEnabled() : boolean {
|
||||
isHiringBannerEnabled(): boolean {
|
||||
return this.settings.hiringBannerEnabled;
|
||||
},
|
||||
isTemplatesEnabled(): boolean {
|
||||
return Boolean(this.settings.templates && this.settings.templates.enabled);
|
||||
},
|
||||
isTemplatesEndpointReachable() : boolean {
|
||||
isTemplatesEndpointReachable(): boolean {
|
||||
return this.templatesEndpointHealthy;
|
||||
},
|
||||
templatesHost() : string {
|
||||
templatesHost(): string {
|
||||
return this.settings.templates.host;
|
||||
},
|
||||
isCommunityNodesFeatureEnabled() : boolean {
|
||||
isCommunityNodesFeatureEnabled(): boolean {
|
||||
return this.settings.communityNodesEnabled;
|
||||
},
|
||||
isNpmAvailable() : boolean {
|
||||
isNpmAvailable(): boolean {
|
||||
return this.settings.isNpmAvailable;
|
||||
},
|
||||
allowedModules() : { builtIn?: string[]; external?: string[] } {
|
||||
allowedModules(): { builtIn?: string[]; external?: string[] } {
|
||||
return this.settings.allowedModules;
|
||||
},
|
||||
isQueueModeEnabled(): boolean {
|
||||
@@ -117,8 +136,7 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
},
|
||||
actions: {
|
||||
setSettings(settings: IN8nUISettings): void {
|
||||
|
||||
this.settings = settings;
|
||||
this.settings = settings;
|
||||
this.userManagement.enabled = settings.userManagement.enabled;
|
||||
this.userManagement.showSetupOnFirstLoad = !!settings.userManagement.showSetupOnFirstLoad;
|
||||
this.userManagement.smtpSetup = settings.userManagement.smtpSetup;
|
||||
@@ -133,7 +151,7 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
|
||||
this.setSettings(settings);
|
||||
this.settings.communityNodesEnabled = settings.communityNodesEnabled;
|
||||
this.setAllowedModules(settings.allowedModules as { builtIn?: string, external?: string });
|
||||
this.setAllowedModules(settings.allowedModules as { builtIn?: string; external?: string });
|
||||
this.setSaveDataErrorExecution(settings.saveDataErrorExecution);
|
||||
this.setSaveDataSuccessExecution(settings.saveDataSuccessExecution);
|
||||
this.setSaveManualExecutions(settings.saveManualExecutions);
|
||||
@@ -155,12 +173,11 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
},
|
||||
stopShowingSetupPage(): void {
|
||||
Vue.set(this.userManagement, 'showSetupOnFirstLoad', false);
|
||||
|
||||
},
|
||||
setPromptsData(promptsData: IN8nPrompts): void {
|
||||
Vue.set(this, 'promptsData', promptsData);
|
||||
},
|
||||
setAllowedModules(allowedModules: { builtIn?: string, external?: string }): void {
|
||||
setAllowedModules(allowedModules: { builtIn?: string; external?: string }): void {
|
||||
this.settings.allowedModules = {
|
||||
...(allowedModules.builtIn && { builtIn: allowedModules.builtIn.split(',') }),
|
||||
...(allowedModules.external && { external: allowedModules.external.split(',') }),
|
||||
@@ -173,11 +190,14 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
try {
|
||||
const uiStore = useUIStore();
|
||||
const usersStore = useUsersStore();
|
||||
const promptsData: IN8nPrompts = await getPromptsData(this.settings.instanceId, usersStore.currentUserId || '');
|
||||
const promptsData: IN8nPrompts = await getPromptsData(
|
||||
this.settings.instanceId,
|
||||
usersStore.currentUserId || '',
|
||||
);
|
||||
|
||||
if (promptsData && promptsData.showContactPrompt) {
|
||||
uiStore.openModal(CONTACT_PROMPT_MODAL_KEY);
|
||||
} else if (promptsData && promptsData.showValueSurvey) {
|
||||
} else if (promptsData && promptsData.showValueSurvey) {
|
||||
uiStore.openModal(VALUE_SURVEY_MODAL_KEY);
|
||||
}
|
||||
|
||||
@@ -190,7 +210,11 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
async submitContactInfo(email: string): Promise<IN8nPromptResponse | undefined> {
|
||||
try {
|
||||
const usersStore = useUsersStore();
|
||||
return await submitContactInfo(this.settings.instanceId, usersStore.currentUserId || '', email);
|
||||
return await submitContactInfo(
|
||||
this.settings.instanceId,
|
||||
usersStore.currentUserId || '',
|
||||
email,
|
||||
);
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
@@ -198,7 +222,11 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
async submitValueSurvey(params: IN8nValueSurveyData): Promise<IN8nPromptResponse | undefined> {
|
||||
try {
|
||||
const usersStore = useUsersStore();
|
||||
return await submitValueSurvey(this.settings.instanceId, usersStore.currentUserId || '', params);
|
||||
return await submitValueSurvey(
|
||||
this.settings.instanceId,
|
||||
usersStore.currentUserId || '',
|
||||
params,
|
||||
);
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user