{$layout}

<first-menu>
  <a href="/dns/providers" class="item">DNS账号列表</a>
  <span class="item">|</span>
  <a
    :href="'/dns/providers/provider?providerId=' + provider.id"
    class="item active"
    >{{provider.name}}</a
  >
</first-menu>

<!-- <h3>
  账号信息 <a href="" @click.prevent="updateProvider(provider.id)">[修改]</a>
</h3> -->
<b-settings-header @action="updateProvider(provider.id)" action-text="修改">
  账号信息
</b-settings-header>

<table class="ui table selectable definition">
  <tr>
    <td class="title">账号说明</td>
    <td>{{provider.name}}</td>
  </tr>
  <tr>
    <td>服务商</td>
    <td>{{provider.typeName}}</td>
  </tr>

  <!-- DNSPod -->
  <tbody v-if="provider.type == 'dnspod'">
    <tr>
      <td class="color-border">密钥ID</td>
      <td>{{provider.apiParams.id}}</td>
    </tr>
    <tr>
      <td class="color-border">密钥Token</td>
      <td>{{provider.apiParams.token}}</td>
    </tr>
    <tr>
      <td class="color-border">区域</td>
      <td>
        <span v-if="provider.apiParams.region == 'international'">国际站</span>
        <span v-else>中国站</span>
      </td>
    </tr>
  </tbody>

  <!-- AliDNS -->
  <tbody v-if="provider.type == 'alidns'">
    <tr>
      <td>AccessKeyId</td>
      <td>{{provider.apiParams.accessKeyId}}</td>
    </tr>
    <tr>
      <td>AccessKeySecret</td>
      <td>{{provider.apiParams.accessKeySecret}}</td>
    </tr>
    <tr>
      <td>区域ID</td>
      <td>
        <span
          v-if="provider.apiParams.regionId != null && provider.apiParams.regionId.length > 0"
          >{{provider.apiParams.regionId}}</span
        >
        <span v-else class="disabled">没有设置。</span>
      </td>
    </tr>
  </tbody>

  <!-- HuaweiDNS -->
  <tbody v-if="provider.type == 'huaweiDNS'">
    <tr>
      <td>AccessKeyId</td>
      <td>{{provider.apiParams.accessKeyId}}</td>
    </tr>
    <tr>
      <td>AccessKeySecret</td>
      <td>{{provider.apiParams.accessKeySecret}}</td>
    </tr>
    <tr>
      <td>终端节点</td>
      <td>
        <span
          v-if="provider.apiParams.endpoint != null && provider.apiParams.endpoint.length > 0"
          >{{provider.apiParams.endpoint}}</span
        >
        <span v-else class="disabled">默认</span>
      </td>
    </tr>
  </tbody>

  <!-- CloudFlare -->
  <tbody v-if="provider.type == 'cloudFlare'">
    <tr>
      <td class="color-border">API密钥</td>
      <td>{{provider.apiParams.apiKey}}</td>
    </tr>
    <tr>
      <td class="color-border">账号邮箱</td>
      <td>{{provider.apiParams.email}}</td>
    </tr>
  </tbody>

  <!-- GoDaddy -->
  <tbody v-if="provider.type == 'godaddy'">
    <tr>
      <td class="color-border">Key</td>
      <td>{{provider.apiParams.key}}</td>
    </tr>
    <tr>
      <td class="color-border">Secret</td>
      <td>{{provider.apiParams.secret}}</td>
    </tr>
  </tbody>

  <!-- ClouDNS -->
  <tbody v-if="provider.type == 'cloudns'">
    <tr v-if="provider.apiParams.authId > 0">
      <td class="color-border">用户认证ID<em>（auth-id）</em></td>
      <td>{{provider.apiParams.authId}}</td>
    </tr>
    <tr v-if="provider.apiParams.subAuthId > 0">
      <td class="color-border">子用户认证ID<em>（sub-auth-id）</em></td>
      <td>{{provider.apiParams.subAuthId}}</td>
    </tr>
    <tr>
      <td class="color-border">认证密码<em>（auth-password）</em></td>
      <td>{{provider.apiParams.authPassword}}</td>
    </tr>
  </tbody>

  <!-- DNS.COM -->
  <tbody v-if="provider.type == 'dnscom'">
    <tr>
      <td class="color-border">API Key</td>
      <td>{{provider.apiParams.key}}</td>
    </tr>
    <tr>
      <td class="color-border">API Secret</td>
      <td>{{provider.apiParams.secret}}</td>
    </tr>
  </tbody>

  <!-- DNS.LA -->
  <tbody v-if="provider.type == 'dnsla'">
    <tr>
      <td class="color-border">API ID</td>
      <td>{{provider.apiParams.apiId}}</td>
    </tr>
    <tr>
      <td class="color-border">API密钥</td>
      <td>{{provider.apiParams.secret}}</td>
    </tr>
  </tbody>

  <!-- Local EdgeDNS -->
  <tbody v-if="provider.type == 'localEdgeDNS'">
    <tr>
      <td class="color-border">域名服务集群</td>
      <td>{{provider.localEdgeDNS.name}}</td>
    </tr>
  </tbody>

  <!-- EdgeDNS API -->
  <tbody v-if="provider.type == 'edgeDNSAPI'">
    <tr>
      <td class="color-border">API地址</td>
      <td>{{provider.apiParams.host}}</td>
    </tr>
    <tr>
      <td class="color-border">AccessKey类型</td>
      <td>
        <span v-if="provider.apiParams.role == 'user'">平台用户</span>
        <span v-if="provider.apiParams.role == 'admin'">管理员</span>
      </td>
    </tr>
    <tr>
      <td class="color-border">AccessKey ID</td>
      <td>{{provider.apiParams.accessKeyId}}</td>
    </tr>
    <tr>
      <td class="color-border">AccessKey密钥</td>
      <td>{{provider.apiParams.accessKeySecret}}</td>
    </tr>
  </tbody>

  <!-- CustomHTTP -->
  <tbody v-if="provider.type == 'customHTTP'">
    <tr>
      <td class="color-border">HTTP URL</td>
      <td>{{provider.apiParams.url}}</td>
    </tr>
    <tr>
      <td class="color-border">私钥</td>
      <td>{{provider.apiParams.secret}}</td>
    </tr>
  </tbody>
</table>

<page-box></page-box>
