@@ -20,6 +20,7 @@ import { Input, Box, Spacer, HStack, Field, VStack, Flex, Text, Skeleton } from
20
20
import dayjs from "dayjs" ;
21
21
import { useEffect , useState } from "react" ;
22
22
import { useForm , Controller , useWatch } from "react-hook-form" ;
23
+ import { useTranslation } from "react-i18next" ;
23
24
24
25
import type { DAGResponse , DAGWithLatestDagRunsResponse , BackfillPostBody } from "openapi/requests/types.gen" ;
25
26
import { Button } from "src/components/ui" ;
@@ -29,7 +30,6 @@ import { useCreateBackfillDryRun } from "src/queries/useCreateBackfillDryRun";
29
30
import { useDagParams } from "src/queries/useDagParams" ;
30
31
import { useParamStore } from "src/queries/useParamStore" ;
31
32
import { useTogglePause } from "src/queries/useTogglePause" ;
32
- import { pluralize } from "src/utils" ;
33
33
34
34
import ConfigForm from "../ConfigForm" ;
35
35
import { DateTimeInput } from "../DateTimeInput" ;
@@ -47,6 +47,7 @@ const today = new Date().toISOString().slice(0, 16);
47
47
type BackfillFormProps = DagRunTriggerParams & Omit < BackfillPostBody , "dag_run_conf" > ;
48
48
49
49
const RunBackfillForm = ( { dag, onClose } : RunBackfillFormProps ) => {
50
+ const { t : translate } = useTranslation ( "components" ) ;
50
51
const [ errors , setErrors ] = useState < { conf ?: string ; date ?: unknown } > ( { } ) ;
51
52
const [ unpause , setUnpause ] = useState ( true ) ;
52
53
const [ formError , setFormError ] = useState ( false ) ;
@@ -67,7 +68,6 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
67
68
const values = useWatch < BackfillFormProps > ( {
68
69
control,
69
70
} ) ;
70
-
71
71
const { data, isPending : isPendingDryRun } = useCreateBackfillDryRun ( {
72
72
requestBody : {
73
73
requestBody : {
@@ -81,9 +81,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
81
81
} ,
82
82
} ,
83
83
} ) ;
84
-
85
84
const { mutate : togglePause } = useTogglePause ( { dagId : dag . dag_id } ) ;
86
-
87
85
const { createBackfill, dateValidationError, error, isPending } = useCreateBackfill ( {
88
86
onSuccessConfirm : onClose ,
89
87
} ) ;
@@ -141,13 +139,17 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
141
139
142
140
const inlineMessage = isPendingDryRun ? (
143
141
< Skeleton height = "20px" width = "100px" />
142
+ ) : affectedTasks . total_entries > 1 ? (
143
+ < Text color = "fg.success" fontSize = "sm" >
144
+ { translate ( "backfill.affectedOne" ) }
145
+ </ Text >
144
146
) : affectedTasks . total_entries > 0 ? (
145
147
< Text color = "fg.success" fontSize = "sm" >
146
- { pluralize ( "run ", affectedTasks . total_entries ) } will be triggered
148
+ { translate ( "backfill.affectedMultiple ", { count : affectedTasks . total_entries } ) }
147
149
</ Text >
148
150
) : (
149
151
< Text color = "fg.error" fontSize = "sm" fontWeight = "medium" >
150
- No runs matching selected criteria.
152
+ { translate ( "backfill.affectedNone" ) }
151
153
</ Text >
152
154
) ;
153
155
@@ -157,17 +159,17 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
157
159
< VStack alignItems = "stretch" gap = { 2 } pt = { 4 } >
158
160
< Box >
159
161
< Text fontSize = "md" fontWeight = "semibold" mb = { 3 } >
160
- Date Range
162
+ { translate ( "backfill.dateRange" ) }
161
163
</ Text >
162
164
< HStack alignItems = "flex-start" w = "full" >
163
165
< Controller
164
166
control = { control }
165
167
name = "from_date"
166
168
render = { ( { field } ) => (
167
169
< Field . Root invalid = { Boolean ( errors . date ) || dataIntervalInvalid } required >
168
- < Field . Label > From </ Field . Label >
170
+ < Field . Label > { translate ( "backfill.dateRangeFrom" ) } </ Field . Label >
169
171
< DateTimeInput { ...field } max = { today } onBlur = { resetDateError } size = "sm" />
170
- < Field . ErrorText > Start Date must be before the End Date </ Field . ErrorText >
172
+ < Field . ErrorText > { translate ( "backfill.errorStartDateBeforeEndDate" ) } </ Field . ErrorText >
171
173
</ Field . Root >
172
174
) }
173
175
/>
@@ -176,7 +178,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
176
178
name = "to_date"
177
179
render = { ( { field } ) => (
178
180
< Field . Root invalid = { Boolean ( errors . date ) || dataIntervalInvalid } required >
179
- < Field . Label > To </ Field . Label >
181
+ < Field . Label > { translate ( "backfill.dateRangeTo" ) } </ Field . Label >
180
182
< DateTimeInput { ...field } max = { today } onBlur = { resetDateError } size = "sm" />
181
183
</ Field . Root >
182
184
) }
@@ -196,7 +198,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
196
198
} }
197
199
>
198
200
< RadioCardLabel fontSize = "md" fontWeight = "semibold" mb = { 3 } >
199
- Reprocess Behaviour
201
+ { translate ( "backfill.reprocessBehavior" ) }
200
202
</ RadioCardLabel >
201
203
< HStack >
202
204
{ reprocessBehaviors . map ( ( item ) => (
@@ -226,7 +228,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
226
228
type = "number"
227
229
width = { 24 }
228
230
/>
229
- < Flex > Max Active Runs </ Flex >
231
+ < Flex > { translate ( "backfill.maxRuns" ) } </ Flex >
230
232
</ HStack >
231
233
) }
232
234
/>
@@ -236,7 +238,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
236
238
name = "run_backwards"
237
239
render = { ( { field } ) => (
238
240
< Checkbox checked = { field . value } colorPalette = "blue" onChange = { field . onChange } >
239
- Run Backwards
241
+ { translate ( "backfill.backwards" ) }
240
242
</ Checkbox >
241
243
) }
242
244
/>
@@ -249,7 +251,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
249
251
onChange = { ( ) => setUnpause ( ! unpause ) }
250
252
wordBreak = "break-all"
251
253
>
252
- Unpause { dag . dag_display_name } on trigger
254
+ { translate ( "backfill.unpause" , { dag_display_name : dag . dag_display_name } ) }
253
255
</ Checkbox >
254
256
< Spacer />
255
257
</ >
@@ -266,7 +268,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
266
268
< Box as = "footer" display = "flex" justifyContent = "flex-end" mt = { 4 } >
267
269
< HStack w = "full" >
268
270
< Spacer />
269
- < Button onClick = { ( ) => void handleSubmit ( onCancel ) ( ) } > Cancel </ Button >
271
+ < Button onClick = { ( ) => void handleSubmit ( onCancel ) ( ) } > { translate ( "common:modal.cancel" ) } </ Button >
270
272
< Button
271
273
colorPalette = "blue"
272
274
disabled = {
@@ -275,7 +277,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
275
277
loading = { isPending }
276
278
onClick = { ( ) => void handleSubmit ( onSubmit ) ( ) }
277
279
>
278
- Run Backfill
280
+ { translate ( "backfill.run" ) }
279
281
</ Button >
280
282
</ HStack >
281
283
</ Box >
0 commit comments