Sharkey/packages/frontend/src/pages/admin/other-settings.vue

76 lines
2.2 KiB
Vue
Raw Normal View History

<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
2023-05-19 07:35:46 +03:00
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init">
2023-05-19 07:35:46 +03:00
<div class="_gaps_s">
<MkSwitch v-model="enableServerMachineStats">
<template #label>{{ i18n.ts.enableServerMachineStats }}</template>
</MkSwitch>
<MkSwitch v-model="enableIdenticonGeneration">
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
</MkSwitch>
2023-05-19 07:35:46 +03:00
<MkSwitch v-model="enableChartsForRemoteUser">
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
</MkSwitch>
<MkSwitch v-model="enableChartsForFederatedInstances">
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
</MkSwitch>
</div>
</FormSuspense>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { } from 'vue';
import XHeader from './_header_.vue';
2022-01-04 14:16:41 +02:00
import FormSuspense from '@/components/form/suspense.vue';
2021-11-11 19:02:25 +02:00
import * as os from '@/os';
import { fetchInstance } from '@/instance';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
2023-05-19 07:35:46 +03:00
import MkSwitch from '@/components/MkSwitch.vue';
let enableServerMachineStats: boolean = $ref(false);
let enableIdenticonGeneration: boolean = $ref(false);
2023-05-19 07:35:46 +03:00
let enableChartsForRemoteUser: boolean = $ref(false);
let enableChartsForFederatedInstances: boolean = $ref(false);
async function init() {
2023-05-19 07:35:46 +03:00
const meta = await os.api('admin/meta');
enableServerMachineStats = meta.enableServerMachineStats;
enableIdenticonGeneration = meta.enableIdenticonGeneration;
2023-05-19 07:35:46 +03:00
enableChartsForRemoteUser = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances = meta.enableChartsForFederatedInstances;
}
function save() {
2023-05-19 07:35:46 +03:00
os.apiWithDialog('admin/update-meta', {
enableServerMachineStats,
enableIdenticonGeneration,
2023-05-19 07:35:46 +03:00
enableChartsForRemoteUser,
enableChartsForFederatedInstances,
}).then(() => {
fetchInstance();
});
}
const headerActions = $computed(() => [{
asFullButton: true,
icon: 'ti ti-check',
text: i18n.ts.save,
handler: save,
}]);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts.other,
icon: 'ti ti-adjustments',
});
</script>