forked from coracle/flotilla
Fix thunk status detail message
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
import {PublishStatus} from "@welshman/net"
|
import {PublishStatus} from "@welshman/net"
|
||||||
import {mergeThunks, publishThunk} from "@welshman/app"
|
import {mergeThunks, publishThunk} from "@welshman/app"
|
||||||
import type {Thunk, MergedThunk} from "@welshman/app"
|
import type {Thunk, MergedThunk} from "@welshman/app"
|
||||||
|
import {throttled} from "@welshman/store"
|
||||||
import Icon from '@lib/components/Icon.svelte'
|
import Icon from '@lib/components/Icon.svelte'
|
||||||
import Tippy from "@lib/components/Tippy.svelte"
|
import Tippy from "@lib/components/Tippy.svelte"
|
||||||
import Button from '@lib/components/Button.svelte'
|
import Button from '@lib/components/Button.svelte'
|
||||||
@@ -20,12 +21,11 @@
|
|||||||
: publishThunk((thunk as Thunk).request)
|
: publishThunk((thunk as Thunk).request)
|
||||||
}
|
}
|
||||||
|
|
||||||
$: status = thunk.status
|
$: status = throttled(300, thunk.status)
|
||||||
$: ps = Object.values($status)
|
$: ps = Object.values($status)
|
||||||
$: canCancel = ps.length === 0
|
$: canCancel = ps.length === 0
|
||||||
$: isPending = ps.some(s => s.status === Pending)
|
|
||||||
$: isSuccess = ps.some(s => s.status === Success)
|
|
||||||
$: isFailure = !canCancel && ps.every(s => [Failure, Timeout].includes(s.status))
|
$: isFailure = !canCancel && ps.every(s => [Failure, Timeout].includes(s.status))
|
||||||
|
$: isPending = !isFailure && ps.some(s => s.status === Pending)
|
||||||
$: failure = Object.entries($status).find(([url, s]) => [Failure, Timeout].includes(s.status))
|
$: failure = Object.entries($status).find(([url, s]) => [Failure, Timeout].includes(s.status))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,19 @@
|
|||||||
import {displayRelayUrl} from '@welshman/util'
|
import {displayRelayUrl} from '@welshman/util'
|
||||||
import Button from '@lib/components/Button.svelte'
|
import Button from '@lib/components/Button.svelte'
|
||||||
|
|
||||||
export let url
|
export let url: string
|
||||||
export let status
|
export let status: string
|
||||||
export let message
|
export let message: string
|
||||||
export let retry
|
export let retry: () => void
|
||||||
|
|
||||||
if (!message && status === PublishStatus.Timeout) {
|
$: {
|
||||||
message = "request timed out"
|
if (!message && status === PublishStatus.Timeout) {
|
||||||
|
message = "request timed out"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
|
message = "no details recieved"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user