<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 ServerFeatureRequired from "@/components/server/ServerFeatureRequired.vue";
import PostForm from "@/components/form/PostForm.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import UAMConfigBox from "@/components/server/UAMConfigBox.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<ServerSettingLayout :ctx="ctx">
		<div v-if="ctx.featureIsOn">
			<PostForm action="$" @success="ctx.success">
				<input type="hidden" name="serverId" :value="ctx.serverId"/>

				<UAMConfigBox :v-uam-config="ctx.uamConfig"></UAMConfigBox>

				<div class="submit-button">
					<SubmitButton class="mt-4"></SubmitButton>
				</div>
			</PostForm>
		</div>
		<div v-if="!ctx.featureIsOn">
			<ServerFeatureRequired>尚未为当前用户开通此功能。</ServerFeatureRequired>
		</div>
	</ServerSettingLayout>
</template>

<style lang="postcss" scoped src="@/views/servers/style/server.pcss"></style>