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

import PopupLayout from "@/layouts/PopupLayout.vue";
import ctxRef from "@/utils/ctx_ref.js"
import Context from "./healthCheckPopup.js"
import SubmitButton from "@/components/form/SubmitButton.vue";
import PostForm from "@/components/form/PostForm.vue";
import NSRecordHealthCheckConfigBox from "@/components/ns/NSRecordHealthCheckConfigBox.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<PopupLayout>
		<header>设置记录健康检查</header>

		<PostForm action="$" @success="ctx.success">
			<input type="hidden" name="recordId" :value="ctx.record.id"/>

			<DefinitionTable>
				<tbody>
				<tr>
					<td class="title">当前记录</td>
					<td>
						<span v-if="ctx.record.name.length > 0">{{ctx.record.name}}</span><span v-else class="disabled">[空]</span>.{{ctx.domain.name}}. {{ctx.record.type}} {{ctx.record.value}}
					</td>
				</tr>
				</tbody>
			</DefinitionTable>

			<NSRecordHealthCheckConfigBox v-model="ctx.record.healthCheckConfig" :v-parent-config="ctx.domain.healthCheckConfig"></NSRecordHealthCheckConfigBox>

			<SubmitButton></SubmitButton>
		</PostForm>
	</PopupLayout>
</template>

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