Merge branch 'master' into master

This commit is contained in:
Tristan Robert 2024-12-05 09:43:53 +01:00 committed by GitHub
commit fe92469cb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 813 additions and 853 deletions

View file

@ -80,7 +80,7 @@
"tslib": "^2.6.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.7.2",
"vue-tsc": "^2.1.6",
"vue-tsc": "^2.1.10",
"ws": ">=8.17.1"
},
"patchedDependencies": {
@ -90,7 +90,7 @@
"@types/express-serve-static-core@4.17.43": "patches/@types__express-serve-static-core@4.17.43.patch",
"@types/ws@8.5.4": "patches/@types__ws@8.5.4.patch",
"@types/uuencode@0.0.3": "patches/@types__uuencode@0.0.3.patch",
"vue-tsc@2.1.6": "patches/vue-tsc@2.1.6.patch"
"vue-tsc@2.1.10": "patches/vue-tsc@2.1.10.patch"
}
},
"dependencies": {

View file

@ -46,11 +46,12 @@
"devDependencies": {
"@iconify-json/mdi": "^1.1.54",
"@n8n/storybook": "workspace:*",
"@vitejs/plugin-vue": "catalog:frontend",
"@vitest/coverage-v8": "catalog:frontend",
"unplugin-icons": "^0.19.0",
"vite": "catalog:frontend",
"vitest": "catalog:frontend",
"vite-plugin-dts": "^4.2.3",
"vite-plugin-dts": "^4.3.0",
"vue-tsc": "catalog:frontend"
},
"files": [

View file

@ -7,5 +7,5 @@ export type FrontendBetaFeatures = 'canvas_v2';
export class FrontendConfig {
/** Which UI experiments to enable. Separate multiple values with a comma `,` */
@Env('N8N_UI_BETA_FEATURES')
betaFeatures: StringArray<FrontendBetaFeatures> = [];
betaFeatures: StringArray<FrontendBetaFeatures> = ['canvas_v2'];
}

View file

@ -3,19 +3,19 @@
"private": true,
"version": "0.0.1",
"devDependencies": {
"@chromatic-com/storybook": "^2.0.2",
"@storybook/addon-a11y": "^8.3.5",
"@storybook/addon-actions": "^8.3.5",
"@storybook/addon-docs": "^8.3.5",
"@storybook/addon-essentials": "^8.3.5",
"@storybook/addon-interactions": "^8.3.5",
"@storybook/addon-links": "^8.3.5",
"@storybook/addon-themes": "^8.3.5",
"@storybook/blocks": "^8.3.5",
"@storybook/test": "^8.3.5",
"@storybook/vue3": "^8.3.5",
"@storybook/vue3-vite": "^8.3.5",
"chromatic": "^11.10.2",
"storybook": "^8.3.5"
"@chromatic-com/storybook": "^3.2.2",
"@storybook/addon-a11y": "^8.4.6",
"@storybook/addon-actions": "^8.4.6",
"@storybook/addon-docs": "^8.4.6",
"@storybook/addon-essentials": "^8.4.6",
"@storybook/addon-interactions": "^8.4.6",
"@storybook/addon-links": "^8.4.6",
"@storybook/addon-themes": "^8.4.6",
"@storybook/blocks": "^8.4.6",
"@storybook/test": "^8.4.6",
"@storybook/vue3": "^8.4.6",
"@storybook/vue3-vite": "^8.4.6",
"chromatic": "^11.20.0",
"storybook": "^8.4.6"
}
}

View file

@ -27,7 +27,7 @@
"@types/markdown-it-emoji": "^2.0.2",
"@types/markdown-it-link-attributes": "^3.0.5",
"@types/sanitize-html": "^2.11.0",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue": "catalog:frontend",
"@vitest/coverage-v8": "catalog:frontend",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",

View file

@ -95,6 +95,7 @@
"@types/lodash-es": "^4.17.6",
"@types/luxon": "^3.2.0",
"@types/uuid": "catalog:",
"@vitejs/plugin-vue": "catalog:frontend",
"@vitest/coverage-v8": "catalog:frontend",
"miragejs": "^0.1.48",
"unplugin-icons": "^0.19.0",

View file

@ -191,30 +191,32 @@ const workflowMenuItems = computed<ActionDropdownItem[]>(() => {
disabled: !onWorkflowPage.value || isNewWorkflow.value,
});
actions.push({
id: WORKFLOW_MENU_ACTIONS.SWITCH_NODE_VIEW_VERSION,
...(nodeViewVersion.value === '2'
? nodeViewSwitcherDiscovered.value || isNewUser.value
? {}
: {
badge: locale.baseText('menuActions.badge.new'),
}
: nodeViewSwitcherDiscovered.value
? {
badge: locale.baseText('menuActions.badge.beta'),
badgeProps: {
theme: 'tertiary',
},
}
: {
badge: locale.baseText('menuActions.badge.new'),
}),
label:
nodeViewVersion.value === '2'
? locale.baseText('menuActions.switchToOldNodeViewVersion')
: locale.baseText('menuActions.switchToNewNodeViewVersion'),
disabled: !onWorkflowPage.value,
});
if (settingsStore.isCanvasV2Enabled) {
actions.push({
id: WORKFLOW_MENU_ACTIONS.SWITCH_NODE_VIEW_VERSION,
...(nodeViewVersion.value === '2'
? nodeViewSwitcherDiscovered.value || isNewUser.value
? {}
: {
badge: locale.baseText('menuActions.badge.new'),
}
: nodeViewSwitcherDiscovered.value
? {
badge: locale.baseText('menuActions.badge.beta'),
badgeProps: {
theme: 'tertiary',
},
}
: {
badge: locale.baseText('menuActions.badge.new'),
}),
label:
nodeViewVersion.value === '2'
? locale.baseText('menuActions.switchToOldNodeViewVersion')
: locale.baseText('menuActions.switchToNewNodeViewVersion'),
disabled: !onWorkflowPage.value,
});
}
if ((workflowPermissions.value.delete && !props.readOnly) || isNewWorkflow.value) {
actions.push({

View file

@ -16,6 +16,11 @@ describe('useNodeViewVersionSwitcher', () => {
const initialState = {
[STORES.WORKFLOWS]: {},
[STORES.NDV]: {},
[STORES.SETTINGS]: {
settings: {
betaFeatures: ['canvas_v2'],
},
},
};
beforeEach(() => {

View file

@ -3,15 +3,18 @@ import { useLocalStorage } from '@vueuse/core';
import { useTelemetry } from '@/composables/useTelemetry';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useNDVStore } from '@/stores/ndv.store';
import { useSettingsStore } from '@/stores/settings.store';
export function useNodeViewVersionSwitcher() {
const ndvStore = useNDVStore();
const workflowsStore = useWorkflowsStore();
const telemetry = useTelemetry();
const settingsStore = useSettingsStore();
const isNewUser = computed(() => workflowsStore.activeWorkflows.length === 0);
const nodeViewVersion = useLocalStorage('NodeView.version', '2');
const defaultVersion = settingsStore.isCanvasV2Enabled ? '2' : '1';
const nodeViewVersion = useLocalStorage('NodeView.version', defaultVersion);
const nodeViewVersionMigrated = useLocalStorage('NodeView.migrated', false);
function setNodeViewSwitcherDropdownOpened(visible: boolean) {
@ -36,6 +39,10 @@ export function useNodeViewVersionSwitcher() {
function switchNodeViewVersion() {
const toVersion = nodeViewVersion.value === '2' ? '1' : '2';
if (!nodeViewVersionMigrated.value) {
nodeViewVersionMigrated.value = true;
}
telemetry.track('User switched canvas version', {
to_version: toVersion,
});
@ -49,7 +56,6 @@ export function useNodeViewVersionSwitcher() {
}
switchNodeViewVersion();
nodeViewVersionMigrated.value = true;
}
return {

View file

@ -14,6 +14,8 @@ const App = {
};
const renderComponent = createComponentRenderer(App);
let settingsStore: ReturnType<typeof useSettingsStore>;
describe('router', () => {
let server: ReturnType<typeof setupServer>;
const initializeAuthenticatedFeaturesSpy = vi.spyOn(init, 'initializeAuthenticatedFeatures');
@ -28,6 +30,7 @@ describe('router', () => {
});
beforeEach(() => {
settingsStore = useSettingsStore();
initializeAuthenticatedFeaturesSpy.mockImplementation(async () => await Promise.resolve());
});
@ -114,7 +117,6 @@ describe('router', () => {
])(
'should resolve %s to %s with %s user permissions',
async (path, name, scopes) => {
const settingsStore = useSettingsStore();
const rbacStore = useRBACStore();
settingsStore.settings.communityNodesEnabled = true;
@ -126,4 +128,13 @@ describe('router', () => {
},
10000,
);
test.each([
[VIEWS.PERSONAL_SETTINGS, true],
[VIEWS.USAGE, false],
])('should redirect Settings to %s', async (name, hideUsagePage) => {
settingsStore.settings.hideUsagePage = hideUsagePage;
await router.push('/settings');
expect(router.currentRoute.value.name).toBe(name);
});
});

View file

@ -255,7 +255,6 @@ export const routes: RouteRecordRaw[] = [
},
{
path: '/workflow/:name/evaluation',
name: VIEWS.TEST_DEFINITION,
meta: {
keepWorkflowAlive: true,
middleware: ['authenticated'],
@ -483,7 +482,13 @@ export const routes: RouteRecordRaw[] = [
name: VIEWS.SETTINGS,
component: SettingsView,
props: true,
redirect: { name: VIEWS.USAGE },
redirect: () => {
const settingsStore = useSettingsStore();
if (settingsStore.settings.hideUsagePage) {
return { name: VIEWS.PERSONAL_SETTINGS };
}
return { name: VIEWS.USAGE };
},
children: [
{
path: 'usage',

View file

@ -272,13 +272,13 @@ async function initializeData() {
promises.push(externalSecretsStore.fetchAllSecrets());
}
if (nodeTypesStore.allNodeTypes.length === 0) {
promises.push(nodeTypesStore.getNodeTypes());
}
return promises;
})();
if (nodeTypesStore.allNodeTypes.length === 0) {
loadPromises.push(nodeTypesStore.getNodeTypes());
}
try {
await Promise.all(loadPromises);
} catch (error) {

View file

@ -50,7 +50,7 @@ const router = createRouter({
name: VIEWS.SETTINGS,
component: SettingsView,
props: true,
redirect: { name: VIEWS.USAGE },
redirect: { name: VIEWS.PERSONAL_SETTINGS },
children: settingsRouteChildren,
},
],

File diff suppressed because it is too large Load diff

View file

@ -32,13 +32,14 @@ catalog:
catalogs:
frontend:
'@vitest/coverage-v8': ^2.1.2
'@vitest/coverage-v8': ^2.1.6
'@vitejs/plugin-vue': ^5.2.1
'@sentry/vue': ^8.33.1
vite: ^5.4.8
vitest: ^2.1.2
vite: ^6.0.2
vitest: ^2.1.8
vitest-mock-extended: ^2.0.2
vue: ^3.5.11
vue-router: ^4.4.5
vue-tsc: ^2.1.6
vue: ^3.5.13
vue-router: ^4.5.0
vue-tsc: ^2.1.10
vue-markdown-render: ^2.2.1
highlight.js: ^11.8.0