Improve usability

This commit is contained in:
syuilo 2021-04-23 14:43:40 +09:00
parent bc074abeba
commit e1e5283963
2 changed files with 14 additions and 7 deletions

View file

@ -738,6 +738,9 @@ user: "ユーザー"
administration: "管理" administration: "管理"
accounts: "アカウント" accounts: "アカウント"
switch: "切り替え" switch: "切り替え"
noMaintainerInformationWarning: "管理者情報が設定されていません。"
noBotProtectionWarning: "Bot防御が設定されていません。"
configure: "設定する"
_email: _email:
_follow: _follow:

View file

@ -1,6 +1,9 @@
<template> <template>
<FormBase> <FormBase>
<FormSuspense :p="init"> <FormSuspense :p="init">
<FormInfo v-if="noMaintainerInformation" warn>{{ $ts.noMaintainerInformationWarning }} <MkA to="/instance/settings" class="_link">{{ $ts.configure }}</MkA></FormInfo>
<FormInfo v-if="noBotProtection" warn>{{ $ts.noBotProtectionWarning }} <MkA to="/instance/bot-protection" class="_link">{{ $ts.configure }}</MkA></FormInfo>
<FormSuspense :p="fetchStats" v-slot="{ result: stats }"> <FormSuspense :p="fetchStats" v-slot="{ result: stats }">
<FormGroup> <FormGroup>
<FormKeyValueView> <FormKeyValueView>
@ -44,7 +47,6 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, markRaw } from 'vue'; import { computed, defineComponent, markRaw } from 'vue';
import VueJsonPretty from 'vue-json-pretty';
import FormKeyValueView from '@client/components/form/key-value-view.vue'; import FormKeyValueView from '@client/components/form/key-value-view.vue';
import FormInput from '@client/components/form/input.vue'; import FormInput from '@client/components/form/input.vue';
import FormButton from '@client/components/form/button.vue'; import FormButton from '@client/components/form/button.vue';
@ -72,15 +74,10 @@ export default defineComponent({
FormBase, FormBase,
FormSuspense, FormSuspense,
FormGroup, FormGroup,
FormInfo,
FormKeyValueView, FormKeyValueView,
MkInstanceStats, MkInstanceStats,
MkButton,
MkSelect,
MkInput,
MkContainer,
MkFolder,
XMetrics, XMetrics,
VueJsonPretty,
}, },
emits: ['info'], emits: ['info'],
@ -99,6 +96,8 @@ export default defineComponent({
fetchServerInfo: () => os.api('admin/server-info', {}), fetchServerInfo: () => os.api('admin/server-info', {}),
fetchJobs: () => os.api('admin/queue/deliver-delayed', {}), fetchJobs: () => os.api('admin/queue/deliver-delayed', {}),
fetchModLogs: () => os.api('admin/show-moderation-logs', {}), fetchModLogs: () => os.api('admin/show-moderation-logs', {}),
noMaintainerInformation: false,
noBotProtection: false,
} }
}, },
@ -109,6 +108,11 @@ export default defineComponent({
methods: { methods: {
async init() { async init() {
this.meta = await os.api('meta', { detail: true }); this.meta = await os.api('meta', { detail: true });
const isEmpty = (x: any) => x == null || x == '';
this.noMaintainerInformation = isEmpty(this.meta.maintainerName) || isEmpty(this.meta.maintainerEmail);
this.noBotProtection = !this.meta.enableHcaptcha && !this.meta.enableRecaptcha;
}, },
async showInstanceInfo(q) { async showInstanceInfo(q) {