chore(front): refactor plugin settings pages
This commit is contained in:
parent
274b89bcc9
commit
1779e66d4a
|
@ -7,6 +7,12 @@ import useMarkdown, { useMarkdownRaw } from '~/composables/useMarkdown'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
import Layout from '~/components/ui/Layout.vue'
|
||||||
|
import Input from '~/components/ui/Input.vue'
|
||||||
|
import Toggle from '~/components/ui/Toggle.vue'
|
||||||
|
import Alert from '~/components/ui/Alert.vue'
|
||||||
|
import Button from '~/components/ui/Button.vue'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
plugin: Plugin
|
plugin: Plugin
|
||||||
libraries: Library[]
|
libraries: Library[]
|
||||||
|
@ -56,8 +62,9 @@ const submitAndScan = async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<form
|
<Layout
|
||||||
:class="['ui segment form', {loading: isLoading}]"
|
form
|
||||||
|
:class="['ui form', {loading: isLoading}]"
|
||||||
@submit.prevent="submit"
|
@submit.prevent="submit"
|
||||||
>
|
>
|
||||||
<h3>{{ plugin.label }}</h3>
|
<h3>{{ plugin.label }}</h3>
|
||||||
|
@ -66,7 +73,6 @@ const submitAndScan = async () => {
|
||||||
:html="description"
|
:html="description"
|
||||||
/>
|
/>
|
||||||
<template v-if="plugin.homepage">
|
<template v-if="plugin.homepage">
|
||||||
<div class="ui small hidden divider" />
|
|
||||||
<a
|
<a
|
||||||
:href="plugin.homepage"
|
:href="plugin.homepage"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
@ -75,11 +81,9 @@ const submitAndScan = async () => {
|
||||||
{{ t('components.auth.Plugin.link.documentation') }}
|
{{ t('components.auth.Plugin.link.documentation') }}
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
<div class="ui clearing hidden divider" />
|
<Alert
|
||||||
<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.auth.Plugin.header.failure') }}
|
{{ t('components.auth.Plugin.header.failure') }}
|
||||||
|
@ -92,18 +96,14 @@ const submitAndScan = async () => {
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</Alert>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="ui toggle checkbox">
|
<Toggle
|
||||||
<input
|
|
||||||
:id="`${plugin.name}-enabled`"
|
|
||||||
v-model="enabled"
|
v-model="enabled"
|
||||||
type="checkbox"
|
big
|
||||||
>
|
:label="t('components.auth.Plugin.label.pluginEnabled')"
|
||||||
<label :for="`${plugin.name}-enabled`">{{ t('components.auth.Plugin.label.pluginEnabled') }}</label>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="ui clearing hidden divider" />
|
|
||||||
<div
|
<div
|
||||||
v-if="plugin.source"
|
v-if="plugin.source"
|
||||||
class="field"
|
class="field"
|
||||||
|
@ -134,12 +134,12 @@ const submitAndScan = async () => {
|
||||||
v-if="field.type === 'text'"
|
v-if="field.type === 'text'"
|
||||||
class="field"
|
class="field"
|
||||||
>
|
>
|
||||||
<label :for="`plugin-${field.name}`">{{ field.label || field.name }}</label>
|
<Input
|
||||||
<input
|
|
||||||
:id="`plugin-${field.name}`"
|
:id="`plugin-${field.name}`"
|
||||||
v-model="values[field.name]"
|
v-model="values[field.name]"
|
||||||
|
:label="field.label || field.name"
|
||||||
type="text"
|
type="text"
|
||||||
>
|
/>
|
||||||
<sanitized-html
|
<sanitized-html
|
||||||
v-if="field.help"
|
v-if="field.help"
|
||||||
:html="useMarkdownRaw(field.help)"
|
:html="useMarkdownRaw(field.help)"
|
||||||
|
@ -149,10 +149,10 @@ const submitAndScan = async () => {
|
||||||
v-if="field.type === 'long_text'"
|
v-if="field.type === 'long_text'"
|
||||||
class="field"
|
class="field"
|
||||||
>
|
>
|
||||||
<label :for="`plugin-${field.name}`">{{ field.label || field.name }}</label>
|
|
||||||
<textarea
|
<textarea
|
||||||
:id="`plugin-${field.name}`"
|
:id="`plugin-${field.name}`"
|
||||||
v-model="values[field.name]"
|
v-model="values[field.name]"
|
||||||
|
:label="field.label || field.name"
|
||||||
type="text"
|
type="text"
|
||||||
rows="5"
|
rows="5"
|
||||||
/>
|
/>
|
||||||
|
@ -165,12 +165,12 @@ const submitAndScan = async () => {
|
||||||
v-if="field.type === 'url'"
|
v-if="field.type === 'url'"
|
||||||
class="field"
|
class="field"
|
||||||
>
|
>
|
||||||
<label :for="`plugin-${field.name}`">{{ field.label || field.name }}</label>
|
<Input
|
||||||
<input
|
|
||||||
:id="`plugin-${field.name}`"
|
:id="`plugin-${field.name}`"
|
||||||
v-model="values[field.name]"
|
v-model="values[field.name]"
|
||||||
|
:label="field.label || field.name"
|
||||||
type="url"
|
type="url"
|
||||||
>
|
/>
|
||||||
<sanitized-html
|
<sanitized-html
|
||||||
v-if="field.help"
|
v-if="field.help"
|
||||||
:html="useMarkdownRaw(field.help)"
|
:html="useMarkdownRaw(field.help)"
|
||||||
|
@ -180,12 +180,12 @@ const submitAndScan = async () => {
|
||||||
v-if="field.type === 'password'"
|
v-if="field.type === 'password'"
|
||||||
class="field"
|
class="field"
|
||||||
>
|
>
|
||||||
<label :for="`plugin-${field.name}`">{{ field.label || field.name }}</label>
|
<Input
|
||||||
<input
|
|
||||||
:id="`plugin-${field.name}`"
|
:id="`plugin-${field.name}`"
|
||||||
v-model="values[field.name]"
|
v-model="values[field.name]"
|
||||||
type="password"
|
:label="field.label || field.name"
|
||||||
>
|
password
|
||||||
|
/>
|
||||||
<sanitized-html
|
<sanitized-html
|
||||||
v-if="field.help"
|
v-if="field.help"
|
||||||
:html="useMarkdownRaw(field.help)"
|
:html="useMarkdownRaw(field.help)"
|
||||||
|
@ -195,30 +195,27 @@ const submitAndScan = async () => {
|
||||||
v-if="field.type === 'boolean'"
|
v-if="field.type === 'boolean'"
|
||||||
class="field"
|
class="field"
|
||||||
>
|
>
|
||||||
<div class="ui toggle checkbox">
|
<Toggle
|
||||||
<input
|
|
||||||
:id="`plugin-${field.name}`"
|
|
||||||
v-model="values[field.name]"
|
v-model="values[field.name]"
|
||||||
type="checkbox"
|
:label="field.label || field.name"
|
||||||
>
|
/>
|
||||||
<label :for="`plugin-${field.name}`">{{ field.label || field.name }}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
:class="['ui', {'loading': isLoading}, 'right', 'floated', 'button']"
|
primary
|
||||||
|
:class="[{'loading': isLoading}]"
|
||||||
>
|
>
|
||||||
{{ t('components.auth.Plugin.button.save') }}
|
{{ t('components.auth.Plugin.button.save') }}
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
v-if="plugin.source"
|
v-if="plugin.source"
|
||||||
:class="['ui', {'loading': isLoading}, 'right', 'floated', 'button']"
|
primary
|
||||||
|
:class="[{'loading': isLoading}]"
|
||||||
@click.prevent="submitAndScan"
|
@click.prevent="submitAndScan"
|
||||||
>
|
>
|
||||||
{{ t('components.auth.Plugin.button.scan') }}
|
{{ t('components.auth.Plugin.button.scan') }}
|
||||||
</button>
|
</Button>
|
||||||
<div class="ui clearing hidden divider" />
|
</Layout>
|
||||||
</form>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -685,12 +685,14 @@ fetchOwnedApps()
|
||||||
<p>
|
<p>
|
||||||
{{ t('components.auth.Settings.description.plugins') }}
|
{{ t('components.auth.Settings.description.plugins') }}
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Link
|
||||||
primary
|
primary
|
||||||
|
solid
|
||||||
:to="{name: 'settings.plugins'}"
|
:to="{name: 'settings.plugins'}"
|
||||||
|
icon="bi-puzzle-fill"
|
||||||
>
|
>
|
||||||
{{ t('components.auth.Settings.link.managePlugins') }}
|
{{ t('components.auth.Settings.link.managePlugins') }}
|
||||||
</Button>
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
<section class="ui text container">
|
<section class="ui text container">
|
||||||
<div class="ui hidden divider" />
|
<div class="ui hidden divider" />
|
||||||
|
|
|
@ -6,6 +6,8 @@ import axios from 'axios'
|
||||||
|
|
||||||
import PluginForm from '~/components/auth/Plugin.vue'
|
import PluginForm from '~/components/auth/Plugin.vue'
|
||||||
|
|
||||||
|
import Layout from '~/components/ui/Layout.vue'
|
||||||
|
|
||||||
import useErrorHandler from '~/composables/useErrorHandler'
|
import useErrorHandler from '~/composables/useErrorHandler'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
@ -39,12 +41,11 @@ fetchData()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main
|
<Layout
|
||||||
v-title="labels.title"
|
v-title="labels.title"
|
||||||
class="main"
|
main
|
||||||
|
stack
|
||||||
>
|
>
|
||||||
<section class="ui vertical stripe segment">
|
|
||||||
<div class="ui small text container">
|
|
||||||
<h2>{{ labels.title }}</h2>
|
<h2>{{ labels.title }}</h2>
|
||||||
<div
|
<div
|
||||||
v-if="isLoading"
|
v-if="isLoading"
|
||||||
|
@ -62,7 +63,5 @@ fetchData()
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<empty-state v-else />
|
<empty-state v-else />
|
||||||
</div>
|
</Layout>
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue