mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-27 13:39:44 -08:00
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
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:
parent
5c76de324c
commit
72e6343964
|
@ -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'];
|
||||
}
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -16,6 +16,11 @@ describe('useNodeViewVersionSwitcher', () => {
|
|||
const initialState = {
|
||||
[STORES.WORKFLOWS]: {},
|
||||
[STORES.NDV]: {},
|
||||
[STORES.SETTINGS]: {
|
||||
settings: {
|
||||
betaFeatures: ['canvas_v2'],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue