{$layout}
{$template "menu"}

<div v-if="countClusters == 0">
    <b-empty>
        暂时还没有集群，请先 <a href="/ns/clusters/create">创建集群</a>。
    </b-empty>
</div>

<div v-show="countClusters > 0">
    <form class="ui form" data-tea-action="$" data-tea-success="success">
        <csrf-token></csrf-token>
        <input type="hidden" name="addingType" :value="addingType"/>
        <table class="ui table definition selectable">
            <tr>
                <td>域名 *</td>
                <td>
                    <!-- 单个添加 -->
                    <div v-show="addingType == 'one'">
                        <input type="text" name="name" maxlength="255" ref="nameInput" placeholder="单个域名"/>
                        <p class="comment">
                            <a href="" @click.prevent="setAddingType('batch')">[批量添加]</a>
                        </p>
                    </div>

                    <!-- 批量添加 -->
                    <div v-show="addingType == 'batch'">
                        <textarea rows="10" name="names" placeholder="每行一个域名" ref="namesInput"></textarea>
                        <p class="comment">
                            <a href="" @click.prevent="setAddingType('one')">[单个添加]</a>
                        </p>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="title">所属集群 *</td>
                <td>
                    <ns-cluster-selector></ns-cluster-selector>
                    <p class="comment">需要部署域名服务的集群。</p>
                </td>
            </tr>
            <tr>
                <td colspan="2"><more-options-indicator></more-options-indicator></td>
            </tr>
            <tbody v-show="moreOptionsVisible">
                <tr>
                    <td>所属用户</td>
                    <td>
                        <ns-user-selector @change="changeUserId"></ns-user-selector>
                        <p class="comment">当前域名所属的平台用户。</p>
                    </td>
                </tr>
                <tr v-if="hasGroups">
                    <td>所属分组</td>
                    <td>
                        <ns-domain-group-selector ref="groupSelector"></ns-domain-group-selector>
                    </td>
                </tr>
            </tbody>
        </table>
        <submit-btn></submit-btn>
    </form>
</div>