{$layout}
{$template "menu"}
{$template "/echarts"}

<!-- 加载中 -->
<div style="margin-top: 0.8em" v-if="isLoading">
    <div class="ui message loading">
        <div class="ui active inline loader small"></div>  &nbsp; 数据加载中...
    </div>
</div>

<div v-show="!isLoading">
    <columns-grid>
        <div class="ui column">
            <h4>域名<link-icon href="/ns/domains"></link-icon></h4>
            <div class="value"><span>{{board.countDomains}}</span>个</div>
        </div>
        <div class="ui column">
            <h4>记录<link-icon href="/ns/domains"></link-icon></h4>
            <div class="value"><span>{{board.countRecords}}</span>个</div>
        </div>
        <div class="ui column">
            <h4>集群<link-icon href="/ns/clusters"></link-icon></h4>
            <div class="value"><span>{{board.countClusters}}</span>个</div>
        </div>
        <div class="ui column">
            <h4>节点<link-icon href="/ns/clusters"></link-icon></h4>
            <div class="value"><span>{{board.countNodes}}</span>
                <span v-if="board.countOfflineNodes > 0" style="font-size: 1em">
                    / <a href="/ns/clusters"><span class="red" style="font-size: 1em">{{board.countOfflineNodes}}离线</span></a>
                </span>
                <span v-else style="font-size: 1em">个</span>
            </div>
        </div>
    </columns-grid>

    <chart-columns-grid>
        <div class="ui column">
            <!-- 流量统计 -->
            <div class="ui menu text">
                <a href="" class="item" :class="{active: trafficTab == 'hourly'}" @click.prevent="selectTrafficTab('hourly')">24小时流量趋势</a>
                <a href="" class="item" :class="{active: trafficTab == 'daily'}" @click.prevent="selectTrafficTab('daily')">15天流量趋势</a>
            </div>
            <div class="ui divider"></div>

            <!-- 按小时统计流量 -->
            <div class="chart-box" id="hourly-traffic-chart" v-show="trafficTab == 'hourly'"></div>

            <!-- 按日统计流量 -->
            <div class="chart-box" id="daily-traffic-chart" v-show="trafficTab == 'daily'"></div>
        </div>

        <div class="ui column">
            <!-- 域名排行 -->
            <h4>域名访问排行 <span>（24小时）</span></h4>
            <div class="ui divider"></div>
            <div class="chart-box" id="top-domains-chart"></div>
        </div>

        <div class="ui column">
            <!-- 节点排行 -->
            <h4>节点访问排行 <span>（24小时）</span></h4>
            <div class="ui divider"></div>
            <div class="chart-box" id="top-nodes-chart"></div>
        </div>

        <!-- 系统信息 -->
        <div class="ui column">
            <div class="ui menu text">
                <a href="" class="item" :class="{active: nodeStatusTab == 'cpu'}" @click.prevent="selectNodeStatusTab('cpu')">DNS节点CPU</a>
                <a href="" class="item" :class="{active: nodeStatusTab == 'memory'}" @click.prevent="selectNodeStatusTab('memory')">DNS节点内存</a>
                <a href="" class="item" :class="{active: nodeStatusTab == 'load'}" @click.prevent="selectNodeStatusTab('load')">DNS节点负载</a>
            </div>
            <div class="ui divider"></div>

            <div class="chart-box" id="cpu-chart" v-show="nodeStatusTab == 'cpu'"></div>
            <div class="chart-box" id="memory-chart" v-show="nodeStatusTab == 'memory'"></div>
            <div class="chart-box" id="load-chart" v-show="nodeStatusTab == 'load'"></div>
        </div>
    </chart-columns-grid>
</div>
