fix(front): working remote channel search form
This commit is contained in:
parent
5a87995c36
commit
a55a0ac4e0
|
@ -12,8 +12,6 @@ import Layout from '~/components/ui/Layout.vue'
|
||||||
import Button from '~/components/ui/Button.vue'
|
import Button from '~/components/ui/Button.vue'
|
||||||
import Input from '~/components/ui/Input.vue'
|
import Input from '~/components/ui/Input.vue'
|
||||||
import Alert from '~/components/ui/Alert.vue'
|
import Alert from '~/components/ui/Alert.vue'
|
||||||
import Tabs from '~/components/ui/Tabs.vue'
|
|
||||||
import Tab from '~/components/ui/Tab.vue'
|
|
||||||
|
|
||||||
import updateQueryString from '~/composables/updateQueryString'
|
import updateQueryString from '~/composables/updateQueryString'
|
||||||
import useLogger from '~/composables/useLogger'
|
import useLogger from '~/composables/useLogger'
|
||||||
|
@ -172,69 +170,63 @@ watch(() => props.initialId, () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Alert red
|
<Layout stack
|
||||||
v-if="!isLoading && obj?.status === 'finished' && !redirectRoute"
|
|
||||||
>
|
|
||||||
{{ t('components.RemoteSearchForm.warning.unsupported') }}
|
|
||||||
</Alert>
|
|
||||||
<Alert red
|
|
||||||
v-if="errors.length > 0"
|
|
||||||
role="alert"
|
|
||||||
title="t('components.RemoteSearchForm.header.fetchFailed')"
|
|
||||||
>
|
|
||||||
<ul class="list">
|
|
||||||
<li
|
|
||||||
v-for="(error, key) in errors"
|
|
||||||
:key="key"
|
|
||||||
>
|
|
||||||
{{ error }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</Alert>
|
|
||||||
<Layout form
|
|
||||||
v-if="type === 'both'"
|
v-if="type === 'both'"
|
||||||
id="remote-search"
|
|
||||||
>
|
>
|
||||||
<Tabs
|
<Button
|
||||||
>
|
secondary
|
||||||
<Tab
|
raised
|
||||||
icon="bi-feed"
|
split
|
||||||
title="t('components.RemoteSearchForm.button.rss')"
|
round
|
||||||
|
icon="bi-rss-fill"
|
||||||
|
split-icon="bi-globe"
|
||||||
|
style="align-self: center;"
|
||||||
|
:split-title="t('components.RemoteSearchForm.button.fediverse')"
|
||||||
@click.prevent="type = 'rss'"
|
@click.prevent="type = 'rss'"
|
||||||
|
@split-click.prevent="type = 'artists'"
|
||||||
>
|
>
|
||||||
{{ t('components.RemoteSearchForm.description.rss') }}
|
{{ t('components.RemoteSearchForm.button.rss') }}
|
||||||
<Input
|
</Button>
|
||||||
id="object-id"
|
</Layout>
|
||||||
v-model="id"
|
|
||||||
type="text"
|
|
||||||
name="object-id"
|
|
||||||
:placeholder="labels.fieldPlaceholder"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</Tab>
|
|
||||||
<Tab
|
|
||||||
icon="bi-globe"
|
|
||||||
title="t('components.RemoteSearchForm.button.fediverse')"
|
|
||||||
@click.prevent="type = 'artists'"
|
|
||||||
>
|
|
||||||
{{ t('components.RemoteSearchForm.description.fediverse') }}
|
|
||||||
<Input
|
|
||||||
id="object-id"
|
|
||||||
v-model="id"
|
|
||||||
type="text"
|
|
||||||
name="object-id"
|
|
||||||
:placeholder="labels.fieldPlaceholder"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</Tab>
|
|
||||||
</Tabs>
|
|
||||||
</Layout>
|
|
||||||
<Layout form
|
<Layout form
|
||||||
v-else
|
v-else
|
||||||
id="remote-search"
|
id="remote-search"
|
||||||
:class="['ui', {loading: isLoading}, 'form']"
|
:class="['ui', {loading: isLoading}, 'form']"
|
||||||
@submit.stop.prevent="submit"
|
@submit.stop.prevent="submit"
|
||||||
>
|
>
|
||||||
|
<Alert red
|
||||||
|
v-if="errors.length > 0"
|
||||||
|
role="alert"
|
||||||
|
title="t('components.RemoteSearchForm.header.fetchFailed')"
|
||||||
|
>
|
||||||
|
<ul class="list" v-if="errors.length > 1">
|
||||||
|
<li
|
||||||
|
v-for="(error, key) in errors"
|
||||||
|
:key="key"
|
||||||
|
>
|
||||||
|
{{ error }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p v-else>{{ errors[0] }}</p>
|
||||||
|
</Alert>
|
||||||
|
<p v-if="type === 'rss'">
|
||||||
|
{{ t('components.RemoteSearchForm.description.rss') }}
|
||||||
|
</p>
|
||||||
|
<p v-else-if="type === 'artists'">
|
||||||
|
{{ t('components.RemoteSearchForm.description.fediverse') }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<Input
|
||||||
|
id="object-id"
|
||||||
|
v-model="id"
|
||||||
|
type="text"
|
||||||
|
name="object-id"
|
||||||
|
:label="labels.fieldLabel"
|
||||||
|
:placeholder="labels.fieldPlaceholder"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
v-if="showSubmit"
|
v-if="showSubmit"
|
||||||
primary
|
primary
|
||||||
|
@ -245,4 +237,9 @@ watch(() => props.initialId, () => {
|
||||||
{{ t('components.RemoteSearchForm.button.search') }}
|
{{ t('components.RemoteSearchForm.button.search') }}
|
||||||
</Button>
|
</Button>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
<Alert red
|
||||||
|
v-if="!isLoading && obj?.status === 'finished' && !redirectRoute"
|
||||||
|
>
|
||||||
|
{{ t('components.RemoteSearchForm.warning.unsupported') }}
|
||||||
|
</Alert>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue