fix(front): admin channel detail fetch button
This commit is contained in:
parent
8cd951ad78
commit
56d2242674
|
@ -9,6 +9,8 @@ import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import Modal from '~/components/ui/Modal.vue'
|
import Modal from '~/components/ui/Modal.vue'
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
|
import Alert from '~/components/ui/Alert.vue'
|
||||||
|
import Loader from '~/components/ui/Loader.vue'
|
||||||
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
@ -43,14 +45,14 @@ const fetch = async () => {
|
||||||
data.value = undefined
|
data.value = undefined
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(props.url)
|
const response = await axios.get(props.url)
|
||||||
data.value = response.data
|
data.value = response.data
|
||||||
startPolling()
|
startPolling()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errors.value = (error as BackendError).backendErrors
|
errors.value = (error as BackendError).backendErrors
|
||||||
}
|
} finally {
|
||||||
|
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const poll = async () => {
|
const poll = async () => {
|
||||||
|
@ -104,9 +106,9 @@ const { start: startPolling } = useTimeoutFn(poll, 1000, { immediate: false })
|
||||||
{{ t('components.federation.FetchButton.description.skipped') }}
|
{{ t('components.federation.FetchButton.description.skipped') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<Alert
|
||||||
v-else-if="data.status === 'finished'"
|
v-else-if="data.status === 'finished'"
|
||||||
class="ui success message"
|
green
|
||||||
>
|
>
|
||||||
<h4 class="header">
|
<h4 class="header">
|
||||||
{{ t('components.federation.FetchButton.header.success') }}
|
{{ t('components.federation.FetchButton.header.success') }}
|
||||||
|
@ -114,10 +116,10 @@ const { start: startPolling } = useTimeoutFn(poll, 1000, { immediate: false })
|
||||||
<p>
|
<p>
|
||||||
{{ t('components.federation.FetchButton.description.success') }}
|
{{ t('components.federation.FetchButton.description.success') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</Alert>
|
||||||
<div
|
<Alert
|
||||||
v-else-if="data.status === 'errored'"
|
v-else-if="data.status === 'errored'"
|
||||||
class="ui error message"
|
red
|
||||||
>
|
>
|
||||||
<h4 class="header">
|
<h4 class="header">
|
||||||
{{ t('components.federation.FetchButton.header.failure') }}
|
{{ t('components.federation.FetchButton.header.failure') }}
|
||||||
|
@ -168,28 +170,14 @@ const { start: startPolling } = useTimeoutFn(poll, 1000, { immediate: false })
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</Alert>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<Loader
|
||||||
v-else-if="isLoading"
|
v-else-if="isLoading || isPolling"
|
||||||
class="ui active inverted dimmer"
|
/>
|
||||||
>
|
<Alert
|
||||||
<div class="ui text loader">
|
|
||||||
{{ t('components.federation.FetchButton.loader.fetchRequest') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-else-if="isPolling"
|
|
||||||
class="ui active inverted dimmer"
|
|
||||||
>
|
|
||||||
<div class="ui text loader">
|
|
||||||
{{ t('components.federation.FetchButton.loader.awaitingResult') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="errors.length > 0"
|
v-if="errors.length > 0"
|
||||||
role="alert"
|
red
|
||||||
class="ui negative message"
|
|
||||||
>
|
>
|
||||||
<h4 class="header">
|
<h4 class="header">
|
||||||
{{ t('components.federation.FetchButton.header.saveFailure') }}
|
{{ t('components.federation.FetchButton.header.saveFailure') }}
|
||||||
|
@ -202,11 +190,10 @@ const { start: startPolling } = useTimeoutFn(poll, 1000, { immediate: false })
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</Alert>
|
||||||
<div
|
<Alert
|
||||||
v-else-if="data && data.status === 'pending' && pollsCount >= MAX_POLLS"
|
v-else-if="data && data.status === 'pending' && pollsCount >= MAX_POLLS"
|
||||||
role="alert"
|
yellow
|
||||||
class="ui warning message"
|
|
||||||
>
|
>
|
||||||
<h4 class="header">
|
<h4 class="header">
|
||||||
{{ t('components.federation.FetchButton.header.pending') }}
|
{{ t('components.federation.FetchButton.header.pending') }}
|
||||||
|
@ -214,16 +201,17 @@ const { start: startPolling } = useTimeoutFn(poll, 1000, { immediate: false })
|
||||||
<p>
|
<p>
|
||||||
{{ t('components.federation.FetchButton.description.pending') }}
|
{{ t('components.federation.FetchButton.description.pending') }}
|
||||||
</p>
|
</p>
|
||||||
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<template #actions>
|
||||||
<div class="actions">
|
|
||||||
<Button
|
<Button
|
||||||
v-if="data && data.status === 'finished'"
|
v-if="data && data.status === 'finished'"
|
||||||
|
primary
|
||||||
@click.prevent="showModal = false; emit('refresh')"
|
@click.prevent="showModal = false; emit('refresh')"
|
||||||
>
|
>
|
||||||
{{ t('components.federation.FetchButton.button.reload') }}
|
{{ t('components.federation.FetchButton.button.reload') }}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</template>
|
||||||
</Modal>
|
</Modal>
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -146,7 +146,7 @@ const getQuery = (field: string, value: string) => `${field}:"${value}"`
|
||||||
<fetch-button
|
<fetch-button
|
||||||
v-if="!channel?.actor?.is_local"
|
v-if="!channel?.actor?.is_local"
|
||||||
class="basic item"
|
class="basic item"
|
||||||
:url="`channels/${channel?.uuid}/fetches/`"
|
:url="`federation/fetches/${channel?.id}/`"
|
||||||
@refresh="fetchData"
|
@refresh="fetchData"
|
||||||
>
|
>
|
||||||
<i class="refresh icon" />
|
<i class="refresh icon" />
|
||||||
|
|
Loading…
Reference in New Issue