mirror of
https://github.com/n8n-io/n8n.git
synced 2024-08-17 00:50:42 +03:00
refactor(editor): Delete unused code (no-changelog) (#9866)
This commit is contained in:
parent
405e8746c9
commit
803895360c
@ -18,10 +18,7 @@
|
||||
},
|
||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
||||
// TODO: remove all options below this line
|
||||
"noUnusedLocals": false,
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.vue", "**/*.d.ts"]
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,9 +2,6 @@ import { setActivePinia } from 'pinia';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
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 { ProjectSharingData } from '@/types/projects.types';
|
||||
|
||||
@ -22,16 +19,9 @@ const createCredential = (overrides = {}): ICredentialsResponse => ({
|
||||
});
|
||||
|
||||
describe('CredentialCard', () => {
|
||||
let uiStore: ReturnType<typeof useUIStore>;
|
||||
let usersStore: ReturnType<typeof useUsersStore>;
|
||||
let credentialsStore: ReturnType<typeof useCredentialsStore>;
|
||||
|
||||
beforeEach(() => {
|
||||
const pinia = createTestingPinia();
|
||||
setActivePinia(pinia);
|
||||
uiStore = useUIStore();
|
||||
usersStore = useUsersStore();
|
||||
credentialsStore = useCredentialsStore();
|
||||
});
|
||||
|
||||
it('should render name and home project name', () => {
|
||||
|
@ -3,7 +3,6 @@ import type { ExternalSecretsProvider } from '@/Interface';
|
||||
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
import { useLoadingService } from '@/composables/useLoadingService';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import type { EventBus } from 'n8n-design-system/utils';
|
||||
|
||||
@ -25,7 +24,6 @@ const props = withDefaults(
|
||||
},
|
||||
);
|
||||
|
||||
const loadingService = useLoadingService();
|
||||
const externalSecretsStore = useExternalSecretsStore();
|
||||
const i18n = useI18n();
|
||||
const toast = useToast();
|
||||
|
@ -8,7 +8,6 @@ import { useI18n } from '@/composables/useI18n';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import ParameterInputExpanded from '@/components/ParameterInputExpanded.vue';
|
||||
import type {
|
||||
IUpdateInformation,
|
||||
@ -31,7 +30,6 @@ const defaultProviderData: Record<string, Partial<ExternalSecretsProviderData>>
|
||||
};
|
||||
|
||||
const externalSecretsStore = useExternalSecretsStore();
|
||||
const uiStore = useUIStore();
|
||||
const toast = useToast();
|
||||
const i18n = useI18n();
|
||||
const { confirm } = useMessage();
|
||||
@ -99,10 +97,6 @@ onMounted(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
function close() {
|
||||
uiStore.closeModal(EXTERNAL_SECRETS_PROVIDER_MODAL_KEY);
|
||||
}
|
||||
|
||||
function onValueChange(updateInformation: IUpdateInformation) {
|
||||
providerData.value = {
|
||||
...providerData.value,
|
||||
|
@ -20,7 +20,7 @@
|
||||
/>
|
||||
<div v-if="multipleValues">
|
||||
<div
|
||||
v-for="(value, index) in mutableValues[property.name]"
|
||||
v-for="(_, index) in mutableValues[property.name]"
|
||||
:key="property.name + index"
|
||||
class="parameter-item"
|
||||
>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { createEventBus } from 'n8n-design-system/utils';
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
import { hasPermission } from '@/utils/rbac/permissions';
|
||||
@ -8,11 +7,11 @@ import { useToast } from '@/composables/useToast';
|
||||
import { useLoadingService } from '@/composables/useLoadingService';
|
||||
import { useUIStore } from '@/stores/ui.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 { sourceControlEventBus } from '@/event-bus/source-control';
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
isCollapsed: boolean;
|
||||
}>();
|
||||
|
||||
@ -20,7 +19,6 @@ const responseStatuses = {
|
||||
CONFLICT: 409,
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
const loadingService = useLoadingService();
|
||||
const uiStore = useUIStore();
|
||||
const sourceControlStore = useSourceControlStore();
|
||||
@ -117,10 +115,6 @@ async function pullWorkfolder() {
|
||||
loadingService.setLoadingText(i18n.baseText('genericHelpers.loading'));
|
||||
}
|
||||
}
|
||||
|
||||
const goToSourceControlSetup = async () => {
|
||||
await router.push({ name: VIEWS.SOURCE_CONTROL });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -41,7 +41,6 @@ const uiStore = useUIStore();
|
||||
const rootStore = useRootStore();
|
||||
|
||||
const { mergedNodes, actions } = useNodeCreatorStore();
|
||||
const { baseUrl } = useRootStore();
|
||||
const { pushViewStack, popViewStack } = useViewStacks();
|
||||
|
||||
const { registerKeyHook } = useKeyboardNavigation();
|
||||
|
@ -104,7 +104,7 @@ describe('NodesListPanel', () => {
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const { setActions, setMergeNodes, setSelectedView } = useNodeCreatorStore();
|
||||
const { setMergeNodes, setSelectedView } = useNodeCreatorStore();
|
||||
|
||||
watch(
|
||||
() => props.nodeTypes,
|
||||
|
@ -180,7 +180,6 @@ import { storeToRefs } from 'pinia';
|
||||
const emit = defineEmits([
|
||||
'saveKeyboardShortcut',
|
||||
'valueChanged',
|
||||
'nodeTypeSelected',
|
||||
'switchSelectedNode',
|
||||
'openConnectionNodeCreator',
|
||||
'redrawNode',
|
||||
@ -419,8 +418,6 @@ const canLinkRuns = computed(
|
||||
|
||||
const linked = computed(() => isLinkingEnabled.value && canLinkRuns.value);
|
||||
|
||||
const inputPanelMargin = computed(() => (isTriggerNode.value ? 0 : 80));
|
||||
|
||||
const featureRequestUrl = computed(() => {
|
||||
if (!activeNodeType.value) {
|
||||
return '';
|
||||
@ -595,10 +592,6 @@ const valueChanged = (parameterData: IUpdateInformation) => {
|
||||
emit('valueChanged', parameterData);
|
||||
};
|
||||
|
||||
const nodeTypeSelected = (nodeTypeName: string) => {
|
||||
emit('nodeTypeSelected', nodeTypeName);
|
||||
};
|
||||
|
||||
const onSwitchSelectedNode = (nodeTypeName: string) => {
|
||||
emit('switchSelectedNode', nodeTypeName);
|
||||
};
|
||||
|
@ -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 {
|
||||
// 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
|
||||
|
@ -3,7 +3,7 @@ import { createPinia, setActivePinia } from 'pinia';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import { getDropdownItems } from '@/__tests__/utils';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRouter } from 'vue-router';
|
||||
import ProjectSettings from '@/components/Projects/ProjectSettings.vue';
|
||||
import { useProjectsStore } from '@/stores/projects.store';
|
||||
import { VIEWS } from '@/constants';
|
||||
@ -31,7 +31,6 @@ const renderComponent = createComponentRenderer(ProjectSettings);
|
||||
const teamProjects = Array.from({ length: 3 }, () => createProjectListItem('team'));
|
||||
|
||||
let router: ReturnType<typeof useRouter>;
|
||||
let route: ReturnType<typeof useRoute>;
|
||||
let projectsStore: ReturnType<typeof useProjectsStore>;
|
||||
let usersStore: ReturnType<typeof useUsersStore>;
|
||||
let settingsStore: ReturnType<typeof useSettingsStore>;
|
||||
@ -40,7 +39,6 @@ describe('ProjectSettings', () => {
|
||||
beforeEach(() => {
|
||||
const pinia = createPinia();
|
||||
setActivePinia(pinia);
|
||||
route = useRoute();
|
||||
router = useRouter();
|
||||
projectsStore = useProjectsStore();
|
||||
usersStore = useUsersStore();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
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 { useProjectsStore } from '@/stores/projects.store';
|
||||
|
||||
@ -34,15 +34,11 @@ vi.mock('@/utils/rbac/permissions', () => ({
|
||||
|
||||
const renderComponent = createComponentRenderer(ProjectTabs);
|
||||
|
||||
let router: ReturnType<typeof useRouter>;
|
||||
let route: ReturnType<typeof useRoute>;
|
||||
let projectsStore: ReturnType<typeof useProjectsStore>;
|
||||
|
||||
describe('ProjectTabs', () => {
|
||||
beforeEach(() => {
|
||||
route = useRoute();
|
||||
router = useRouter();
|
||||
projectsStore = useProjectsStore();
|
||||
});
|
||||
|
||||
it('should render home tabs', async () => {
|
||||
|
@ -6,7 +6,7 @@
|
||||
<th :class="$style.tableRightMargin"></th>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="(row, index1) in tableData.data"
|
||||
v-for="(_, index1) in tableData.data"
|
||||
:key="index1"
|
||||
:class="{ [$style.hoveringRow]: isHoveringRow(index1) }"
|
||||
>
|
||||
|
@ -5,10 +5,6 @@ import userEvent from '@testing-library/user-event';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import { VIEWS } from '@/constants';
|
||||
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 { useRouter } from 'vue-router';
|
||||
|
||||
@ -42,19 +38,11 @@ const createWorkflow = (overrides = {}): IWorkflowDb => ({
|
||||
describe('WorkflowCard', () => {
|
||||
let pinia: ReturnType<typeof createPinia>;
|
||||
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>;
|
||||
|
||||
beforeEach(async () => {
|
||||
pinia = createPinia();
|
||||
setActivePinia(pinia);
|
||||
uiStore = useUIStore();
|
||||
settingsStore = useSettingsStore();
|
||||
usersStore = useUsersStore();
|
||||
workflowsStore = useWorkflowsStore();
|
||||
router = useRouter();
|
||||
windowOpenSpy = vi.spyOn(window, 'open');
|
||||
});
|
||||
|
@ -2,7 +2,6 @@ import { merge } from 'lodash-es';
|
||||
import { SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils';
|
||||
import { ROLE, STORES } from '@/constants';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import CollaborationPane from '@/components//MainHeader/CollaborationPane.vue';
|
||||
import type { RenderOptions } from '@/__tests__/render';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
@ -43,8 +42,6 @@ const MEMBER_USER_2 = {
|
||||
fullName: 'Another Member User',
|
||||
};
|
||||
|
||||
let uiStore: ReturnType<typeof useUIStore>;
|
||||
|
||||
const initialState = {
|
||||
[STORES.SETTINGS]: {
|
||||
settings: merge({}, SETTINGS_STORE_DEFAULT_STATE.settings),
|
||||
@ -80,10 +77,6 @@ const defaultRenderOptions: RenderOptions = {
|
||||
const renderComponent = createComponentRenderer(CollaborationPane, defaultRenderOptions);
|
||||
|
||||
describe('CollaborationPane', () => {
|
||||
beforeEach(() => {
|
||||
uiStore = useUIStore();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ describe('BannerStack', () => {
|
||||
});
|
||||
|
||||
it('should render redacted version', async () => {
|
||||
const { container, getByTestId } = renderComponent(
|
||||
const { getByTestId } = renderComponent(
|
||||
merge(DEFAULT_SETUP, {
|
||||
props: {
|
||||
redactValue: true,
|
||||
|
@ -91,7 +91,7 @@ describe('MainSidebarSourceControl', () => {
|
||||
});
|
||||
const openModalSpy = vi.spyOn(uiStore, 'openModalWithData');
|
||||
|
||||
const { getAllByRole, getByRole } = renderComponent({
|
||||
const { getAllByRole } = renderComponent({
|
||||
pinia,
|
||||
props: { isCollapsed: false },
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ describe('TemplatesInfoCard', () => {
|
||||
});
|
||||
|
||||
it('should render component properly', () => {
|
||||
const { getByText, container, debug } = renderComponent({
|
||||
const { getByText, container } = renderComponent({
|
||||
pinia,
|
||||
props: {
|
||||
collection: TEST_COLLECTION,
|
||||
|
@ -78,7 +78,7 @@ describe('CanvasNode', () => {
|
||||
|
||||
describe('toolbar', () => {
|
||||
it('should render toolbar when node is hovered', async () => {
|
||||
const { getByTestId, container } = renderComponent({
|
||||
const { getByTestId } = renderComponent({
|
||||
props: {
|
||||
...createCanvasNodeProps(),
|
||||
},
|
||||
|
@ -94,7 +94,7 @@ describe('ExecutionsFilter', () => {
|
||||
])(
|
||||
'renders in %s environment on %s deployment with advancedExecutionFilters %s',
|
||||
async (environment, deployment, advancedExecutionFilters, workflows) => {
|
||||
const { html, getByTestId, queryByTestId, queryAllByTestId } = renderComponent({
|
||||
const { getByTestId, queryByTestId } = renderComponent({
|
||||
props: { workflows },
|
||||
pinia: createTestingPinia({
|
||||
initialState: merge(initialState, {
|
||||
|
@ -5,7 +5,6 @@ import userEvent from '@testing-library/user-event';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { STORES, VIEWS } from '@/constants';
|
||||
import ExecutionsList from '@/components/executions/global/GlobalExecutionsList.vue';
|
||||
import type { IWorkflowDb } from '@/Interface';
|
||||
import { randomInt, type ExecutionSummary } from 'n8n-workflow';
|
||||
import { retry, SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils';
|
||||
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 => ({
|
||||
id: faker.string.uuid(),
|
||||
finished: faker.datatype.boolean(),
|
||||
@ -62,8 +49,6 @@ const executionDataFactory = (): ExecutionSummary => ({
|
||||
retrySuccessId: generateUndefinedNullOrString(),
|
||||
});
|
||||
|
||||
const generateWorkflowsData = () => Array.from({ length: 10 }, workflowDataFactory);
|
||||
|
||||
const generateExecutionsData = () =>
|
||||
Array.from({ length: 2 }, () => ({
|
||||
count: 20,
|
||||
|
@ -58,7 +58,6 @@ vi.mock('@/composables/useToast', () => ({
|
||||
vi.mock('@/composables/useWorkflowHelpers', () => ({
|
||||
useWorkflowHelpers: vi.fn().mockReturnValue({
|
||||
getCurrentWorkflow: vi.fn(),
|
||||
checkReadyForExecution: vi.fn(),
|
||||
saveCurrentWorkflow: vi.fn(),
|
||||
getWorkflowDataToSave: vi.fn(),
|
||||
}),
|
||||
|
@ -880,9 +880,7 @@ export function useCanvasOperations({
|
||||
editableWorkflow,
|
||||
editableWorkflowObject,
|
||||
triggerNodes,
|
||||
lastClickPosition,
|
||||
initializeNodeDataWithDefaultCredentials,
|
||||
createNode,
|
||||
addNodes,
|
||||
updateNodePosition,
|
||||
setNodeActive,
|
||||
@ -892,11 +890,9 @@ export function useCanvasOperations({
|
||||
revertRenameNode,
|
||||
deleteNode,
|
||||
revertDeleteNode,
|
||||
trackDeleteNode,
|
||||
addConnections,
|
||||
createConnection,
|
||||
deleteConnection,
|
||||
revertDeleteConnection,
|
||||
isConnectionAllowed,
|
||||
};
|
||||
}
|
||||
|
@ -660,11 +660,7 @@ export function useNodeBase({
|
||||
getSpacerIndexes,
|
||||
addInputEndpoints,
|
||||
addOutputEndpoints,
|
||||
addEndpointTestingData,
|
||||
addNode,
|
||||
getEndpointColor,
|
||||
getInputConnectionStyle,
|
||||
getOutputConnectionStyle,
|
||||
mouseLeftClick,
|
||||
touchEnd,
|
||||
inputs,
|
||||
|
@ -1226,7 +1226,6 @@ export function useNodeHelpers() {
|
||||
getParameterValue,
|
||||
displayParameter,
|
||||
getNodeIssues,
|
||||
refreshNodeIssues,
|
||||
updateNodesInputIssues,
|
||||
updateNodesExecutionIssues,
|
||||
updateNodeCredentialIssuesByName,
|
||||
|
@ -627,7 +627,6 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
|
||||
queuePushMessage,
|
||||
processWaitingPushMessages,
|
||||
pushMessageQueue,
|
||||
removeEventListener,
|
||||
retryTimeout,
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import {
|
||||
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
||||
PLACEHOLDER_FILLED_AT_EXECUTION_TIME,
|
||||
VIEWS,
|
||||
WEBHOOK_NODE_TYPE,
|
||||
} from '@/constants';
|
||||
|
||||
import type {
|
||||
@ -15,15 +14,12 @@ import type {
|
||||
INodeConnection,
|
||||
INodeCredentials,
|
||||
INodeExecutionData,
|
||||
INodeIssues,
|
||||
INodeParameters,
|
||||
INodeProperties,
|
||||
INodeType,
|
||||
INodeTypes,
|
||||
IRunExecutionData,
|
||||
IWebhookDescription,
|
||||
IWorkflowDataProxyAdditionalKeys,
|
||||
IWorkflowIssues,
|
||||
IWorkflowSettings,
|
||||
NodeParameterValue,
|
||||
Workflow,
|
||||
@ -47,7 +43,7 @@ import { useMessage } from '@/composables/useMessage';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||
|
||||
import { get, isEqual } from 'lodash-es';
|
||||
import { get } from 'lodash-es';
|
||||
|
||||
import { useEnvironmentsStore } from '@/stores/environments.ee.store';
|
||||
import { useRootStore } from '@/stores/root.store';
|
||||
@ -303,10 +299,6 @@ function getConnectedNodes(
|
||||
return [...new Set(connectedNodes)];
|
||||
}
|
||||
|
||||
function getNodes(): INodeUi[] {
|
||||
return useWorkflowsStore().getNodes();
|
||||
}
|
||||
|
||||
// Returns a workflow instance.
|
||||
function getWorkflow(nodes: INodeUi[], connections: IConnections, copyData?: boolean): Workflow {
|
||||
return useWorkflowsStore().getWorkflow(nodes, connections, copyData);
|
||||
@ -531,81 +523,6 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||
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() {
|
||||
const workflowNodes = workflowsStore.allNodes;
|
||||
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(
|
||||
workflow: IWorkflowData | IWorkflowDataUpdate,
|
||||
usableCredentials: ICredentialsResponse[],
|
||||
@ -1215,14 +1108,12 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||
resolveRequiredParameters,
|
||||
getCurrentWorkflow,
|
||||
getConnectedNodes,
|
||||
getNodes,
|
||||
getWorkflow,
|
||||
getNodeTypes,
|
||||
connectionInputData,
|
||||
executeData,
|
||||
getNodeTypesMaxCount,
|
||||
getNodeTypeCount,
|
||||
checkReadyForExecution,
|
||||
getWorkflowDataToSave,
|
||||
getNodeDataToSave,
|
||||
getWebhookExpressionValue,
|
||||
@ -1232,7 +1123,6 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||
saveCurrentWorkflow,
|
||||
saveAsNewWorkflow,
|
||||
updateNodePositions,
|
||||
dataHasChanged,
|
||||
removeForeignCredentialsFromWorkflow,
|
||||
getWorkflowProjectRole,
|
||||
initState,
|
||||
|
@ -9,21 +9,9 @@ import type { CompletionSource, CompletionResult } from '@codemirror/autocomplet
|
||||
import { CompletionContext } from '@codemirror/autocomplete';
|
||||
import { EditorState } from '@codemirror/state';
|
||||
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 () => {
|
||||
setActivePinia(createTestingPinia());
|
||||
|
||||
externalSecretsStore = useExternalSecretsStore();
|
||||
uiStore = useUIStore();
|
||||
settingsStore = useSettingsStore();
|
||||
|
||||
vi.spyOn(utils, 'receivesNoBinaryData').mockReturnValue(true); // hide $binary
|
||||
vi.spyOn(utils, 'isSplitInBatchesAbsent').mockReturnValue(false); // show context
|
||||
vi.spyOn(utils, 'hasActiveNode').mockReturnValue(true);
|
||||
|
@ -4,7 +4,6 @@ import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { merge } from 'lodash-es';
|
||||
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
|
||||
import { useRootStore } from '@/stores/root.store';
|
||||
import { useCloudPlanStore } from '@/stores/cloudPlan.store';
|
||||
import * as cloudPlanApi from '@/api/cloudPlans';
|
||||
import {
|
||||
@ -18,7 +17,6 @@ import { ROLE } from '@/constants';
|
||||
|
||||
let uiStore: ReturnType<typeof useUIStore>;
|
||||
let settingsStore: ReturnType<typeof useSettingsStore>;
|
||||
let rootStore: ReturnType<typeof useRootStore>;
|
||||
let cloudPlanStore: ReturnType<typeof useCloudPlanStore>;
|
||||
|
||||
function setUser(role: IRole) {
|
||||
@ -52,7 +50,6 @@ describe('UI store', () => {
|
||||
setActivePinia(createPinia());
|
||||
uiStore = useUIStore();
|
||||
settingsStore = useSettingsStore();
|
||||
rootStore = useRootStore();
|
||||
|
||||
cloudPlanStore = useCloudPlanStore();
|
||||
|
||||
|
@ -24,14 +24,6 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
|
||||
|
||||
const state = reactive<CloudPlanState>(DEFAULT_STATE);
|
||||
|
||||
const setData = (data: CloudPlanState['data']) => {
|
||||
state.data = data;
|
||||
};
|
||||
|
||||
const setUsage = (data: CloudPlanState['usage']) => {
|
||||
state.usage = data;
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
state.data = null;
|
||||
state.usage = null;
|
||||
|
@ -4,7 +4,6 @@ import type { UsageState } from '@/Interface';
|
||||
import { activateLicenseKey, getLicense, renewLicense, requestLicenseTrial } from '@/api/usage';
|
||||
import { useRootStore } from '@/stores/root.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
|
||||
export type UsageTelemetry = {
|
||||
instance_id: string;
|
||||
@ -35,7 +34,6 @@ const DEFAULT_STATE: UsageState = {
|
||||
export const useUsageStore = defineStore('usage', () => {
|
||||
const rootStore = useRootStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const usersStore = useUsersStore();
|
||||
|
||||
const state = reactive<UsageState>(DEFAULT_STATE);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<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 { setPageTitle } from '@/utils/htmlUtils';
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
@ -19,8 +19,6 @@ const executionsStore = useExecutionsStore();
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
const animationsEnabled = ref(false);
|
||||
|
||||
const { executionsCount, executionsCountEstimated, filters, allExecutions } =
|
||||
storeToRefs(executionsStore);
|
||||
|
||||
|
@ -105,7 +105,6 @@ const {
|
||||
addConnections,
|
||||
editableWorkflow,
|
||||
editableWorkflowObject,
|
||||
triggerNodes,
|
||||
} = useCanvasOperations({ router, lastClickPosition });
|
||||
|
||||
const isLoading = ref(true);
|
||||
@ -128,15 +127,6 @@ const isReadOnlyEnvironment = computed(() => {
|
||||
return sourceControlStore.preferences.branchReadOnly;
|
||||
});
|
||||
|
||||
const isCanvasAddButtonVisible = computed(() => {
|
||||
return (
|
||||
triggerNodes.value.length > 0 &&
|
||||
!isLoading.value &&
|
||||
!isDemoRoute.value &&
|
||||
!isReadOnlyEnvironment.value
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
|
@ -3,13 +3,11 @@ import { merge } from 'lodash-es';
|
||||
import { EnterpriseEditionFeature, STORES } from '@/constants';
|
||||
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
|
||||
import SettingsExternalSecrets from '@/views/SettingsExternalSecrets.vue';
|
||||
import { useExternalSecretsStore } from '@/stores/externalSecrets.ee.store';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { setupServer } from '@/__tests__/server';
|
||||
|
||||
let pinia: ReturnType<typeof createTestingPinia>;
|
||||
let externalSecretsStore: ReturnType<typeof useExternalSecretsStore>;
|
||||
let settingsStore: ReturnType<typeof useSettingsStore>;
|
||||
let server: ReturnType<typeof setupServer>;
|
||||
|
||||
@ -28,7 +26,6 @@ describe('SettingsExternalSecrets', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
externalSecretsStore = useExternalSecretsStore(pinia);
|
||||
settingsStore = useSettingsStore();
|
||||
|
||||
await settingsStore.getSettings();
|
||||
|
@ -24,9 +24,7 @@
|
||||
},
|
||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
||||
// TODO: remove all options below this line
|
||||
"noUnusedLocals": false,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"experimentalDecorators": true
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"include": [ "src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"]
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user