Skip to content

Commit

Permalink
fix: fix start_time format
Browse files Browse the repository at this point in the history
  • Loading branch information
zoubingwu committed May 17, 2022
1 parent a9b898e commit f0793b4
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions dm/ui/src/pages/migration/task/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,19 @@ const TaskList: React.FC = () => {
},
}

const handleRequest = (handler: (...args: any[]) => void, key: string) => {
const handleRequest = async (
handler: (...args: any[]) => void,
key: string
) => {
message.loading({ content: t('requesting'), key })
Promise.all(selectedSources.map(name => handler({ taskName: name }))).then(
res => {
if (res.some((r: any) => r?.error)) {
message.destroy(key)
} else {
message.success({ content: t('request success'), key })
}
}
)
try {
await Promise.all(
selectedSources.map(name => handler({ taskName: name }))
)
message.success({ content: t('request success'), key })
} catch (e) {
message.destroy(key)
}
}
const handleRequestWithConfirmModal = useCallback(
({ key, handler, title }) => {
Expand Down Expand Up @@ -346,14 +348,14 @@ const TaskList: React.FC = () => {

if (startTaskMethod === StartTaskMethod.WithParams) {
const formValues = form.getFieldsValue()
const date = formValues.start_time.toDate()
date.setMilliseconds(0)
extraPayload.startTaskRequest = {
start_time: date.toISOString(),
safe_mode_time_duration: formValues.safe_mode_time_duration,
start_time: formValues.start_time
.milliseconds(0)
.utc()
.format('YYYY-MM-DDTHH:mm:ss'),
safe_mode_time_duration: formValues.safe_mode_time_duration + 's',
}
}

handleRequest((payload: any) => {
const p = { ...payload, ...extraPayload }
startTask(p)
Expand Down

0 comments on commit f0793b4

Please sign in to comment.