mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(editor): Fix default workflow settings (#11632)
This commit is contained in:
parent
74582290c0
commit
658568e270
|
@ -626,7 +626,6 @@ export type WorkflowCallerPolicyDefaultOption = 'any' | 'none' | 'workflowsFromA
|
||||||
|
|
||||||
export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
|
export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
|
||||||
errorWorkflow?: string;
|
errorWorkflow?: string;
|
||||||
saveManualExecutions?: boolean;
|
|
||||||
timezone?: string;
|
timezone?: string;
|
||||||
executionTimeout?: number;
|
executionTimeout?: number;
|
||||||
maxExecutionTimeout?: number;
|
maxExecutionTimeout?: number;
|
||||||
|
|
|
@ -63,8 +63,8 @@ export const defaultSettings: FrontendSettings = {
|
||||||
},
|
},
|
||||||
publicApi: { enabled: false, latestVersion: 0, path: '', swaggerUi: { enabled: false } },
|
publicApi: { enabled: false, latestVersion: 0, path: '', swaggerUi: { enabled: false } },
|
||||||
pushBackend: 'websocket',
|
pushBackend: 'websocket',
|
||||||
saveDataErrorExecution: 'DEFAULT',
|
saveDataErrorExecution: 'all',
|
||||||
saveDataSuccessExecution: 'DEFAULT',
|
saveDataSuccessExecution: 'all',
|
||||||
saveManualExecutions: false,
|
saveManualExecutions: false,
|
||||||
saveExecutionProgress: false,
|
saveExecutionProgress: false,
|
||||||
sso: {
|
sso: {
|
||||||
|
|
|
@ -145,4 +145,50 @@ describe('WorkflowSettingsVue', () => {
|
||||||
|
|
||||||
expect(getByTestId('workflow-caller-policy-workflow-ids')).toHaveValue(cleanedUpWorkflowList);
|
expect(getByTestId('workflow-caller-policy-workflow-ids')).toHaveValue(cleanedUpWorkflowList);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
['workflow-settings-save-failed-executions', 'Default - Save', () => {}],
|
||||||
|
[
|
||||||
|
'workflow-settings-save-failed-executions',
|
||||||
|
'Default - Do not save',
|
||||||
|
() => {
|
||||||
|
settingsStore.saveDataErrorExecution = 'none';
|
||||||
|
},
|
||||||
|
],
|
||||||
|
['workflow-settings-save-success-executions', 'Default - Save', () => {}],
|
||||||
|
[
|
||||||
|
'workflow-settings-save-success-executions',
|
||||||
|
'Default - Do not save',
|
||||||
|
() => {
|
||||||
|
settingsStore.saveDataSuccessExecution = 'none';
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'workflow-settings-save-manual-executions',
|
||||||
|
'Default - Save',
|
||||||
|
() => {
|
||||||
|
settingsStore.saveManualExecutions = true;
|
||||||
|
},
|
||||||
|
],
|
||||||
|
['workflow-settings-save-manual-executions', 'Default - Do not save', () => {}],
|
||||||
|
[
|
||||||
|
'workflow-settings-save-execution-progress',
|
||||||
|
'Default - Save',
|
||||||
|
() => {
|
||||||
|
settingsStore.saveDataProgressExecution = true;
|
||||||
|
},
|
||||||
|
],
|
||||||
|
['workflow-settings-save-execution-progress', 'Default - Do not save', () => {}],
|
||||||
|
])(
|
||||||
|
'should show %s dropdown correct default value as %s',
|
||||||
|
async (testId, optionText, storeSetter) => {
|
||||||
|
storeSetter();
|
||||||
|
const { getByTestId } = createComponent({ pinia });
|
||||||
|
await nextTick();
|
||||||
|
|
||||||
|
const dropdownItems = await getDropdownItems(getByTestId(testId));
|
||||||
|
|
||||||
|
expect(dropdownItems[0]).toHaveTextContent(optionText);
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,14 +70,14 @@ const helpTexts = computed(() => ({
|
||||||
workflowCallerPolicy: i18n.baseText('workflowSettings.helpTexts.workflowCallerPolicy'),
|
workflowCallerPolicy: i18n.baseText('workflowSettings.helpTexts.workflowCallerPolicy'),
|
||||||
workflowCallerIds: i18n.baseText('workflowSettings.helpTexts.workflowCallerIds'),
|
workflowCallerIds: i18n.baseText('workflowSettings.helpTexts.workflowCallerIds'),
|
||||||
}));
|
}));
|
||||||
const defaultValues = computed(() => ({
|
const defaultValues = ref({
|
||||||
timezone: 'America/New_York',
|
timezone: 'America/New_York',
|
||||||
saveDataErrorExecution: 'all',
|
saveDataErrorExecution: 'all',
|
||||||
saveDataSuccessExecution: 'all',
|
saveDataSuccessExecution: 'all',
|
||||||
saveExecutionProgress: false,
|
saveExecutionProgress: false,
|
||||||
saveManualExecutions: false,
|
saveManualExecutions: false,
|
||||||
workflowCallerPolicy: 'workflowsFromSameOwner',
|
workflowCallerPolicy: 'workflowsFromSameOwner',
|
||||||
}));
|
});
|
||||||
const readOnlyEnv = computed(() => sourceControlStore.preferences.branchReadOnly);
|
const readOnlyEnv = computed(() => sourceControlStore.preferences.branchReadOnly);
|
||||||
const workflowName = computed(() => workflowsStore.workflowName);
|
const workflowName = computed(() => workflowsStore.workflowName);
|
||||||
const workflowId = computed(() => workflowsStore.workflowId);
|
const workflowId = computed(() => workflowsStore.workflowId);
|
||||||
|
@ -145,8 +145,7 @@ const loadWorkflowCallerPolicyOptions = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadSaveDataErrorExecutionOptions = async () => {
|
const loadSaveDataErrorExecutionOptions = async () => {
|
||||||
saveDataErrorExecutionOptions.value.length = 0;
|
saveDataErrorExecutionOptions.value = [
|
||||||
saveDataErrorExecutionOptions.value.push.apply(saveDataErrorExecutionOptions.value, [
|
|
||||||
{
|
{
|
||||||
key: 'DEFAULT',
|
key: 'DEFAULT',
|
||||||
value: i18n.baseText('workflowSettings.saveDataErrorExecutionOptions.defaultSave', {
|
value: i18n.baseText('workflowSettings.saveDataErrorExecutionOptions.defaultSave', {
|
||||||
|
@ -166,12 +165,11 @@ const loadSaveDataErrorExecutionOptions = async () => {
|
||||||
key: 'none',
|
key: 'none',
|
||||||
value: i18n.baseText('workflowSettings.saveDataErrorExecutionOptions.doNotSave'),
|
value: i18n.baseText('workflowSettings.saveDataErrorExecutionOptions.doNotSave'),
|
||||||
},
|
},
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadSaveDataSuccessExecutionOptions = async () => {
|
const loadSaveDataSuccessExecutionOptions = async () => {
|
||||||
saveDataSuccessExecutionOptions.value.length = 0;
|
saveDataSuccessExecutionOptions.value = [
|
||||||
saveDataSuccessExecutionOptions.value.push.apply(saveDataSuccessExecutionOptions.value, [
|
|
||||||
{
|
{
|
||||||
key: 'DEFAULT',
|
key: 'DEFAULT',
|
||||||
value: i18n.baseText('workflowSettings.saveDataSuccessExecutionOptions.defaultSave', {
|
value: i18n.baseText('workflowSettings.saveDataSuccessExecutionOptions.defaultSave', {
|
||||||
|
@ -191,12 +189,11 @@ const loadSaveDataSuccessExecutionOptions = async () => {
|
||||||
key: 'none',
|
key: 'none',
|
||||||
value: i18n.baseText('workflowSettings.saveDataSuccessExecutionOptions.doNotSave'),
|
value: i18n.baseText('workflowSettings.saveDataSuccessExecutionOptions.doNotSave'),
|
||||||
},
|
},
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadSaveExecutionProgressOptions = async () => {
|
const loadSaveExecutionProgressOptions = async () => {
|
||||||
saveExecutionProgressOptions.value.length = 0;
|
saveExecutionProgressOptions.value = [
|
||||||
saveExecutionProgressOptions.value.push.apply(saveExecutionProgressOptions.value, [
|
|
||||||
{
|
{
|
||||||
key: 'DEFAULT',
|
key: 'DEFAULT',
|
||||||
value: i18n.baseText('workflowSettings.saveExecutionProgressOptions.defaultSave', {
|
value: i18n.baseText('workflowSettings.saveExecutionProgressOptions.defaultSave', {
|
||||||
|
@ -215,29 +212,30 @@ const loadSaveExecutionProgressOptions = async () => {
|
||||||
key: false,
|
key: false,
|
||||||
value: i18n.baseText('workflowSettings.saveExecutionProgressOptions.doNotSave'),
|
value: i18n.baseText('workflowSettings.saveExecutionProgressOptions.doNotSave'),
|
||||||
},
|
},
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadSaveManualOptions = async () => {
|
const loadSaveManualOptions = async () => {
|
||||||
saveManualOptions.value.length = 0;
|
saveManualOptions.value = [
|
||||||
saveManualOptions.value.push({
|
{
|
||||||
key: 'DEFAULT',
|
key: 'DEFAULT',
|
||||||
value: i18n.baseText('workflowSettings.saveManualOptions.defaultSave', {
|
value: i18n.baseText('workflowSettings.saveManualOptions.defaultSave', {
|
||||||
interpolate: {
|
interpolate: {
|
||||||
defaultValue: defaultValues.value.saveManualExecutions
|
defaultValue: defaultValues.value.saveManualExecutions
|
||||||
? i18n.baseText('workflowSettings.saveManualOptions.save')
|
? i18n.baseText('workflowSettings.saveManualOptions.save')
|
||||||
: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
},
|
||||||
saveManualOptions.value.push({
|
{
|
||||||
key: true,
|
key: true,
|
||||||
value: i18n.baseText('workflowSettings.saveManualOptions.save'),
|
value: i18n.baseText('workflowSettings.saveManualOptions.save'),
|
||||||
});
|
},
|
||||||
saveManualOptions.value.push({
|
{
|
||||||
key: false,
|
key: false,
|
||||||
value: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
value: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
||||||
});
|
},
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadTimezones = async () => {
|
const loadTimezones = async () => {
|
||||||
|
@ -400,6 +398,7 @@ onMounted(async () => {
|
||||||
defaultValues.value.saveDataErrorExecution = settingsStore.saveDataErrorExecution;
|
defaultValues.value.saveDataErrorExecution = settingsStore.saveDataErrorExecution;
|
||||||
defaultValues.value.saveDataSuccessExecution = settingsStore.saveDataSuccessExecution;
|
defaultValues.value.saveDataSuccessExecution = settingsStore.saveDataSuccessExecution;
|
||||||
defaultValues.value.saveManualExecutions = settingsStore.saveManualExecutions;
|
defaultValues.value.saveManualExecutions = settingsStore.saveManualExecutions;
|
||||||
|
defaultValues.value.saveExecutionProgress = settingsStore.saveDataProgressExecution;
|
||||||
defaultValues.value.timezone = rootStore.timezone;
|
defaultValues.value.timezone = rootStore.timezone;
|
||||||
defaultValues.value.workflowCallerPolicy = settingsStore.workflowCallerPolicyDefaultOption;
|
defaultValues.value.workflowCallerPolicy = settingsStore.workflowCallerPolicyDefaultOption;
|
||||||
|
|
||||||
|
@ -423,7 +422,7 @@ onMounted(async () => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const workflowSettingsData = deepCopy(workflowsStore.workflowSettings) as IWorkflowSettings;
|
const workflowSettingsData = deepCopy(workflowsStore.workflowSettings);
|
||||||
|
|
||||||
if (workflowSettingsData.timezone === undefined) {
|
if (workflowSettingsData.timezone === undefined) {
|
||||||
workflowSettingsData.timezone = 'DEFAULT';
|
workflowSettingsData.timezone = 'DEFAULT';
|
||||||
|
@ -438,7 +437,7 @@ onMounted(async () => {
|
||||||
workflowSettingsData.saveExecutionProgress = 'DEFAULT';
|
workflowSettingsData.saveExecutionProgress = 'DEFAULT';
|
||||||
}
|
}
|
||||||
if (workflowSettingsData.saveManualExecutions === undefined) {
|
if (workflowSettingsData.saveManualExecutions === undefined) {
|
||||||
workflowSettingsData.saveManualExecutions = defaultValues.value.saveManualExecutions;
|
workflowSettingsData.saveManualExecutions = 'DEFAULT';
|
||||||
}
|
}
|
||||||
if (workflowSettingsData.callerPolicy === undefined) {
|
if (workflowSettingsData.callerPolicy === undefined) {
|
||||||
workflowSettingsData.callerPolicy = defaultValues.value
|
workflowSettingsData.callerPolicy = defaultValues.value
|
||||||
|
|
Loading…
Reference in a new issue