<script setup>
// Copyright 2024 FlexCDN root@flexcdn.cn. All rights reserved. Official site: https://flexcdn.cn .

import ctxRef from "@/utils/ctx_ref.js"
import Context from "./index.js"
import ServerSettingLayout from "@/layouts/ServerSettingLayout.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import ServerFeatureRequired from "@/components/server/ServerFeatureRequired.vue";
import PostForm from "@/components/form/PostForm.vue";
import HTTPAccessLogConfigBox from "@/components/server/HTTPAccessLogConfigBox.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<ServerSettingLayout :ctx="ctx">
		<div v-if="ctx.featureIsOn">
			<PostForm action="$" @success="ctx.success" v-show="ctx.featureIsOn">
				<input type="hidden" name="webId" :value="ctx.webId"/>
				<HTTPAccessLogConfigBox
					:v-access-log-config="ctx.accessLogConfig"
					:v-fields="ctx.fields"
					:v-default-field-codes="ctx.defaultFieldCodes"
					:v-access-log-policies="ctx.accessLogPolicies"></HTTPAccessLogConfigBox>
				<SubmitButton class="mt-4"></SubmitButton>
			</PostForm>
		</div>
		<div v-if="!ctx.featureIsOn">
			<ServerFeatureRequired>尚未为当前用户开通此功能。</ServerFeatureRequired>
		</div>
	</ServerSettingLayout>
</template>

<style lang="postcss" scoped>
</style>