mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-29 19:10:43 +08:00
feat(editor): Use number input component for time saved setting (#24331)
This commit is contained in:
@@ -240,7 +240,9 @@ describe('WorkflowSettingsVue', () => {
|
||||
expect(getByTestId('workflow-settings-time-saved-per-execution')).toBeVisible();
|
||||
});
|
||||
|
||||
const timeSavedPerExecutionInput = getByTestId('workflow-settings-time-saved-per-execution');
|
||||
const timeSavedPerExecutionInput = getByTestId(
|
||||
'workflow-settings-time-saved-per-execution',
|
||||
)?.querySelector('input[type="number"]');
|
||||
|
||||
await userEvent.type(timeSavedPerExecutionInput as Element, '10');
|
||||
expect(timeSavedPerExecutionInput).toHaveValue(10);
|
||||
@@ -262,7 +264,9 @@ describe('WorkflowSettingsVue', () => {
|
||||
expect(getByTestId('workflow-settings-time-saved-per-execution')).toBeVisible();
|
||||
});
|
||||
|
||||
const timeSavedPerExecutionInput = getByTestId('workflow-settings-time-saved-per-execution');
|
||||
const timeSavedPerExecutionInput = getByTestId(
|
||||
'workflow-settings-time-saved-per-execution',
|
||||
)?.querySelector('input[type="number"]');
|
||||
await waitFor(() => expect(timeSavedPerExecutionInput).toHaveValue(10));
|
||||
|
||||
await userEvent.clear(timeSavedPerExecutionInput as Element);
|
||||
@@ -287,7 +291,9 @@ describe('WorkflowSettingsVue', () => {
|
||||
expect(getByTestId('workflow-settings-time-saved-per-execution')).toBeVisible();
|
||||
});
|
||||
|
||||
const timeSavedPerExecutionInput = getByTestId('workflow-settings-time-saved-per-execution');
|
||||
const timeSavedPerExecutionInput = getByTestId(
|
||||
'workflow-settings-time-saved-per-execution',
|
||||
)?.querySelector('input[type="number"]');
|
||||
|
||||
expect(timeSavedPerExecutionInput).toBeDisabled();
|
||||
});
|
||||
@@ -310,7 +316,9 @@ describe('WorkflowSettingsVue', () => {
|
||||
expect(getByTestId('workflow-settings-time-saved-per-execution')).toBeVisible();
|
||||
});
|
||||
|
||||
const timeSavedPerExecutionInput = getByTestId('workflow-settings-time-saved-per-execution');
|
||||
const timeSavedPerExecutionInput = getByTestId(
|
||||
'workflow-settings-time-saved-per-execution',
|
||||
)?.querySelector('input[type="number"]');
|
||||
|
||||
expect(timeSavedPerExecutionInput).toBeDisabled();
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
N8nButton,
|
||||
N8nIcon,
|
||||
N8nInput,
|
||||
N8nInputNumber,
|
||||
N8nLink,
|
||||
N8nIconButton,
|
||||
N8nOption,
|
||||
@@ -1190,13 +1191,15 @@ onBeforeUnmount(() => {
|
||||
<ElRow v-if="workflowSettings.timeSavedMode === 'fixed'">
|
||||
<ElCol :span="14" :offset="10">
|
||||
<div :class="$style['time-saved-input']">
|
||||
<N8nInput
|
||||
<N8nInputNumber
|
||||
id="timeSavedPerExecution"
|
||||
v-model="workflowSettings.timeSavedPerExecution"
|
||||
controls-position="right"
|
||||
size="medium"
|
||||
:controls="true"
|
||||
:disabled="readOnlyEnv || !workflowPermissions.update"
|
||||
data-test-id="workflow-settings-time-saved-per-execution"
|
||||
type="number"
|
||||
min="0"
|
||||
:min="0"
|
||||
@update:model-value="updateTimeSavedPerExecution"
|
||||
/>
|
||||
<span>{{ i18n.baseText('workflowSettings.timeSavedPerExecution.hint') }}</span>
|
||||
@@ -1341,13 +1344,10 @@ onBeforeUnmount(() => {
|
||||
.time-saved-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing--2xs);
|
||||
|
||||
:global(.el-input) {
|
||||
width: var(--spacing--3xl);
|
||||
}
|
||||
|
||||
span {
|
||||
margin-left: var(--spacing--2xs);
|
||||
:global(.el-input-number) {
|
||||
width: var(--spacing--4xl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user