Update task run to not display NaN seconds
parent
93c07f39a8
commit
aa7a65d81e
|
@ -490,9 +490,15 @@ export const taskImportSuccess = (): Notification => ({
|
||||||
})
|
})
|
||||||
|
|
||||||
export const taskRunSuccess = (): Notification => ({
|
export const taskRunSuccess = (): Notification => ({
|
||||||
|
...defaultErrorNotification,
|
||||||
|
duration: FIVE_SECONDS,
|
||||||
|
message: 'Task scheduled successfully',
|
||||||
|
})
|
||||||
|
|
||||||
|
export const taskRunFailed = (error: string): Notification => ({
|
||||||
...defaultSuccessNotification,
|
...defaultSuccessNotification,
|
||||||
duration: FIVE_SECONDS,
|
duration: FIVE_SECONDS,
|
||||||
message: 'Task ran successfully',
|
message: `Failed to run task: ${error}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const taskGetFailed = (error: string): Notification => ({
|
export const taskGetFailed = (error: string): Notification => ({
|
||||||
|
|
|
@ -501,6 +501,8 @@ export const runTask = (taskID: string) => async dispatch => {
|
||||||
await client.tasks.startRunByTaskID(taskID)
|
await client.tasks.startRunByTaskID(taskID)
|
||||||
dispatch(notify(taskRunSuccess()))
|
dispatch(notify(taskRunSuccess()))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const message = getErrorMessage(error)
|
||||||
|
dispatch(notify(copy.taskRunFailed(message)))
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,6 +560,9 @@ export const createTaskFromTemplate = (template: ITaskTemplate) => async (
|
||||||
export const runDuration = (finishedAt: Date, startedAt: Date): string => {
|
export const runDuration = (finishedAt: Date, startedAt: Date): string => {
|
||||||
let timeTag = 'seconds'
|
let timeTag = 'seconds'
|
||||||
|
|
||||||
|
if (isNaN(finishedAt.getTime()) || isNaN(startedAt.getTime())) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
let diff = (finishedAt.getTime() - startedAt.getTime()) / 1000
|
let diff = (finishedAt.getTime() - startedAt.getTime()) / 1000
|
||||||
|
|
||||||
if (diff > 60) {
|
if (diff > 60) {
|
||||||
|
|
Loading…
Reference in New Issue