2023-05-13 15:41:36 +02:00
|
|
|
<template>
|
|
|
|
<MkStickyContainer>
|
2023-05-13 16:04:24 +02:00
|
|
|
<template #header
|
|
|
|
><MkPageHeader
|
|
|
|
:actions="headerActions"
|
|
|
|
:tabs="headerTabs"
|
|
|
|
:display-back-button="true"
|
|
|
|
/></template>
|
|
|
|
<MkSpacer :content-max="700" :margin-min="16" :margin-max="32">
|
|
|
|
<FormSuspense :p="init">
|
2023-05-26 07:05:43 +02:00
|
|
|
<FormSwitch
|
|
|
|
v-model="enablePostImports"
|
|
|
|
@update:modelValue="save"
|
|
|
|
class="_formBlock"
|
|
|
|
>
|
|
|
|
<template #label>
|
2023-05-26 07:24:46 +02:00
|
|
|
<i class="ph-download-simple ph-bold ph-lg"></i>
|
2023-05-26 07:05:43 +02:00
|
|
|
{{ i18n.ts._experiments.enablePostImports }}
|
|
|
|
</template>
|
|
|
|
<template #caption>{{
|
|
|
|
i18n.ts._experiments.postImportsCaption
|
|
|
|
}}</template>
|
|
|
|
</FormSwitch>
|
2023-05-13 16:04:24 +02:00
|
|
|
</FormSuspense>
|
|
|
|
</MkSpacer>
|
2023-05-13 15:41:36 +02:00
|
|
|
</MkStickyContainer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import {} from "vue";
|
|
|
|
import MkStickyContainer from "@/components/global/MkStickyContainer.vue";
|
|
|
|
import FormSuspense from "@/components/form/suspense.vue";
|
|
|
|
import FormSwitch from "@/components/form/switch.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { fetchInstance } from "@/instance";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
|
|
|
|
2023-05-26 07:05:43 +02:00
|
|
|
let enablePostImports = $ref(false);
|
2023-05-13 15:41:36 +02:00
|
|
|
let meta = $ref<MetaExperiments | null>(null);
|
|
|
|
|
|
|
|
type MetaExperiments = {
|
|
|
|
experimentalFeatures?: {
|
2023-05-26 07:05:43 +02:00
|
|
|
postImports?: boolean;
|
2023-05-13 15:41:36 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
async function init() {
|
|
|
|
meta = (await os.api("admin/meta")) as MetaExperiments;
|
|
|
|
if (!meta) return;
|
|
|
|
|
2023-05-26 07:05:43 +02:00
|
|
|
enablePostImports = meta.experimentalFeatures?.postImports ?? false;
|
2023-05-13 15:41:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
const experiments: MetaExperiments = {
|
|
|
|
experimentalFeatures: {
|
2023-05-26 07:05:43 +02:00
|
|
|
postImports: enablePostImports,
|
2023-05-13 15:41:36 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
os.apiWithDialog("admin/update-meta", experiments).then(() => {
|
|
|
|
fetchInstance();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-05-13 16:04:24 +02:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
2023-05-13 15:41:36 +02:00
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts._experiments.title,
|
|
|
|
icon: "ph-flask ph-bold ph-lg",
|
|
|
|
});
|
|
|
|
</script>
|