This commit is contained in:
syuilo 2023-05-19 13:35:46 +09:00
parent 0c0ae6ff90
commit 95b9284e79
2 changed files with 24 additions and 25 deletions

View File

@ -1,9 +1,17 @@
<template> <template>
<MkStickyContainer> <MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32"> <MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init"> <FormSuspense :p="init">
none <div class="_gaps_s">
<MkSwitch v-model="enableChartsForRemoteUser">
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
</MkSwitch>
<MkSwitch v-model="enableChartsForFederatedInstances">
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
</MkSwitch>
</div>
</FormSuspense> </FormSuspense>
</MkSpacer> </MkSpacer>
</MkStickyContainer> </MkStickyContainer>
@ -17,13 +25,22 @@ import * as os from '@/os';
import { fetchInstance } from '@/instance'; import { fetchInstance } from '@/instance';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import MkSwitch from '@/components/MkSwitch.vue';
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
async function init() { async function init() {
await os.api('admin/meta'); const meta = await os.api('admin/meta');
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
} }
function save() { function save() {
os.apiWithDialog('admin/update-meta').then(() => { os.apiWithDialog('admin/update-meta', {
enableChartsForRemoteUser,
enableChartsForFederatedInstances,
}).then(() => {
fetchInstance(); fetchInstance();
}); });
} }

View File

@ -2,7 +2,7 @@
<div> <div>
<MkStickyContainer> <MkStickyContainer>
<template #header><XHeader :tabs="headerTabs"/></template> <template #header><XHeader :tabs="headerTabs"/></template>
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32"> <MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init"> <FormSuspense :p="init">
<div class="_gaps_m"> <div class="_gaps_m">
<MkInput v-model="name"> <MkInput v-model="name">
@ -13,7 +13,7 @@
<template #label>{{ i18n.ts.instanceDescription }}</template> <template #label>{{ i18n.ts.instanceDescription }}</template>
</MkTextarea> </MkTextarea>
<FormSplit :min-width="300"> <FormSplit :minWidth="300">
<MkInput v-model="maintainerName"> <MkInput v-model="maintainerName">
<template #label>{{ i18n.ts.maintainerName }}</template> <template #label>{{ i18n.ts.maintainerName }}</template>
</MkInput> </MkInput>
@ -29,18 +29,6 @@
<template #caption>{{ i18n.ts.pinnedUsersDescription }}</template> <template #caption>{{ i18n.ts.pinnedUsersDescription }}</template>
</MkTextarea> </MkTextarea>
<FormSection>
<div class="_gaps_s">
<MkSwitch v-model="enableChartsForRemoteUser">
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
</MkSwitch>
<MkSwitch v-model="enableChartsForFederatedInstances">
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
</MkSwitch>
</div>
</FormSection>
<FormSection> <FormSection>
<template #label>{{ i18n.ts.theme }}</template> <template #label>{{ i18n.ts.theme }}</template>
@ -128,7 +116,7 @@
</MkSpacer> </MkSpacer>
<template #footer> <template #footer>
<div :class="$style.footer"> <div :class="$style.footer">
<MkSpacer :content-max="700" :margin-min="16" :margin-max="16"> <MkSpacer :contentMax="700" :marginMin="16" :marginMax="16">
<MkButton primary rounded @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> <MkButton primary rounded @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
</MkSpacer> </MkSpacer>
</div> </div>
@ -166,8 +154,6 @@ let defaultDarkTheme: any = $ref(null);
let pinnedUsers: string = $ref(''); let pinnedUsers: string = $ref('');
let cacheRemoteFiles: boolean = $ref(false); let cacheRemoteFiles: boolean = $ref(false);
let enableServiceWorker: boolean = $ref(false); let enableServiceWorker: boolean = $ref(false);
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
let swPublicKey: any = $ref(null); let swPublicKey: any = $ref(null);
let swPrivateKey: any = $ref(null); let swPrivateKey: any = $ref(null);
let deeplAuthKey: string = $ref(''); let deeplAuthKey: string = $ref('');
@ -188,8 +174,6 @@ async function init() {
pinnedUsers = meta.pinnedUsers.join('\n'); pinnedUsers = meta.pinnedUsers.join('\n');
cacheRemoteFiles = meta.cacheRemoteFiles; cacheRemoteFiles = meta.cacheRemoteFiles;
enableServiceWorker = meta.enableServiceWorker; enableServiceWorker = meta.enableServiceWorker;
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
swPublicKey = meta.swPublickey; swPublicKey = meta.swPublickey;
swPrivateKey = meta.swPrivateKey; swPrivateKey = meta.swPrivateKey;
deeplAuthKey = meta.deeplAuthKey; deeplAuthKey = meta.deeplAuthKey;
@ -211,8 +195,6 @@ function save() {
pinnedUsers: pinnedUsers.split('\n'), pinnedUsers: pinnedUsers.split('\n'),
cacheRemoteFiles, cacheRemoteFiles,
enableServiceWorker, enableServiceWorker,
enableChartsForRemoteUser,
enableChartsForFederatedInstances,
swPublicKey, swPublicKey,
swPrivateKey, swPrivateKey,
deeplAuthKey, deeplAuthKey,