mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-30 16:26:59 +02:00
refactor(editor): Extract evaluation code into feature (no-changelog) (#20364)
This commit is contained in:
parent
065bbcfdc7
commit
0a77ec6b6a
|
|
@ -1,37 +0,0 @@
|
|||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import { type IconName } from '@n8n/design-system/components/N8nIcon/icons';
|
||||
import type { IconColor } from '@n8n/design-system/types/icon';
|
||||
|
||||
export const statusDictionary: Record<
|
||||
TestRunRecord['status'],
|
||||
{ icon: IconName; color: IconColor }
|
||||
> = {
|
||||
new: {
|
||||
icon: 'status-new',
|
||||
color: 'foreground-xdark',
|
||||
},
|
||||
running: {
|
||||
icon: 'spinner',
|
||||
color: 'secondary',
|
||||
},
|
||||
completed: {
|
||||
icon: 'status-completed',
|
||||
color: 'success',
|
||||
},
|
||||
error: {
|
||||
icon: 'triangle-alert',
|
||||
color: 'danger',
|
||||
},
|
||||
cancelled: {
|
||||
icon: 'status-canceled',
|
||||
color: 'foreground-xdark',
|
||||
},
|
||||
warning: {
|
||||
icon: 'status-warning',
|
||||
color: 'warning',
|
||||
},
|
||||
success: {
|
||||
icon: 'status-completed',
|
||||
color: 'success',
|
||||
},
|
||||
};
|
||||
|
|
@ -20,7 +20,7 @@ import { i18n } from '@n8n/i18n';
|
|||
|
||||
import { getCredentialOnlyNodeType } from '@/utils/credentialOnlyNodes';
|
||||
import { formatTriggerActionName } from '../utils';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '@/features/evaluation.ee/evaluation.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
|
||||
const PLACEHOLDER_RECOMMENDED_ACTION_KEY = 'placeholder_recommended';
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ import { useTemplatesStore } from '@/features/templates/templates.store';
|
|||
import type { BaseTextKey } from '@n8n/i18n';
|
||||
import camelCase from 'lodash/camelCase';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '@/features/evaluation.ee/evaluation.store';
|
||||
import { getAiTemplatesCallout, getPreBuiltAgentsCalloutWithDivider } from './utils';
|
||||
import { useCalloutHelpers } from '@/composables/useCalloutHelpers';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { createComponentRenderer } from '@/__tests__/render';
|
|||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { ref } from 'vue';
|
||||
import WorkflowProductionChecklist from '@/components/WorkflowProductionChecklist.vue';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '@/features/evaluation.ee/evaluation.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useWorkflowSettingsCache } from '@/composables/useWorkflowsCache';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { computed, ref, onMounted, watch } from 'vue';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '@/features/evaluation.ee/evaluation.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import type { ActionType, WorkflowSettings } from '@/composables/useWorkflowsCache';
|
||||
import { useWorkflowSettingsCache } from '@/composables/useWorkflowsCache';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestRunRecord } from '../../evaluation.api';
|
||||
import { computed, watchEffect } from 'vue';
|
||||
import { Line } from 'vue-chartjs';
|
||||
import { useMetricsChart } from '../composables/useMetricsChart';
|
||||
import { useMetricsChart } from '../../composables/useMetricsChart';
|
||||
|
||||
import { N8nOption, N8nSelect } from '@n8n/design-system';
|
||||
const emit = defineEmits<{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import MetricsChart from '@/components/Evaluations.ee/ListRuns/MetricsChart.vue';
|
||||
import TestRunsTable from '@/components/Evaluations.ee/ListRuns/TestRunsTable.vue';
|
||||
import type { TestRunRecord } from '../../evaluation.api';
|
||||
import MetricsChart from './MetricsChart.vue';
|
||||
import TestRunsTable from './TestRunsTable.vue';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { VIEWS } from '@/constants';
|
||||
import { convertToDisplayDate } from '@/utils/formatters/dateFormatter';
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestRunRecord } from '../../evaluation.api';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { computed } from 'vue';
|
||||
import type { TestTableColumn } from '../shared/TestTableBase.vue';
|
||||
import type { BaseTextKey } from '@n8n/i18n';
|
||||
import TestTableBase from '../shared/TestTableBase.vue';
|
||||
import { statusDictionary } from '../shared/statusDictionary';
|
||||
import { getErrorBaseKey } from '@/components/Evaluations.ee/shared/errorCodes';
|
||||
import { statusDictionary, getErrorBaseKey } from '../../evaluation.constants';
|
||||
import { I18nT } from 'vue-i18n';
|
||||
import { N8nHeading, N8nIcon, N8nText, N8nTooltip } from '@n8n/design-system';
|
||||
import AnimatedSpinner from '@/components/AnimatedSpinner.vue';
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
import { useI18n } from '@n8n/i18n';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '../../evaluation.store';
|
||||
import { PLACEHOLDER_EMPTY_WORKFLOW_ID, VIEWS } from '@/constants';
|
||||
import StepHeader from '../shared/StepHeader.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<script setup lang="ts" generic="T">
|
||||
import type { BaseTextKey } from '@n8n/i18n';
|
||||
import type { TestTableColumn } from '@/components/Evaluations.ee/shared/TestTableBase.vue';
|
||||
import type { TestTableColumn } from './TestTableBase.vue';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import type { BadgeTheme } from '@n8n/design-system';
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts" generic="T extends object">
|
||||
import { SHORT_TABLE_CELL_MIN_WIDTH } from '@/views/Evaluations.ee/utils';
|
||||
import { SHORT_TABLE_CELL_MIN_WIDTH } from '../../evaluation.utils';
|
||||
import type { ColumnCls, TableInstance } from 'element-plus';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import { nextTick, ref, useCssModule, watch } from 'vue';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, it, expect } from 'vitest';
|
||||
import { useMetricsChart } from '../composables/useMetricsChart';
|
||||
import type { TestRunRecord as Record } from '@/api/evaluation.ee';
|
||||
import { useMetricsChart } from './useMetricsChart';
|
||||
import type { TestRunRecord as Record } from '../evaluation.api';
|
||||
|
||||
type TestRunRecord = Record & { index: number };
|
||||
describe('useMetricsChart', () => {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ChartData, ChartOptions } from 'chart.js';
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestRunRecord } from '../evaluation.api';
|
||||
import dateFormat from 'dateformat';
|
||||
import { useCssVar } from '@vueuse/core';
|
||||
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
import type { TestRunRecord } from './evaluation.api';
|
||||
import { type IconName } from '@n8n/design-system/components/N8nIcon/icons';
|
||||
import type { IconColor } from '@n8n/design-system/types/icon';
|
||||
|
||||
import type { BaseTextKey } from '@n8n/i18n';
|
||||
|
||||
const TEST_CASE_EXECUTION_ERROR_CODE = {
|
||||
|
|
@ -55,3 +59,37 @@ export const getErrorBaseKey = (errorCode?: string): string => {
|
|||
''
|
||||
);
|
||||
};
|
||||
|
||||
export const statusDictionary: Record<
|
||||
TestRunRecord['status'],
|
||||
{ icon: IconName; color: IconColor }
|
||||
> = {
|
||||
new: {
|
||||
icon: 'status-new',
|
||||
color: 'foreground-xdark',
|
||||
},
|
||||
running: {
|
||||
icon: 'spinner',
|
||||
color: 'secondary',
|
||||
},
|
||||
completed: {
|
||||
icon: 'status-completed',
|
||||
color: 'success',
|
||||
},
|
||||
error: {
|
||||
icon: 'triangle-alert',
|
||||
color: 'danger',
|
||||
},
|
||||
cancelled: {
|
||||
icon: 'status-canceled',
|
||||
color: 'foreground-xdark',
|
||||
},
|
||||
warning: {
|
||||
icon: 'status-warning',
|
||||
color: 'warning',
|
||||
},
|
||||
success: {
|
||||
icon: 'status-completed',
|
||||
color: 'success',
|
||||
},
|
||||
};
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee'; // Adjust the import path as necessary
|
||||
import { useEvaluationStore } from './evaluation.store'; // Adjust the import path as necessary
|
||||
import { useRootStore } from '@n8n/stores/useRootStore';
|
||||
import { useAnnotationTagsStore } from '@/stores/tags.store';
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestRunRecord } from './evaluation.api';
|
||||
import { mockedStore } from '@/__tests__/utils';
|
||||
|
||||
const { getTestRuns, getTestRun, startTestRun, deleteTestRun } = vi.hoisted(() => ({
|
||||
|
|
@ -12,7 +12,7 @@ const { getTestRuns, getTestRun, startTestRun, deleteTestRun } = vi.hoisted(() =
|
|||
deleteTestRun: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/api/evaluation.ee', () => ({
|
||||
vi.mock('./evaluation.api', () => ({
|
||||
getTestRuns,
|
||||
getTestRun,
|
||||
startTestRun,
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRootStore } from '@n8n/stores/useRootStore';
|
||||
import * as evaluationsApi from '@/api/evaluation.ee';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from '@/api/evaluation.ee';
|
||||
import * as evaluationsApi from './evaluation.api';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from './evaluation.api';
|
||||
import { STORES } from '@n8n/stores';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { EVALUATION_NODE_TYPE, EVALUATION_TRIGGER_NODE_TYPE, NodeHelpers } from 'n8n-workflow';
|
||||
|
|
@ -5,8 +5,8 @@ import {
|
|||
getDefaultOrderedColumns,
|
||||
getTestCasesColumns,
|
||||
getTestTableHeaders,
|
||||
} from './utils';
|
||||
import type { TestCaseExecutionRecord } from '@/api/evaluation.ee';
|
||||
} from './evaluation.utils';
|
||||
import type { TestCaseExecutionRecord } from './evaluation.api';
|
||||
|
||||
describe('utils', () => {
|
||||
describe('applyCachedSortOrder', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import type { JsonValue } from 'n8n-workflow';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from '../../api/evaluation.ee';
|
||||
import type { Column, Header } from './TestRunDetailView.vue';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from './evaluation.api';
|
||||
import type { Column, Header } from './views/TestRunDetailView.vue';
|
||||
|
||||
export const SHORT_TABLE_CELL_MIN_WIDTH = 125;
|
||||
const LONG_TABLE_CELL_MIN_WIDTH = 250;
|
||||
|
|
@ -2,16 +2,16 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|||
import { mock } from 'vitest-mock-extended';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import EvaluationRootView from '../EvaluationsRootView.vue';
|
||||
import EvaluationRootView from './EvaluationsRootView.vue';
|
||||
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '../evaluation.store';
|
||||
import { useUsageStore } from '@/stores/usage.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import { mockedStore } from '@/__tests__/utils';
|
||||
import type { IWorkflowDb } from '@/Interface';
|
||||
import { waitFor } from '@testing-library/vue';
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestRunRecord } from '../evaluation.api';
|
||||
import { PLACEHOLDER_EMPTY_WORKFLOW_ID } from '@/constants';
|
||||
import { useTelemetry } from '@/composables/useTelemetry';
|
||||
import { EVALUATION_NODE_TYPE, EVALUATION_TRIGGER_NODE_TYPE, NodeHelpers } from 'n8n-workflow';
|
||||
|
|
@ -7,13 +7,13 @@ import { useCanvasOperations } from '@/composables/useCanvasOperations';
|
|||
import { useTelemetry } from '@/composables/useTelemetry';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '../evaluation.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
|
||||
import { computed, watch } from 'vue';
|
||||
import EvaluationsPaywall from '@/components/Evaluations.ee/Paywall/EvaluationsPaywall.vue';
|
||||
import SetupWizard from '@/components/Evaluations.ee/SetupWizard/SetupWizard.vue';
|
||||
import EvaluationsPaywall from '../components/Paywall/EvaluationsPaywall.vue';
|
||||
import SetupWizard from '../components/SetupWizard/SetupWizard.vue';
|
||||
|
||||
import { N8nCallout, N8nLink, N8nText } from '@n8n/design-system';
|
||||
const props = defineProps<{
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import EvaluationsView from '@/views/Evaluations.ee/EvaluationsView.vue';
|
||||
import EvaluationsView from './EvaluationsView.vue';
|
||||
|
||||
import { mockedStore } from '@/__tests__/utils';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '../evaluation.store';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import type { TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestRunRecord } from '../evaluation.api';
|
||||
import { waitFor } from '@testing-library/vue';
|
||||
|
||||
vi.mock('vue-router', () => {
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
import { useI18n } from '@n8n/i18n';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
|
||||
import RunsSection from '@/components/Evaluations.ee/ListRuns/RunsSection.vue';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import RunsSection from '../components/ListRuns/RunsSection.vue';
|
||||
import { useEvaluationStore } from '../evaluation.store';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
|
||||
|
|
@ -2,9 +2,9 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { waitFor } from '@testing-library/vue';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '../evaluation.store';
|
||||
import TestRunDetailView from './TestRunDetailView.vue';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from '@/api/evaluation.ee';
|
||||
import type { TestCaseExecutionRecord, TestRunRecord } from '../evaluation.api';
|
||||
import type { IWorkflowDb } from '@/Interface';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
|
|
@ -1,19 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import type { TestCaseExecutionRecord } from '@/api/evaluation.ee';
|
||||
import type { TestTableColumn } from '@/components/Evaluations.ee/shared/TestTableBase.vue';
|
||||
import TestTableBase from '@/components/Evaluations.ee/shared/TestTableBase.vue';
|
||||
import type { TestCaseExecutionRecord } from '../evaluation.api';
|
||||
import type { TestTableColumn } from '../components/shared/TestTableBase.vue';
|
||||
import TestTableBase from '../components/shared/TestTableBase.vue';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { VIEWS } from '@/constants';
|
||||
import type { BaseTextKey } from '@n8n/i18n';
|
||||
import { useEvaluationStore } from '@/stores/evaluation.store.ee';
|
||||
import { useEvaluationStore } from '../evaluation.store';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { convertToDisplayDate } from '@/utils/formatters/dateFormatter';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { statusDictionary } from '@/components/Evaluations.ee/shared/statusDictionary';
|
||||
import { getErrorBaseKey } from '@/components/Evaluations.ee/shared/errorCodes';
|
||||
import { statusDictionary, getErrorBaseKey } from '../evaluation.constants';
|
||||
import { ElScrollbar } from 'element-plus';
|
||||
import {
|
||||
N8nCallout,
|
||||
|
|
@ -32,7 +31,7 @@ import {
|
|||
getDefaultOrderedColumns,
|
||||
getTestCasesColumns,
|
||||
getTestTableHeaders,
|
||||
} from './utils';
|
||||
} from '../evaluation.utils';
|
||||
import {
|
||||
useWorkflowSettingsCache,
|
||||
type UserEvaluationPreferences,
|
||||
|
|
@ -18,7 +18,6 @@ import type { RouterMiddleware } from '@/types/router';
|
|||
import { initializeAuthenticatedFeatures, initializeCore } from '@/init';
|
||||
import { tryToParseNumber } from '@/utils/typesUtils';
|
||||
import { projectsRoutes } from '@/routes/projects.routes';
|
||||
import TestRunDetailView from '@/views/Evaluations.ee/TestRunDetailView.vue';
|
||||
import { MfaRequiredError } from '@n8n/rest-api-client';
|
||||
import { useCalloutHelpers } from './composables/useCalloutHelpers';
|
||||
|
||||
|
|
@ -67,9 +66,12 @@ const SettingsExternalSecrets = async () =>
|
|||
const WorkerView = async () => await import('./views/WorkerView.vue');
|
||||
const WorkflowHistory = async () => await import('@/views/WorkflowHistory.vue');
|
||||
const WorkflowOnboardingView = async () => await import('@/views/WorkflowOnboardingView.vue');
|
||||
const EvaluationsView = async () => await import('@/views/Evaluations.ee/EvaluationsView.vue');
|
||||
const EvaluationsView = async () =>
|
||||
await import('@/features/evaluation.ee/views/EvaluationsView.vue');
|
||||
const TestRunDetailView = async () =>
|
||||
await import('@/features/evaluation.ee/views/TestRunDetailView.vue');
|
||||
const EvaluationRootView = async () =>
|
||||
await import('@/views/Evaluations.ee/EvaluationsRootView.vue');
|
||||
await import('@/features/evaluation.ee/views/EvaluationsRootView.vue');
|
||||
const PrebuiltAgentTemplatesView = async () =>
|
||||
await import('@/views/PrebuiltAgentTemplatesView.vue');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user