Sharkey/packages/frontend/src/pages/admin/performance.vue

221 lines
8.3 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
2023-05-19 13:35:46 +09:00
<MkSpacer :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="init">
2023-07-08 08:46:42 +09:00
<div class="_gaps">
<div class="_panel" style="padding: 16px;">
2024-09-22 16:16:50 +09:00
<MkSwitch v-model="enableServerMachineStats" @change="onChange_enableServerMachineStats">
2023-07-08 08:46:42 +09:00
<template #label>{{ i18n.ts.enableServerMachineStats }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-07-08 08:46:42 +09:00
<div class="_panel" style="padding: 16px;">
2024-09-22 16:16:50 +09:00
<MkSwitch v-model="enableIdenticonGeneration" @change="onChange_enableIdenticonGeneration">
2023-07-08 08:46:42 +09:00
<template #label>{{ i18n.ts.enableIdenticonGeneration }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-07-08 08:46:42 +09:00
<div class="_panel" style="padding: 16px;">
2024-09-22 16:16:50 +09:00
<MkSwitch v-model="enableChartsForRemoteUser" @change="onChange_enableChartsForRemoteUser">
2023-07-08 08:46:42 +09:00
<template #label>{{ i18n.ts.enableChartsForRemoteUser }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2023-05-19 13:35:46 +09:00
2023-07-08 08:46:42 +09:00
<div class="_panel" style="padding: 16px;">
2024-09-22 16:16:50 +09:00
<MkSwitch v-model="enableChartsForFederatedInstances" @change="onChange_enableChartsForFederatedInstances">
2023-07-08 08:46:42 +09:00
<template #label>{{ i18n.ts.enableChartsForFederatedInstances }}</template>
<template #caption>{{ i18n.ts.turnOffToImprovePerformance }}</template>
</MkSwitch>
</div>
2024-09-22 20:21:06 +09:00
<MkFolder :defaultOpen="true">
<template #icon><i class="ti ti-bolt"></i></template>
<template #label>Misskey® Fan-out Timeline Technology (FTT)</template>
<template v-if="enableFanoutTimeline" #suffix>Enabled</template>
<template v-else #suffix>Disabled</template>
2024-09-22 20:23:20 +09:00
<template v-if="isFttModified" #footer>
<MkButton primary rounded @click="saveFtt">{{ i18n.ts.save }}</MkButton>
2024-09-22 20:14:19 +09:00
</template>
<div class="_gaps_m">
2024-09-22 20:14:19 +09:00
<MkSwitch v-model="enableFanoutTimeline">
<template #label>{{ i18n.ts.enable }}</template>
2024-09-21 19:41:55 +09:00
<template #caption>
<div>{{ i18n.ts._serverSettings.fanoutTimelineDescription }}</div>
<div><MkLink target="_blank" url="https://misskey-hub.net/docs/for-admin/features/ftt/">{{ i18n.ts.details }}</MkLink></div>
</template>
</MkSwitch>
2024-09-22 20:14:19 +09:00
<MkSwitch v-model="enableFanoutTimelineDbFallback">
<template #label>{{ i18n.ts._serverSettings.fanoutTimelineDbFallback }}</template>
<template #caption>{{ i18n.ts._serverSettings.fanoutTimelineDbFallbackDescription }}</template>
</MkSwitch>
2024-09-22 20:14:19 +09:00
<MkInput v-model="perLocalUserUserTimelineCacheMax" type="number">
<template #label>perLocalUserUserTimelineCacheMax</template>
</MkInput>
2024-09-22 20:14:19 +09:00
<MkInput v-model="perRemoteUserUserTimelineCacheMax" type="number">
<template #label>perRemoteUserUserTimelineCacheMax</template>
</MkInput>
2024-09-22 20:14:19 +09:00
<MkInput v-model="perUserHomeTimelineCacheMax" type="number">
<template #label>perUserHomeTimelineCacheMax</template>
</MkInput>
2024-09-22 20:14:19 +09:00
<MkInput v-model="perUserListTimelineCacheMax" type="number">
<template #label>perUserListTimelineCacheMax</template>
</MkInput>
</div>
</MkFolder>
2024-09-22 20:21:06 +09:00
<MkFolder :defaultOpen="true">
<template #icon><i class="ti ti-bolt"></i></template>
2024-09-22 16:16:50 +09:00
<template #label>Misskey® Reactions Boost Technology (RBT)<span class="_beta">{{ i18n.ts.beta }}</span></template>
<template v-if="enableReactionsBuffering" #suffix>Enabled</template>
<template v-else #suffix>Disabled</template>
2024-09-22 20:23:20 +09:00
<template v-if="isRbtModified" #footer>
<MkButton primary rounded @click="saveRbt">{{ i18n.ts.save }}</MkButton>
2024-09-22 20:14:19 +09:00
</template>
<div class="_gaps_m">
2024-09-22 20:14:19 +09:00
<MkSwitch v-model="enableReactionsBuffering">
<template #label>{{ i18n.ts.enable }}</template>
<template #caption>{{ i18n.ts._serverSettings.reactionsBufferingDescription }}</template>
</MkSwitch>
</div>
</MkFolder>
2023-05-19 13:35:46 +09:00
</div>
</FormSuspense>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
2024-09-22 20:14:19 +09:00
import { ref, computed, watch } from 'vue';
import XHeader from './_header_.vue';
2022-01-04 21:16:41 +09:00
import FormSuspense from '@/components/form/suspense.vue';
2023-09-19 16:37:43 +09:00
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
2023-09-19 16:37:43 +09:00
import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
2023-05-19 13:35:46 +09:00
import MkSwitch from '@/components/MkSwitch.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkInput from '@/components/MkInput.vue';
2024-09-21 19:41:55 +09:00
import MkLink from '@/components/MkLink.vue';
2024-09-22 20:14:19 +09:00
import MkButton from '@/components/MkButton.vue';
2023-05-19 13:35:46 +09:00
const enableServerMachineStats = ref<boolean>(false);
const enableIdenticonGeneration = ref<boolean>(false);
const enableChartsForRemoteUser = ref<boolean>(false);
const enableChartsForFederatedInstances = ref<boolean>(false);
const enableFanoutTimeline = ref<boolean>(false);
const enableFanoutTimelineDbFallback = ref<boolean>(false);
const perLocalUserUserTimelineCacheMax = ref<number>(0);
const perRemoteUserUserTimelineCacheMax = ref<number>(0);
const perUserHomeTimelineCacheMax = ref<number>(0);
const perUserListTimelineCacheMax = ref<number>(0);
const enableReactionsBuffering = ref<boolean>(false);
2024-09-22 20:14:19 +09:00
const isFttModified = ref<boolean>(false);
const isRbtModified = ref<boolean>(false);
async function init() {
const meta = await misskeyApi('admin/meta');
enableServerMachineStats.value = meta.enableServerMachineStats;
enableIdenticonGeneration.value = meta.enableIdenticonGeneration;
enableChartsForRemoteUser.value = meta.enableChartsForRemoteUser;
enableChartsForFederatedInstances.value = meta.enableChartsForFederatedInstances;
enableFanoutTimeline.value = meta.enableFanoutTimeline;
enableFanoutTimelineDbFallback.value = meta.enableFanoutTimelineDbFallback;
perLocalUserUserTimelineCacheMax.value = meta.perLocalUserUserTimelineCacheMax;
perRemoteUserUserTimelineCacheMax.value = meta.perRemoteUserUserTimelineCacheMax;
perUserHomeTimelineCacheMax.value = meta.perUserHomeTimelineCacheMax;
perUserListTimelineCacheMax.value = meta.perUserListTimelineCacheMax;
enableReactionsBuffering.value = meta.enableReactionsBuffering;
2024-09-22 20:14:19 +09:00
watch([enableFanoutTimeline, enableFanoutTimelineDbFallback, perLocalUserUserTimelineCacheMax, perRemoteUserUserTimelineCacheMax, perUserHomeTimelineCacheMax, perUserListTimelineCacheMax], () => {
isFttModified.value = true;
});
watch(enableReactionsBuffering, () => {
isRbtModified.value = true;
});
}
2024-09-22 16:16:50 +09:00
function onChange_enableServerMachineStats(value: boolean) {
os.apiWithDialog('admin/update-meta', {
enableServerMachineStats: value,
}).then(() => {
fetchInstance(true);
});
}
function onChange_enableIdenticonGeneration(value: boolean) {
os.apiWithDialog('admin/update-meta', {
enableIdenticonGeneration: value,
}).then(() => {
fetchInstance(true);
});
}
function onChange_enableChartsForRemoteUser(value: boolean) {
os.apiWithDialog('admin/update-meta', {
enableChartsForRemoteUser: value,
}).then(() => {
fetchInstance(true);
});
}
function onChange_enableChartsForFederatedInstances(value: boolean) {
os.apiWithDialog('admin/update-meta', {
enableChartsForFederatedInstances: value,
}).then(() => {
fetchInstance(true);
});
}
2024-09-22 20:14:19 +09:00
function saveFtt() {
2023-05-19 13:35:46 +09:00
os.apiWithDialog('admin/update-meta', {
2024-09-22 20:14:19 +09:00
enableFanoutTimeline: enableFanoutTimeline.value,
enableFanoutTimelineDbFallback: enableFanoutTimelineDbFallback.value,
perLocalUserUserTimelineCacheMax: perLocalUserUserTimelineCacheMax.value,
perRemoteUserUserTimelineCacheMax: perRemoteUserUserTimelineCacheMax.value,
perUserHomeTimelineCacheMax: perUserHomeTimelineCacheMax.value,
perUserListTimelineCacheMax: perUserListTimelineCacheMax.value,
2023-05-19 13:35:46 +09:00
}).then(() => {
2024-09-22 20:14:19 +09:00
isFttModified.value = false;
fetchInstance(true);
});
}
2024-09-22 20:14:19 +09:00
function saveRbt() {
2024-09-22 16:16:50 +09:00
os.apiWithDialog('admin/update-meta', {
2024-09-22 20:14:19 +09:00
enableReactionsBuffering: enableReactionsBuffering.value,
2024-09-22 16:16:50 +09:00
}).then(() => {
2024-09-22 20:14:19 +09:00
isRbtModified.value = false;
2024-09-22 16:16:50 +09:00
fetchInstance(true);
});
}
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(() => ({
title: i18n.ts.other,
icon: 'ti ti-adjustments',
}));
</script>