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 {
|
||||
errorWorkflow?: string;
|
||||
saveManualExecutions?: boolean;
|
||||
timezone?: string;
|
||||
executionTimeout?: number;
|
||||
maxExecutionTimeout?: number;
|
||||
|
|
|
@ -63,8 +63,8 @@ export const defaultSettings: FrontendSettings = {
|
|||
},
|
||||
publicApi: { enabled: false, latestVersion: 0, path: '', swaggerUi: { enabled: false } },
|
||||
pushBackend: 'websocket',
|
||||
saveDataErrorExecution: 'DEFAULT',
|
||||
saveDataSuccessExecution: 'DEFAULT',
|
||||
saveDataErrorExecution: 'all',
|
||||
saveDataSuccessExecution: 'all',
|
||||
saveManualExecutions: false,
|
||||
saveExecutionProgress: false,
|
||||
sso: {
|
||||
|
|
|
@ -145,4 +145,50 @@ describe('WorkflowSettingsVue', () => {
|
|||
|
||||
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'),
|
||||
workflowCallerIds: i18n.baseText('workflowSettings.helpTexts.workflowCallerIds'),
|
||||
}));
|
||||
const defaultValues = computed(() => ({
|
||||
const defaultValues = ref({
|
||||
timezone: 'America/New_York',
|
||||
saveDataErrorExecution: 'all',
|
||||
saveDataSuccessExecution: 'all',
|
||||
saveExecutionProgress: false,
|
||||
saveManualExecutions: false,
|
||||
workflowCallerPolicy: 'workflowsFromSameOwner',
|
||||
}));
|
||||
});
|
||||
const readOnlyEnv = computed(() => sourceControlStore.preferences.branchReadOnly);
|
||||
const workflowName = computed(() => workflowsStore.workflowName);
|
||||
const workflowId = computed(() => workflowsStore.workflowId);
|
||||
|
@ -145,8 +145,7 @@ const loadWorkflowCallerPolicyOptions = async () => {
|
|||
};
|
||||
|
||||
const loadSaveDataErrorExecutionOptions = async () => {
|
||||
saveDataErrorExecutionOptions.value.length = 0;
|
||||
saveDataErrorExecutionOptions.value.push.apply(saveDataErrorExecutionOptions.value, [
|
||||
saveDataErrorExecutionOptions.value = [
|
||||
{
|
||||
key: 'DEFAULT',
|
||||
value: i18n.baseText('workflowSettings.saveDataErrorExecutionOptions.defaultSave', {
|
||||
|
@ -166,12 +165,11 @@ const loadSaveDataErrorExecutionOptions = async () => {
|
|||
key: 'none',
|
||||
value: i18n.baseText('workflowSettings.saveDataErrorExecutionOptions.doNotSave'),
|
||||
},
|
||||
]);
|
||||
];
|
||||
};
|
||||
|
||||
const loadSaveDataSuccessExecutionOptions = async () => {
|
||||
saveDataSuccessExecutionOptions.value.length = 0;
|
||||
saveDataSuccessExecutionOptions.value.push.apply(saveDataSuccessExecutionOptions.value, [
|
||||
saveDataSuccessExecutionOptions.value = [
|
||||
{
|
||||
key: 'DEFAULT',
|
||||
value: i18n.baseText('workflowSettings.saveDataSuccessExecutionOptions.defaultSave', {
|
||||
|
@ -191,12 +189,11 @@ const loadSaveDataSuccessExecutionOptions = async () => {
|
|||
key: 'none',
|
||||
value: i18n.baseText('workflowSettings.saveDataSuccessExecutionOptions.doNotSave'),
|
||||
},
|
||||
]);
|
||||
];
|
||||
};
|
||||
|
||||
const loadSaveExecutionProgressOptions = async () => {
|
||||
saveExecutionProgressOptions.value.length = 0;
|
||||
saveExecutionProgressOptions.value.push.apply(saveExecutionProgressOptions.value, [
|
||||
saveExecutionProgressOptions.value = [
|
||||
{
|
||||
key: 'DEFAULT',
|
||||
value: i18n.baseText('workflowSettings.saveExecutionProgressOptions.defaultSave', {
|
||||
|
@ -215,29 +212,30 @@ const loadSaveExecutionProgressOptions = async () => {
|
|||
key: false,
|
||||
value: i18n.baseText('workflowSettings.saveExecutionProgressOptions.doNotSave'),
|
||||
},
|
||||
]);
|
||||
];
|
||||
};
|
||||
|
||||
const loadSaveManualOptions = async () => {
|
||||
saveManualOptions.value.length = 0;
|
||||
saveManualOptions.value.push({
|
||||
key: 'DEFAULT',
|
||||
value: i18n.baseText('workflowSettings.saveManualOptions.defaultSave', {
|
||||
interpolate: {
|
||||
defaultValue: defaultValues.value.saveManualExecutions
|
||||
? i18n.baseText('workflowSettings.saveManualOptions.save')
|
||||
: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
||||
},
|
||||
}),
|
||||
});
|
||||
saveManualOptions.value.push({
|
||||
key: true,
|
||||
value: i18n.baseText('workflowSettings.saveManualOptions.save'),
|
||||
});
|
||||
saveManualOptions.value.push({
|
||||
key: false,
|
||||
value: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
||||
});
|
||||
saveManualOptions.value = [
|
||||
{
|
||||
key: 'DEFAULT',
|
||||
value: i18n.baseText('workflowSettings.saveManualOptions.defaultSave', {
|
||||
interpolate: {
|
||||
defaultValue: defaultValues.value.saveManualExecutions
|
||||
? i18n.baseText('workflowSettings.saveManualOptions.save')
|
||||
: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: true,
|
||||
value: i18n.baseText('workflowSettings.saveManualOptions.save'),
|
||||
},
|
||||
{
|
||||
key: false,
|
||||
value: i18n.baseText('workflowSettings.saveManualOptions.doNotSave'),
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
const loadTimezones = async () => {
|
||||
|
@ -400,6 +398,7 @@ onMounted(async () => {
|
|||
defaultValues.value.saveDataErrorExecution = settingsStore.saveDataErrorExecution;
|
||||
defaultValues.value.saveDataSuccessExecution = settingsStore.saveDataSuccessExecution;
|
||||
defaultValues.value.saveManualExecutions = settingsStore.saveManualExecutions;
|
||||
defaultValues.value.saveExecutionProgress = settingsStore.saveDataProgressExecution;
|
||||
defaultValues.value.timezone = rootStore.timezone;
|
||||
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) {
|
||||
workflowSettingsData.timezone = 'DEFAULT';
|
||||
|
@ -438,7 +437,7 @@ onMounted(async () => {
|
|||
workflowSettingsData.saveExecutionProgress = 'DEFAULT';
|
||||
}
|
||||
if (workflowSettingsData.saveManualExecutions === undefined) {
|
||||
workflowSettingsData.saveManualExecutions = defaultValues.value.saveManualExecutions;
|
||||
workflowSettingsData.saveManualExecutions = 'DEFAULT';
|
||||
}
|
||||
if (workflowSettingsData.callerPolicy === undefined) {
|
||||
workflowSettingsData.callerPolicy = defaultValues.value
|
||||
|
|
Loading…
Reference in a new issue