Fix automation error linking from apps page and improve automation fetching logic in automation history
This commit is contained in:
parent
395b4d7ad8
commit
183bf9a84a
|
@ -95,10 +95,9 @@
|
||||||
|
|
||||||
const goToAutomationError = appId => {
|
const goToAutomationError = appId => {
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
tab: "Automation History",
|
|
||||||
open: "error",
|
open: "error",
|
||||||
})
|
})
|
||||||
$goto(`../overview/${appId}?${params.toString()}`)
|
$goto(`../overview/${appId}/automation-history?${params.toString()}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorCount = errors => {
|
const errorCount = errors => {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
let automationId = null
|
let automationId = null
|
||||||
let status = null
|
let status = null
|
||||||
let timeRange = null
|
let timeRange = null
|
||||||
|
let loaded = false
|
||||||
|
|
||||||
$: licensePlan = $auth.user?.license?.plan
|
$: licensePlan = $auth.user?.license?.plan
|
||||||
$: app = $overview.selectedApp
|
$: app = $overview.selectedApp
|
||||||
|
@ -66,7 +67,16 @@
|
||||||
{ column: "status", component: StatusRenderer },
|
{ column: "status", component: StatusRenderer },
|
||||||
]
|
]
|
||||||
|
|
||||||
async function fetchLogs(automationId, status, page, timeRange) {
|
async function fetchLogs(
|
||||||
|
automationId,
|
||||||
|
status,
|
||||||
|
page,
|
||||||
|
timeRange,
|
||||||
|
force = false
|
||||||
|
) {
|
||||||
|
if (!force && !loaded) {
|
||||||
|
return
|
||||||
|
}
|
||||||
let startDate = null
|
let startDate = null
|
||||||
if (timeRange) {
|
if (timeRange) {
|
||||||
const [length, units] = timeRange.split("-")
|
const [length, units] = timeRange.split("-")
|
||||||
|
@ -118,19 +128,19 @@
|
||||||
await automationStore.actions.fetch()
|
await automationStore.actions.fetch()
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
const shouldOpen = params.get("open") === ERROR
|
const shouldOpen = params.get("open") === ERROR
|
||||||
// open with errors, open panel for latest
|
|
||||||
if (shouldOpen) {
|
if (shouldOpen) {
|
||||||
status = ERROR
|
status = ERROR
|
||||||
}
|
}
|
||||||
await automationStore.actions.fetch()
|
|
||||||
await fetchLogs(null, status)
|
|
||||||
if (shouldOpen) {
|
|
||||||
viewDetails({ detail: runHistory[0] })
|
|
||||||
}
|
|
||||||
automationOptions = []
|
automationOptions = []
|
||||||
for (let automation of $automationStore.automations) {
|
for (let automation of $automationStore.automations) {
|
||||||
automationOptions.push({ value: automation._id, label: automation.name })
|
automationOptions.push({ value: automation._id, label: automation.name })
|
||||||
}
|
}
|
||||||
|
await fetchLogs(automationId, status, 0, timeRange, true)
|
||||||
|
// Open the first automation info if one exists
|
||||||
|
if (shouldOpen && runHistory?.[0]) {
|
||||||
|
viewDetails({ detail: runHistory[0] })
|
||||||
|
}
|
||||||
|
loaded = true
|
||||||
})
|
})
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
|
|
Loading…
Reference in New Issue