{$layout}

{$template "node_menu"}

<b-settings-header>修改节点</b-settings-header>
<!-- <h3>修改节点</h3> -->
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
    <input type="hidden" name="nodeId" :value="node.id"/>
    <input type="hidden" name="loginId" :value="loginId"/>
    <table class="ui table definition selectable">
        <tr>
            <td class="title">节点名称 *</td>
            <td>
                <input type="text" name="name" maxlength="50" ref="focus" v-model="node.name"/>
            </td>
        </tr>
        <tr>
            <td>IP地址 *</td>
            <td>
                <node-ip-addresses-box role="ns" :v-ip-addresses="node.ipAddresses"></node-ip-addresses-box>
                <p class="comment">用于访问节点和域名解析等。</p>
            </td>
        </tr>
        <tr>
            <td>所属集群</td>
            <td>
                <b-select
                    style="width:10em"
                    name="clusterId"
                    v-model="clusterId"
                    :options="[
                        ...clusters.map(cluster => ({
                            label: cluster.name,
                            value: cluster.id,
                        }))
                    ]"
                ></b-select>

                <!-- <select class="ui dropdown" name="clusterId" style="width:10em" v-model="clusterId">
                    <option v-for="cluster in clusters" :value="cluster.id">{{cluster.name}}</option>
                </select> -->
            </td>
        </tr>
        <tr>
            <td colspan="2"><more-options-indicator></more-options-indicator></td>
        </tr>
        <tbody v-show="moreOptionsVisible">
            <tr>
                <td>SSH主机地址</td>
                <td>
                    <input type="text" name="sshHost" maxlength="64" v-model="sshHost"/>
                    <p class="comment">比如192.168.1.100</p>
                </td>
            </tr>
            <tr>
                <td>SSH主机端口</td>
                <td>
                    <input type="text" name="sshPort" maxlength="5" v-model="sshPort"/>
                    <p class="comment">比如22。</p>
                </td>
            </tr>
            <tr>
                <td>SSH登录认证</td>
                <td>
                    <grant-selector :v-grant="grant" :v-ns-cluster-id="clusterId"></grant-selector>
                </td>
            </tr>
            <tr>
                <td class="title">API节点地址</td>
                <td>
                    <div style="margin-bottom: 0.5em">
                        <api-node-addresses-box :v-name="'apiNodeAddrsJSON'" :v-addrs="apiNodeAddrs"></api-node-addresses-box>
                    </div>
                    <p class="comment">当前节点单独使用的API节点设置。<pro-warning-label></pro-warning-label></p>
                </td>
            </tr>
            <tr>
                <td>启用当前节点</td>
                <td>
                    <checkbox name="isOn" :v-value="1" v-model="node.isOn"></checkbox>
                    <p class="comment">如果不启用此节点，此节点上的所有网站将不能访问。</p>
                </td>
            </tr>
        </tbody>
    </table>
    <submit-btn></submit-btn>
</form>