remove hub specific errors

This commit is contained in:
Ruben Fiszel
2023-10-21 14:07:49 +02:00
parent 00de758190
commit f15dd72d86
3 changed files with 22 additions and 13 deletions
@@ -126,7 +126,6 @@
})
if (!deepEqual(job, newJob)) {
job = newJob
console.log('LOAD')
job?.flow_status && updateStatus(job?.flow_status)
dispatch('jobsLoaded', job)
}
@@ -191,7 +190,6 @@
parent_module: mod['parent_module']
}
$durationStatuses[mod.id][job.id] = { started_at }
console.log('A', started_at)
} else {
$flowModuleStates[mod.id] = {
args: job.args,
@@ -206,7 +204,6 @@
// retries: $flowStateStore?.raw_flow
}
$durationStatuses[mod.id][job.id] = { started_at, duration_ms: job['duration_ms'] }
console.log('B', started_at)
}
}
}
@@ -392,7 +389,6 @@
}
$durationStatuses[modId][job_id] = { started_at }
console.log('C', started_at)
} else {
$flowModuleStates[modId] = {
started_at,
@@ -407,7 +403,6 @@
duration_ms: e.detail.duration_ms,
isListJob: true
}
console.log('D', started_at)
$durationStatuses[modId][job_id] = {
started_at,
duration_ms: e.detail.duration_ms
@@ -532,6 +527,7 @@
</Tabs>
{#if rightColumnSelect == 'timeline'}
<FlowTimeline
flowDone={job?.['success'] != undefined}
bind:this={flowTimeline}
flowModules={dfs(job.raw_flow?.modules ?? [], (x) => x.id)}
durationStatuses={$durationStatuses}
@@ -10,6 +10,7 @@
string,
Record<string, { started_at?: number; duration_ms?: number }>
>
export let flowDone = false
let min: undefined | number = undefined
let max: undefined | number = undefined
@@ -20,7 +21,7 @@
| undefined = undefined
let debounced = debounce(() => computeItems(durationStatuses), 30)
$: durationStatuses && debounced()
$: flowDone != undefined && durationStatuses && debounced()
export function reset() {
min = undefined
@@ -48,9 +49,10 @@
nmin = Math.min(nmin, v.started_at)
}
}
if (v.duration_ms == undefined) {
if (!flowDone && v.duration_ms == undefined) {
isStillRunning = true
}
if (!isStillRunning) {
if (v.started_at && v.duration_ms) {
let lmax = v.started_at + v.duration_ms
@@ -77,9 +79,10 @@
})
items = nitems
min = nmin
max = isStillRunning || cnt < flowModules.length ? undefined : nmax
max = isStillRunning || (cnt < flowModules.length && !flowDone) ? undefined : nmax
if (max && min) {
total = max - min
total = Math.max(total, 2000)
}
}
@@ -1,7 +1,7 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { Badge, Skeleton } from '$lib/components/common'
import { capitalize, classNames, sendUserToast } from '$lib/utils'
import { Alert, Badge, Skeleton } from '$lib/components/common'
import { capitalize, classNames } from '$lib/utils'
import NoItemFound from '$lib/components/home/NoItemFound.svelte'
import { APP_TO_ICON_COMPONENT } from '$lib/components/icons'
import ListFilters from '$lib/components/home/ListFilters.svelte'
@@ -13,6 +13,7 @@
export let syncQuery = false
let loading = false
let hubNotAvailable = false
const dispatch = createEventDispatcher()
@@ -37,13 +38,16 @@
async function getAllApps(filterKind: typeof kind) {
try {
hubNotAvailable = false
allApps = (
await IntegrationService.listHubIntegrations({
kind: filterKind
})
).map((x) => x.name)
} catch (err) {
sendUserToast(err.message, true)
console.error('Hub is not available')
allApps = []
hubNotAvailable = true
}
}
@@ -55,6 +59,7 @@
) {
try {
loading = true
hubNotAvailable = false
const ts = Date.now()
startTs = ts
await new Promise((r) => setTimeout(r, 100))
@@ -92,7 +97,9 @@
})
)
} catch (err) {
sendUserToast(err.message, true)
hubNotAvailable = true
console.error('Hub not available')
loading = false
}
}
</script>
@@ -112,7 +119,10 @@
</div>
</div>
{#if items.length > 0 && apps.length > 0}
{#if hubNotAvailable}
<div class="mt-2" />
<Alert type="error" title="Hub not available" />
{:else if items.length > 0 && apps.length > 0}
<ListFilters {syncQuery} filters={apps} bind:selectedFilter={appFilter} resourceType />
{#if items.length == 0}
<NoItemFound />