refactor(editor): Delete unused code (no-changelog) (#9866)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-06-26 11:45:41 +02:00
committed by GitHub
parent 405e8746c9
commit 803895360c
35 changed files with 16 additions and 258 deletions

View File

@@ -18,10 +18,7 @@
}, },
"lib": ["esnext", "dom", "dom.iterable", "scripthost"], "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
// TODO: remove all options below this line // TODO: remove all options below this line
"noUnusedLocals": false,
"useUnknownInCatchVariables": false "useUnknownInCatchVariables": false
}, },
"include": ["src/**/*.ts", "src/**/*.vue", "**/*.d.ts"] "include": ["src/**/*.ts", "src/**/*.vue", "**/*.d.ts"]
} }

View File

@@ -2,9 +2,6 @@ import { setActivePinia } from 'pinia';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
import CredentialCard from '@/components/CredentialCard.vue'; import CredentialCard from '@/components/CredentialCard.vue';
import { useUIStore } from '@/stores/ui.store';
import { useUsersStore } from '@/stores/users.store';
import { useCredentialsStore } from '@/stores/credentials.store';
import type { ICredentialsResponse } from '@/Interface'; import type { ICredentialsResponse } from '@/Interface';
import type { ProjectSharingData } from '@/types/projects.types'; import type { ProjectSharingData } from '@/types/projects.types';
@@ -22,16 +19,9 @@ const createCredential = (overrides = {}): ICredentialsResponse => ({
}); });
describe('CredentialCard', () => { describe('CredentialCard', () => {
let uiStore: ReturnType<typeof useUIStore>;
let usersStore: ReturnType<typeof useUsersStore>;
let credentialsStore: ReturnType<typeof useCredentialsStore>;
beforeEach(() => { beforeEach(() => {
const pinia = createTestingPinia(); const pinia = createTestingPinia();
setActivePinia(pinia); setActivePinia(pinia);
uiStore = useUIStore();
usersStore = useUsersStore();
credentialsStore = useCredentialsStore();
}); });
it('should render name and home project name', () => { it('should render name and home project name', () => {

View File

@@ -3,7 +3,6 @@ import type { ExternalSecretsProvider } from '@/Interface';
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store'; import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
import { useToast } from '@/composables/useToast'; import { useToast } from '@/composables/useToast';
import { useI18n } from '@/composables/useI18n'; import { useI18n } from '@/composables/useI18n';
import { useLoadingService } from '@/composables/useLoadingService';
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import type { EventBus } from 'n8n-design-system/utils'; import type { EventBus } from 'n8n-design-system/utils';
@@ -25,7 +24,6 @@ const props = withDefaults(
}, },
); );
const loadingService = useLoadingService();
const externalSecretsStore = useExternalSecretsStore(); const externalSecretsStore = useExternalSecretsStore();
const i18n = useI18n(); const i18n = useI18n();
const toast = useToast(); const toast = useToast();

View File

@@ -8,7 +8,6 @@ import { useI18n } from '@/composables/useI18n';
import { useMessage } from '@/composables/useMessage'; import { useMessage } from '@/composables/useMessage';
import { useToast } from '@/composables/useToast'; import { useToast } from '@/composables/useToast';
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store'; import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
import { useUIStore } from '@/stores/ui.store';
import ParameterInputExpanded from '@/components/ParameterInputExpanded.vue'; import ParameterInputExpanded from '@/components/ParameterInputExpanded.vue';
import type { import type {
IUpdateInformation, IUpdateInformation,
@@ -31,7 +30,6 @@ const defaultProviderData: Record<string, Partial<ExternalSecretsProviderData>>
}; };
const externalSecretsStore = useExternalSecretsStore(); const externalSecretsStore = useExternalSecretsStore();
const uiStore = useUIStore();
const toast = useToast(); const toast = useToast();
const i18n = useI18n(); const i18n = useI18n();
const { confirm } = useMessage(); const { confirm } = useMessage();
@@ -99,10 +97,6 @@ onMounted(async () => {
} }
}); });
function close() {
uiStore.closeModal(EXTERNAL_SECRETS_PROVIDER_MODAL_KEY);
}
function onValueChange(updateInformation: IUpdateInformation) { function onValueChange(updateInformation: IUpdateInformation) {
providerData.value = { providerData.value = {
...providerData.value, ...providerData.value,

View File

@@ -20,7 +20,7 @@
/> />
<div v-if="multipleValues"> <div v-if="multipleValues">
<div <div
v-for="(value, index) in mutableValues[property.name]" v-for="(_, index) in mutableValues[property.name]"
:key="property.name + index" :key="property.name + index"
class="parameter-item" class="parameter-item"
> >

View File

@@ -1,6 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, nextTick, ref } from 'vue'; import { computed, nextTick, ref } from 'vue';
import { useRouter } from 'vue-router';
import { createEventBus } from 'n8n-design-system/utils'; import { createEventBus } from 'n8n-design-system/utils';
import { useI18n } from '@/composables/useI18n'; import { useI18n } from '@/composables/useI18n';
import { hasPermission } from '@/utils/rbac/permissions'; import { hasPermission } from '@/utils/rbac/permissions';
@@ -8,11 +7,11 @@ import { useToast } from '@/composables/useToast';
import { useLoadingService } from '@/composables/useLoadingService'; import { useLoadingService } from '@/composables/useLoadingService';
import { useUIStore } from '@/stores/ui.store'; import { useUIStore } from '@/stores/ui.store';
import { useSourceControlStore } from '@/stores/sourceControl.store'; import { useSourceControlStore } from '@/stores/sourceControl.store';
import { SOURCE_CONTROL_PULL_MODAL_KEY, SOURCE_CONTROL_PUSH_MODAL_KEY, VIEWS } from '@/constants'; import { SOURCE_CONTROL_PULL_MODAL_KEY, SOURCE_CONTROL_PUSH_MODAL_KEY } from '@/constants';
import type { SourceControlAggregatedFile } from '../Interface'; import type { SourceControlAggregatedFile } from '../Interface';
import { sourceControlEventBus } from '@/event-bus/source-control'; import { sourceControlEventBus } from '@/event-bus/source-control';
const props = defineProps<{ defineProps<{
isCollapsed: boolean; isCollapsed: boolean;
}>(); }>();
@@ -20,7 +19,6 @@ const responseStatuses = {
CONFLICT: 409, CONFLICT: 409,
}; };
const router = useRouter();
const loadingService = useLoadingService(); const loadingService = useLoadingService();
const uiStore = useUIStore(); const uiStore = useUIStore();
const sourceControlStore = useSourceControlStore(); const sourceControlStore = useSourceControlStore();
@@ -117,10 +115,6 @@ async function pullWorkfolder() {
loadingService.setLoadingText(i18n.baseText('genericHelpers.loading')); loadingService.setLoadingText(i18n.baseText('genericHelpers.loading'));
} }
} }
const goToSourceControlSetup = async () => {
await router.push({ name: VIEWS.SOURCE_CONTROL });
};
</script> </script>
<template> <template>

View File

@@ -41,7 +41,6 @@ const uiStore = useUIStore();
const rootStore = useRootStore(); const rootStore = useRootStore();
const { mergedNodes, actions } = useNodeCreatorStore(); const { mergedNodes, actions } = useNodeCreatorStore();
const { baseUrl } = useRootStore();
const { pushViewStack, popViewStack } = useViewStacks(); const { pushViewStack, popViewStack } = useViewStacks();
const { registerKeyHook } = useKeyboardNavigation(); const { registerKeyHook } = useKeyboardNavigation();

View File

@@ -104,7 +104,7 @@ describe('NodesListPanel', () => {
}, },
}, },
setup(props) { setup(props) {
const { setActions, setMergeNodes, setSelectedView } = useNodeCreatorStore(); const { setMergeNodes, setSelectedView } = useNodeCreatorStore();
watch( watch(
() => props.nodeTypes, () => props.nodeTypes,

View File

@@ -180,7 +180,6 @@ import { storeToRefs } from 'pinia';
const emit = defineEmits([ const emit = defineEmits([
'saveKeyboardShortcut', 'saveKeyboardShortcut',
'valueChanged', 'valueChanged',
'nodeTypeSelected',
'switchSelectedNode', 'switchSelectedNode',
'openConnectionNodeCreator', 'openConnectionNodeCreator',
'redrawNode', 'redrawNode',
@@ -419,8 +418,6 @@ const canLinkRuns = computed(
const linked = computed(() => isLinkingEnabled.value && canLinkRuns.value); const linked = computed(() => isLinkingEnabled.value && canLinkRuns.value);
const inputPanelMargin = computed(() => (isTriggerNode.value ? 0 : 80));
const featureRequestUrl = computed(() => { const featureRequestUrl = computed(() => {
if (!activeNodeType.value) { if (!activeNodeType.value) {
return ''; return '';
@@ -595,10 +592,6 @@ const valueChanged = (parameterData: IUpdateInformation) => {
emit('valueChanged', parameterData); emit('valueChanged', parameterData);
}; };
const nodeTypeSelected = (nodeTypeName: string) => {
emit('nodeTypeSelected', nodeTypeName);
};
const onSwitchSelectedNode = (nodeTypeName: string) => { const onSwitchSelectedNode = (nodeTypeName: string) => {
emit('switchSelectedNode', nodeTypeName); emit('switchSelectedNode', nodeTypeName);
}; };

View File

@@ -492,10 +492,6 @@ function onButtonAction(parameter: INodeProperties) {
} }
} }
function isNodeAuthField(name: string): boolean {
return nodeAuthFields.value.find((field) => field.name === name) !== undefined;
}
function shouldHideAuthRelatedParameter(parameter: INodeProperties): boolean { function shouldHideAuthRelatedParameter(parameter: INodeProperties): boolean {
// TODO: For now, hide all fields that are used in authentication fields displayOptions // TODO: For now, hide all fields that are used in authentication fields displayOptions
// Ideally, we should check if any non-auth field depends on it before hiding it but // Ideally, we should check if any non-auth field depends on it before hiding it but

View File

@@ -3,7 +3,7 @@ import { createPinia, setActivePinia } from 'pinia';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
import { getDropdownItems } from '@/__tests__/utils'; import { getDropdownItems } from '@/__tests__/utils';
import { useRoute, useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import ProjectSettings from '@/components/Projects/ProjectSettings.vue'; import ProjectSettings from '@/components/Projects/ProjectSettings.vue';
import { useProjectsStore } from '@/stores/projects.store'; import { useProjectsStore } from '@/stores/projects.store';
import { VIEWS } from '@/constants'; import { VIEWS } from '@/constants';
@@ -31,7 +31,6 @@ const renderComponent = createComponentRenderer(ProjectSettings);
const teamProjects = Array.from({ length: 3 }, () => createProjectListItem('team')); const teamProjects = Array.from({ length: 3 }, () => createProjectListItem('team'));
let router: ReturnType<typeof useRouter>; let router: ReturnType<typeof useRouter>;
let route: ReturnType<typeof useRoute>;
let projectsStore: ReturnType<typeof useProjectsStore>; let projectsStore: ReturnType<typeof useProjectsStore>;
let usersStore: ReturnType<typeof useUsersStore>; let usersStore: ReturnType<typeof useUsersStore>;
let settingsStore: ReturnType<typeof useSettingsStore>; let settingsStore: ReturnType<typeof useSettingsStore>;
@@ -40,7 +39,6 @@ describe('ProjectSettings', () => {
beforeEach(() => { beforeEach(() => {
const pinia = createPinia(); const pinia = createPinia();
setActivePinia(pinia); setActivePinia(pinia);
route = useRoute();
router = useRouter(); router = useRouter();
projectsStore = useProjectsStore(); projectsStore = useProjectsStore();
usersStore = useUsersStore(); usersStore = useUsersStore();

View File

@@ -1,6 +1,6 @@
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
import ProjectTabs from '@/components/Projects/ProjectTabs.vue'; import ProjectTabs from '@/components/Projects/ProjectTabs.vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { createTestProject } from '@/__tests__/data/projects'; import { createTestProject } from '@/__tests__/data/projects';
import { useProjectsStore } from '@/stores/projects.store'; import { useProjectsStore } from '@/stores/projects.store';
@@ -34,15 +34,11 @@ vi.mock('@/utils/rbac/permissions', () => ({
const renderComponent = createComponentRenderer(ProjectTabs); const renderComponent = createComponentRenderer(ProjectTabs);
let router: ReturnType<typeof useRouter>;
let route: ReturnType<typeof useRoute>; let route: ReturnType<typeof useRoute>;
let projectsStore: ReturnType<typeof useProjectsStore>;
describe('ProjectTabs', () => { describe('ProjectTabs', () => {
beforeEach(() => { beforeEach(() => {
route = useRoute(); route = useRoute();
router = useRouter();
projectsStore = useProjectsStore();
}); });
it('should render home tabs', async () => { it('should render home tabs', async () => {

View File

@@ -6,7 +6,7 @@
<th :class="$style.tableRightMargin"></th> <th :class="$style.tableRightMargin"></th>
</tr> </tr>
<tr <tr
v-for="(row, index1) in tableData.data" v-for="(_, index1) in tableData.data"
:key="index1" :key="index1"
:class="{ [$style.hoveringRow]: isHoveringRow(index1) }" :class="{ [$style.hoveringRow]: isHoveringRow(index1) }"
> >

View File

@@ -5,10 +5,6 @@ import userEvent from '@testing-library/user-event';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
import { VIEWS } from '@/constants'; import { VIEWS } from '@/constants';
import WorkflowCard from '@/components/WorkflowCard.vue'; import WorkflowCard from '@/components/WorkflowCard.vue';
import { useUIStore } from '@/stores/ui.store';
import { useSettingsStore } from '@/stores/settings.store';
import { useUsersStore } from '@/stores/users.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import type { IWorkflowDb } from '@/Interface'; import type { IWorkflowDb } from '@/Interface';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@@ -42,19 +38,11 @@ const createWorkflow = (overrides = {}): IWorkflowDb => ({
describe('WorkflowCard', () => { describe('WorkflowCard', () => {
let pinia: ReturnType<typeof createPinia>; let pinia: ReturnType<typeof createPinia>;
let windowOpenSpy: MockInstance; let windowOpenSpy: MockInstance;
let uiStore: ReturnType<typeof useUIStore>;
let settingsStore: ReturnType<typeof useSettingsStore>;
let usersStore: ReturnType<typeof useUsersStore>;
let workflowsStore: ReturnType<typeof useWorkflowsStore>;
let router: ReturnType<typeof useRouter>; let router: ReturnType<typeof useRouter>;
beforeEach(async () => { beforeEach(async () => {
pinia = createPinia(); pinia = createPinia();
setActivePinia(pinia); setActivePinia(pinia);
uiStore = useUIStore();
settingsStore = useSettingsStore();
usersStore = useUsersStore();
workflowsStore = useWorkflowsStore();
router = useRouter(); router = useRouter();
windowOpenSpy = vi.spyOn(window, 'open'); windowOpenSpy = vi.spyOn(window, 'open');
}); });

View File

@@ -2,7 +2,6 @@ import { merge } from 'lodash-es';
import { SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils'; import { SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils';
import { ROLE, STORES } from '@/constants'; import { ROLE, STORES } from '@/constants';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';
import { useUIStore } from '@/stores/ui.store';
import CollaborationPane from '@/components//MainHeader/CollaborationPane.vue'; import CollaborationPane from '@/components//MainHeader/CollaborationPane.vue';
import type { RenderOptions } from '@/__tests__/render'; import type { RenderOptions } from '@/__tests__/render';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
@@ -43,8 +42,6 @@ const MEMBER_USER_2 = {
fullName: 'Another Member User', fullName: 'Another Member User',
}; };
let uiStore: ReturnType<typeof useUIStore>;
const initialState = { const initialState = {
[STORES.SETTINGS]: { [STORES.SETTINGS]: {
settings: merge({}, SETTINGS_STORE_DEFAULT_STATE.settings), settings: merge({}, SETTINGS_STORE_DEFAULT_STATE.settings),
@@ -80,10 +77,6 @@ const defaultRenderOptions: RenderOptions = {
const renderComponent = createComponentRenderer(CollaborationPane, defaultRenderOptions); const renderComponent = createComponentRenderer(CollaborationPane, defaultRenderOptions);
describe('CollaborationPane', () => { describe('CollaborationPane', () => {
beforeEach(() => {
uiStore = useUIStore();
});
afterEach(() => { afterEach(() => {
vi.clearAllMocks(); vi.clearAllMocks();
}); });

View File

@@ -35,7 +35,7 @@ describe('BannerStack', () => {
}); });
it('should render redacted version', async () => { it('should render redacted version', async () => {
const { container, getByTestId } = renderComponent( const { getByTestId } = renderComponent(
merge(DEFAULT_SETUP, { merge(DEFAULT_SETUP, {
props: { props: {
redactValue: true, redactValue: true,

View File

@@ -91,7 +91,7 @@ describe('MainSidebarSourceControl', () => {
}); });
const openModalSpy = vi.spyOn(uiStore, 'openModalWithData'); const openModalSpy = vi.spyOn(uiStore, 'openModalWithData');
const { getAllByRole, getByRole } = renderComponent({ const { getAllByRole } = renderComponent({
pinia, pinia,
props: { isCollapsed: false }, props: { isCollapsed: false },
}); });

View File

@@ -53,7 +53,7 @@ describe('TemplatesInfoCard', () => {
}); });
it('should render component properly', () => { it('should render component properly', () => {
const { getByText, container, debug } = renderComponent({ const { getByText, container } = renderComponent({
pinia, pinia,
props: { props: {
collection: TEST_COLLECTION, collection: TEST_COLLECTION,

View File

@@ -78,7 +78,7 @@ describe('CanvasNode', () => {
describe('toolbar', () => { describe('toolbar', () => {
it('should render toolbar when node is hovered', async () => { it('should render toolbar when node is hovered', async () => {
const { getByTestId, container } = renderComponent({ const { getByTestId } = renderComponent({
props: { props: {
...createCanvasNodeProps(), ...createCanvasNodeProps(),
}, },

View File

@@ -94,7 +94,7 @@ describe('ExecutionsFilter', () => {
])( ])(
'renders in %s environment on %s deployment with advancedExecutionFilters %s', 'renders in %s environment on %s deployment with advancedExecutionFilters %s',
async (environment, deployment, advancedExecutionFilters, workflows) => { async (environment, deployment, advancedExecutionFilters, workflows) => {
const { html, getByTestId, queryByTestId, queryAllByTestId } = renderComponent({ const { getByTestId, queryByTestId } = renderComponent({
props: { workflows }, props: { workflows },
pinia: createTestingPinia({ pinia: createTestingPinia({
initialState: merge(initialState, { initialState: merge(initialState, {

View File

@@ -5,7 +5,6 @@ import userEvent from '@testing-library/user-event';
import { faker } from '@faker-js/faker'; import { faker } from '@faker-js/faker';
import { STORES, VIEWS } from '@/constants'; import { STORES, VIEWS } from '@/constants';
import ExecutionsList from '@/components/executions/global/GlobalExecutionsList.vue'; import ExecutionsList from '@/components/executions/global/GlobalExecutionsList.vue';
import type { IWorkflowDb } from '@/Interface';
import { randomInt, type ExecutionSummary } from 'n8n-workflow'; import { randomInt, type ExecutionSummary } from 'n8n-workflow';
import { retry, SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils'; import { retry, SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
@@ -36,18 +35,6 @@ const generateUndefinedNullOrString = () => {
} }
}; };
const workflowDataFactory = (): IWorkflowDb => ({
createdAt: faker.date.past().toDateString(),
updatedAt: faker.date.past().toDateString(),
id: faker.string.uuid(),
name: faker.string.sample(),
active: faker.datatype.boolean(),
tags: [],
nodes: [],
connections: {},
versionId: faker.number.int().toString(),
});
const executionDataFactory = (): ExecutionSummary => ({ const executionDataFactory = (): ExecutionSummary => ({
id: faker.string.uuid(), id: faker.string.uuid(),
finished: faker.datatype.boolean(), finished: faker.datatype.boolean(),
@@ -62,8 +49,6 @@ const executionDataFactory = (): ExecutionSummary => ({
retrySuccessId: generateUndefinedNullOrString(), retrySuccessId: generateUndefinedNullOrString(),
}); });
const generateWorkflowsData = () => Array.from({ length: 10 }, workflowDataFactory);
const generateExecutionsData = () => const generateExecutionsData = () =>
Array.from({ length: 2 }, () => ({ Array.from({ length: 2 }, () => ({
count: 20, count: 20,

View File

@@ -58,7 +58,6 @@ vi.mock('@/composables/useToast', () => ({
vi.mock('@/composables/useWorkflowHelpers', () => ({ vi.mock('@/composables/useWorkflowHelpers', () => ({
useWorkflowHelpers: vi.fn().mockReturnValue({ useWorkflowHelpers: vi.fn().mockReturnValue({
getCurrentWorkflow: vi.fn(), getCurrentWorkflow: vi.fn(),
checkReadyForExecution: vi.fn(),
saveCurrentWorkflow: vi.fn(), saveCurrentWorkflow: vi.fn(),
getWorkflowDataToSave: vi.fn(), getWorkflowDataToSave: vi.fn(),
}), }),

View File

@@ -880,9 +880,7 @@ export function useCanvasOperations({
editableWorkflow, editableWorkflow,
editableWorkflowObject, editableWorkflowObject,
triggerNodes, triggerNodes,
lastClickPosition,
initializeNodeDataWithDefaultCredentials, initializeNodeDataWithDefaultCredentials,
createNode,
addNodes, addNodes,
updateNodePosition, updateNodePosition,
setNodeActive, setNodeActive,
@@ -892,11 +890,9 @@ export function useCanvasOperations({
revertRenameNode, revertRenameNode,
deleteNode, deleteNode,
revertDeleteNode, revertDeleteNode,
trackDeleteNode,
addConnections, addConnections,
createConnection, createConnection,
deleteConnection, deleteConnection,
revertDeleteConnection, revertDeleteConnection,
isConnectionAllowed,
}; };
} }

View File

@@ -660,11 +660,7 @@ export function useNodeBase({
getSpacerIndexes, getSpacerIndexes,
addInputEndpoints, addInputEndpoints,
addOutputEndpoints, addOutputEndpoints,
addEndpointTestingData,
addNode, addNode,
getEndpointColor,
getInputConnectionStyle,
getOutputConnectionStyle,
mouseLeftClick, mouseLeftClick,
touchEnd, touchEnd,
inputs, inputs,

View File

@@ -1226,7 +1226,6 @@ export function useNodeHelpers() {
getParameterValue, getParameterValue,
displayParameter, displayParameter,
getNodeIssues, getNodeIssues,
refreshNodeIssues,
updateNodesInputIssues, updateNodesInputIssues,
updateNodesExecutionIssues, updateNodesExecutionIssues,
updateNodeCredentialIssuesByName, updateNodeCredentialIssuesByName,

View File

@@ -627,7 +627,6 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
queuePushMessage, queuePushMessage,
processWaitingPushMessages, processWaitingPushMessages,
pushMessageQueue, pushMessageQueue,
removeEventListener,
retryTimeout, retryTimeout,
}; };
} }

View File

@@ -4,7 +4,6 @@ import {
PLACEHOLDER_EMPTY_WORKFLOW_ID, PLACEHOLDER_EMPTY_WORKFLOW_ID,
PLACEHOLDER_FILLED_AT_EXECUTION_TIME, PLACEHOLDER_FILLED_AT_EXECUTION_TIME,
VIEWS, VIEWS,
WEBHOOK_NODE_TYPE,
} from '@/constants'; } from '@/constants';
import type { import type {
@@ -15,15 +14,12 @@ import type {
INodeConnection, INodeConnection,
INodeCredentials, INodeCredentials,
INodeExecutionData, INodeExecutionData,
INodeIssues,
INodeParameters, INodeParameters,
INodeProperties, INodeProperties,
INodeType,
INodeTypes, INodeTypes,
IRunExecutionData, IRunExecutionData,
IWebhookDescription, IWebhookDescription,
IWorkflowDataProxyAdditionalKeys, IWorkflowDataProxyAdditionalKeys,
IWorkflowIssues,
IWorkflowSettings, IWorkflowSettings,
NodeParameterValue, NodeParameterValue,
Workflow, Workflow,
@@ -47,7 +43,7 @@ import { useMessage } from '@/composables/useMessage';
import { useToast } from '@/composables/useToast'; import { useToast } from '@/composables/useToast';
import { useNodeHelpers } from '@/composables/useNodeHelpers'; import { useNodeHelpers } from '@/composables/useNodeHelpers';
import { get, isEqual } from 'lodash-es'; import { get } from 'lodash-es';
import { useEnvironmentsStore } from '@/stores/environments.ee.store'; import { useEnvironmentsStore } from '@/stores/environments.ee.store';
import { useRootStore } from '@/stores/root.store'; import { useRootStore } from '@/stores/root.store';
@@ -303,10 +299,6 @@ function getConnectedNodes(
return [...new Set(connectedNodes)]; return [...new Set(connectedNodes)];
} }
function getNodes(): INodeUi[] {
return useWorkflowsStore().getNodes();
}
// Returns a workflow instance. // Returns a workflow instance.
function getWorkflow(nodes: INodeUi[], connections: IConnections, copyData?: boolean): Workflow { function getWorkflow(nodes: INodeUi[], connections: IConnections, copyData?: boolean): Workflow {
return useWorkflowsStore().getWorkflow(nodes, connections, copyData); return useWorkflowsStore().getWorkflow(nodes, connections, copyData);
@@ -531,81 +523,6 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
return count; return count;
} }
/** Checks if everything in the workflow is complete and ready to be executed */
function checkReadyForExecution(workflow: Workflow, lastNodeName?: string) {
let node: INode;
let nodeType: INodeType | undefined;
let nodeIssues: INodeIssues | null = null;
const workflowIssues: IWorkflowIssues = {};
let checkNodes = Object.keys(workflow.nodes);
if (lastNodeName) {
checkNodes = workflow.getParentNodes(lastNodeName);
checkNodes.push(lastNodeName);
} else {
// As webhook nodes always take precedence check first
// if there are any
let checkWebhook: string[] = [];
for (const nodeName of Object.keys(workflow.nodes)) {
if (
workflow.nodes[nodeName].disabled !== true &&
workflow.nodes[nodeName].type === WEBHOOK_NODE_TYPE
) {
const childNodes = workflow.getChildNodes(nodeName);
checkWebhook = [nodeName, ...checkWebhook, ...childNodes];
}
}
if (checkWebhook.length) {
checkNodes = checkWebhook;
} else {
// If no webhook nodes got found try to find another trigger node
const startNode = workflow.getStartNode();
if (startNode !== undefined) {
checkNodes = [...workflow.getChildNodes(startNode.name), startNode.name];
// For the short-listed checkNodes, we also need to check them for any
// connected sub-nodes
for (const nodeName of checkNodes) {
const childNodes = workflow.getParentNodes(nodeName, 'ALL_NON_MAIN');
checkNodes.push(...childNodes);
}
}
}
}
for (const nodeName of checkNodes) {
nodeIssues = null;
node = workflow.nodes[nodeName];
if (node.disabled === true) {
// Ignore issues on disabled nodes
continue;
}
nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
if (nodeType === undefined) {
// Node type is not known
nodeIssues = {
typeUnknown: true,
};
} else {
nodeIssues = nodeHelpers.getNodeIssues(nodeType.description, node, workflow, ['execution']);
}
if (nodeIssues !== null) {
workflowIssues[node.name] = nodeIssues;
}
}
if (Object.keys(workflowIssues).length === 0) {
return null;
}
return workflowIssues;
}
async function getWorkflowDataToSave() { async function getWorkflowDataToSave() {
const workflowNodes = workflowsStore.allNodes; const workflowNodes = workflowsStore.allNodes;
const workflowConnections = workflowsStore.allConnections; const workflowConnections = workflowsStore.allConnections;
@@ -1123,30 +1040,6 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
} }
} }
async function dataHasChanged(id: string) {
const currentData = await getWorkflowDataToSave();
const data: IWorkflowDb = await workflowsStore.fetchWorkflow(id);
if (data !== undefined) {
const x = {
nodes: data.nodes,
connections: data.connections,
settings: data.settings,
name: data.name,
};
const y = {
nodes: currentData.nodes,
connections: currentData.connections,
settings: currentData.settings,
name: currentData.name,
};
return !isEqual(x, y);
}
return true;
}
function removeForeignCredentialsFromWorkflow( function removeForeignCredentialsFromWorkflow(
workflow: IWorkflowData | IWorkflowDataUpdate, workflow: IWorkflowData | IWorkflowDataUpdate,
usableCredentials: ICredentialsResponse[], usableCredentials: ICredentialsResponse[],
@@ -1215,14 +1108,12 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
resolveRequiredParameters, resolveRequiredParameters,
getCurrentWorkflow, getCurrentWorkflow,
getConnectedNodes, getConnectedNodes,
getNodes,
getWorkflow, getWorkflow,
getNodeTypes, getNodeTypes,
connectionInputData, connectionInputData,
executeData, executeData,
getNodeTypesMaxCount, getNodeTypesMaxCount,
getNodeTypeCount, getNodeTypeCount,
checkReadyForExecution,
getWorkflowDataToSave, getWorkflowDataToSave,
getNodeDataToSave, getNodeDataToSave,
getWebhookExpressionValue, getWebhookExpressionValue,
@@ -1232,7 +1123,6 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
saveCurrentWorkflow, saveCurrentWorkflow,
saveAsNewWorkflow, saveAsNewWorkflow,
updateNodePositions, updateNodePositions,
dataHasChanged,
removeForeignCredentialsFromWorkflow, removeForeignCredentialsFromWorkflow,
getWorkflowProjectRole, getWorkflowProjectRole,
initState, initState,

View File

@@ -9,21 +9,9 @@ import type { CompletionSource, CompletionResult } from '@codemirror/autocomplet
import { CompletionContext } from '@codemirror/autocomplete'; import { CompletionContext } from '@codemirror/autocomplete';
import { EditorState } from '@codemirror/state'; import { EditorState } from '@codemirror/state';
import { n8nLang } from '@/plugins/codemirror/n8nLang'; import { n8nLang } from '@/plugins/codemirror/n8nLang';
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
import { useUIStore } from '@/stores/ui.store';
import { useSettingsStore } from '@/stores/settings.store';
let externalSecretsStore: ReturnType<typeof useExternalSecretsStore>;
let uiStore: ReturnType<typeof useUIStore>;
let settingsStore: ReturnType<typeof useSettingsStore>;
beforeEach(async () => { beforeEach(async () => {
setActivePinia(createTestingPinia()); setActivePinia(createTestingPinia());
externalSecretsStore = useExternalSecretsStore();
uiStore = useUIStore();
settingsStore = useSettingsStore();
vi.spyOn(utils, 'receivesNoBinaryData').mockReturnValue(true); // hide $binary vi.spyOn(utils, 'receivesNoBinaryData').mockReturnValue(true); // hide $binary
vi.spyOn(utils, 'isSplitInBatchesAbsent').mockReturnValue(false); // show context vi.spyOn(utils, 'isSplitInBatchesAbsent').mockReturnValue(false); // show context
vi.spyOn(utils, 'hasActiveNode').mockReturnValue(true); vi.spyOn(utils, 'hasActiveNode').mockReturnValue(true);

View File

@@ -4,7 +4,6 @@ import { useSettingsStore } from '@/stores/settings.store';
import { useUsersStore } from '@/stores/users.store'; import { useUsersStore } from '@/stores/users.store';
import { merge } from 'lodash-es'; import { merge } from 'lodash-es';
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils'; import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
import { useRootStore } from '@/stores/root.store';
import { useCloudPlanStore } from '@/stores/cloudPlan.store'; import { useCloudPlanStore } from '@/stores/cloudPlan.store';
import * as cloudPlanApi from '@/api/cloudPlans'; import * as cloudPlanApi from '@/api/cloudPlans';
import { import {
@@ -18,7 +17,6 @@ import { ROLE } from '@/constants';
let uiStore: ReturnType<typeof useUIStore>; let uiStore: ReturnType<typeof useUIStore>;
let settingsStore: ReturnType<typeof useSettingsStore>; let settingsStore: ReturnType<typeof useSettingsStore>;
let rootStore: ReturnType<typeof useRootStore>;
let cloudPlanStore: ReturnType<typeof useCloudPlanStore>; let cloudPlanStore: ReturnType<typeof useCloudPlanStore>;
function setUser(role: IRole) { function setUser(role: IRole) {
@@ -52,7 +50,6 @@ describe('UI store', () => {
setActivePinia(createPinia()); setActivePinia(createPinia());
uiStore = useUIStore(); uiStore = useUIStore();
settingsStore = useSettingsStore(); settingsStore = useSettingsStore();
rootStore = useRootStore();
cloudPlanStore = useCloudPlanStore(); cloudPlanStore = useCloudPlanStore();

View File

@@ -24,14 +24,6 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
const state = reactive<CloudPlanState>(DEFAULT_STATE); const state = reactive<CloudPlanState>(DEFAULT_STATE);
const setData = (data: CloudPlanState['data']) => {
state.data = data;
};
const setUsage = (data: CloudPlanState['usage']) => {
state.usage = data;
};
const reset = () => { const reset = () => {
state.data = null; state.data = null;
state.usage = null; state.usage = null;

View File

@@ -4,7 +4,6 @@ import type { UsageState } from '@/Interface';
import { activateLicenseKey, getLicense, renewLicense, requestLicenseTrial } from '@/api/usage'; import { activateLicenseKey, getLicense, renewLicense, requestLicenseTrial } from '@/api/usage';
import { useRootStore } from '@/stores/root.store'; import { useRootStore } from '@/stores/root.store';
import { useSettingsStore } from '@/stores/settings.store'; import { useSettingsStore } from '@/stores/settings.store';
import { useUsersStore } from '@/stores/users.store';
export type UsageTelemetry = { export type UsageTelemetry = {
instance_id: string; instance_id: string;
@@ -35,7 +34,6 @@ const DEFAULT_STATE: UsageState = {
export const useUsageStore = defineStore('usage', () => { export const useUsageStore = defineStore('usage', () => {
const rootStore = useRootStore(); const rootStore = useRootStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const usersStore = useUsersStore();
const state = reactive<UsageState>(DEFAULT_STATE); const state = reactive<UsageState>(DEFAULT_STATE);

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeMount, onBeforeUnmount, onMounted, ref } from 'vue'; import { onBeforeMount, onBeforeUnmount, onMounted } from 'vue';
import GlobalExecutionsList from '@/components/executions/global/GlobalExecutionsList.vue'; import GlobalExecutionsList from '@/components/executions/global/GlobalExecutionsList.vue';
import { setPageTitle } from '@/utils/htmlUtils'; import { setPageTitle } from '@/utils/htmlUtils';
import { useI18n } from '@/composables/useI18n'; import { useI18n } from '@/composables/useI18n';
@@ -19,8 +19,6 @@ const executionsStore = useExecutionsStore();
const toast = useToast(); const toast = useToast();
const animationsEnabled = ref(false);
const { executionsCount, executionsCountEstimated, filters, allExecutions } = const { executionsCount, executionsCountEstimated, filters, allExecutions } =
storeToRefs(executionsStore); storeToRefs(executionsStore);

View File

@@ -105,7 +105,6 @@ const {
addConnections, addConnections,
editableWorkflow, editableWorkflow,
editableWorkflowObject, editableWorkflowObject,
triggerNodes,
} = useCanvasOperations({ router, lastClickPosition }); } = useCanvasOperations({ router, lastClickPosition });
const isLoading = ref(true); const isLoading = ref(true);
@@ -128,15 +127,6 @@ const isReadOnlyEnvironment = computed(() => {
return sourceControlStore.preferences.branchReadOnly; return sourceControlStore.preferences.branchReadOnly;
}); });
const isCanvasAddButtonVisible = computed(() => {
return (
triggerNodes.value.length > 0 &&
!isLoading.value &&
!isDemoRoute.value &&
!isReadOnlyEnvironment.value
);
});
/** /**
* Initialization * Initialization
*/ */

View File

@@ -3,13 +3,11 @@ import { merge } from 'lodash-es';
import { EnterpriseEditionFeature, STORES } from '@/constants'; import { EnterpriseEditionFeature, STORES } from '@/constants';
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils'; import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
import SettingsExternalSecrets from '@/views/SettingsExternalSecrets.vue'; import SettingsExternalSecrets from '@/views/SettingsExternalSecrets.vue';
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
import { useSettingsStore } from '@/stores/settings.store'; import { useSettingsStore } from '@/stores/settings.store';
import { setupServer } from '@/__tests__/server'; import { setupServer } from '@/__tests__/server';
let pinia: ReturnType<typeof createTestingPinia>; let pinia: ReturnType<typeof createTestingPinia>;
let externalSecretsStore: ReturnType<typeof useExternalSecretsStore>;
let settingsStore: ReturnType<typeof useSettingsStore>; let settingsStore: ReturnType<typeof useSettingsStore>;
let server: ReturnType<typeof setupServer>; let server: ReturnType<typeof setupServer>;
@@ -28,7 +26,6 @@ describe('SettingsExternalSecrets', () => {
}, },
}, },
}); });
externalSecretsStore = useExternalSecretsStore(pinia);
settingsStore = useSettingsStore(); settingsStore = useSettingsStore();
await settingsStore.getSettings(); await settingsStore.getSettings();

View File

@@ -24,9 +24,7 @@
}, },
"lib": ["esnext", "dom", "dom.iterable", "scripthost"], "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
// TODO: remove all options below this line // TODO: remove all options below this line
"noUnusedLocals": false, "useUnknownInCatchVariables": false
"useUnknownInCatchVariables": false,
"experimentalDecorators": true
}, },
"include": [ "src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"] "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"]
} }