feat: Enable canvas v2 only if beta feature enabled (no-changelog) (#12049)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions

This commit is contained in:
Alex Grozav 2024-12-04 21:33:35 +02:00 committed by GitHub
parent 5c76de324c
commit 72e6343964
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 26 deletions

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

@ -191,6 +191,7 @@ const workflowMenuItems = computed<ActionDropdownItem[]>(() => {
disabled: !onWorkflowPage.value || isNewWorkflow.value,
});
if (settingsStore.isCanvasV2Enabled) {
actions.push({
id: WORKFLOW_MENU_ACTIONS.SWITCH_NODE_VIEW_VERSION,
...(nodeViewVersion.value === '2'
@ -215,6 +216,7 @@ const workflowMenuItems = computed<ActionDropdownItem[]>(() => {
: 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) {