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

<!-- 升级提醒 -->
<div class="ui icon message error" v-if="nodeUpgradeInfo.count > 0">
    <i class="icon warning circle"></i>
    <a href="/clusters">
    升级提醒：有 {{nodeUpgradeInfo.count}} 个边缘节点需要升级到 v{{nodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
</div>
<div class="ui icon message error" v-if="monitorNodeUpgradeInfo.count > 0 && teaIsPlus">
    <i class="icon warning circle"></i>
    <a href="/settings/monitorNodes">升级提醒：有 {{monitorNodeUpgradeInfo.count}} 个监控节点需要升级到 v{{monitorNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
<div class="ui icon message error" v-if="userNodeUpgradeInfo.count > 0 && teaIsPlus">
    <i class="icon warning circle"></i>
    <a href="/settings/userNodes">升级提醒：有 {{userNodeUpgradeInfo.count}} 个用户节点需要升级到 v{{userNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
<div class="ui icon message error" v-if="apiNodeUpgradeInfo.count > 0">
    <i class="icon warning circle"></i>
    <a href="/api">升级提醒：有 {{apiNodeUpgradeInfo.count}} 个API节点需要升级到 v{{apiNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a></div>
<div class="ui icon message error" v-if="nsNodeUpgradeInfo.count > 0 && teaIsPlus">
    <i class="icon warning circle"></i>
    <a href="/ns/clusters">升级提醒：有 {{nsNodeUpgradeInfo.count}} 个DNS节点需要升级到 v{{nsNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
</div>
<div class="ui icon message error" v-if="authorityNodeUpgradeInfo.count > 0 && teaIsPlus">
    <i class="icon warning circle"></i>
    <a href="/settings/authority/nodes">升级提醒：有 {{authorityNodeUpgradeInfo.count}} 个企业版认证节点需要升级到 v{{authorityNodeUpgradeInfo.version}} 版本</a><a href="" title="关闭" @click.prevent="closeMessage"><i class="ui icon remove small"></i></a>
</div>

{$template "menu"}

<!-- 统计图表 -->
<div class="ui four columns grid">
    <div class="ui column">
        <h4>集群<link-icon href="/clusters" v-if="dashboard.canGoNodes"></link-icon></h4>
        <div class="value"><span>{{dashboard.countNodeClusters}}</span>个</div>
    </div>

    <div class="ui column">
        <h4>边缘节点<link-icon href="/clusters" v-if="dashboard.canGoNodes"></link-icon></h4>
        <div class="value"><span>{{dashboard.countNodes}}</span>个</div>
    </div>

    <div class="ui column">
        <h4>API节点<link-icon href="/api" v-if="dashboard.canGoSettings"></link-icon></h4>
        <div class="value"><span>{{dashboard.countAPINodes}}</span>个</div>
    </div>

    <div class="ui column">
        <h4>用户<link-icon href="/users" v-if="dashboard.canGoUsers"></link-icon></h4>
        <div class="value"><span>{{dashboard.countUsers}}</span>个</div>
    </div>

    <div class="ui column">
        <h4>服务<link-icon href="/servers" v-if="dashboard.canGoServers"></link-icon></h4>
        <div class="value"><span>{{dashboard.countServers}}</span>个</div>
    </div>

    <div class="ui column no-border">
        <h4>今日流量</h4>
        <div class="value"><span>{{todayTraffic}}</span>{{todayTrafficUnit}}</div>
    </div>
</div>

<div class="ui divider"></div>

<!-- 流量 -->
<div class="ui menu tabular">
    <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="chart-box" id="hourly-traffic-chart-box" v-show="trafficTab == 'hourly'"></div>

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

<div class="ui divider"></div>

<div class="ui menu tabular">
    <a href="" class="item" :class="{active: requestsTab == 'hourly'}" @click.prevent="selectRequestsTab('hourly')">24小时访问量趋势</a>
    <a href="" class="item" :class="{active: requestsTab == 'daily'}" @click.prevent="selectRequestsTab('daily')">15天访问量趋势</a>
</div>

<!-- 按小时统计访问量 -->
<div class="chart-box" id="hourly-requests-chart" v-show="requestsTab == 'hourly'"></div>

<!-- 按日统计访问量 -->
<div class="chart-box" id="daily-requests-chart" v-show="requestsTab == 'daily'"></div>

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

<div class="ui divider"></div>

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

<!-- 指标 -->
<div class="ui divider" v-if="metricCharts.length > 0"></div>
<metric-board>
    <metric-chart v-for="chart in metricCharts"
                  :key="chart.id"
                  :v-chart="chart.chart"
                  :v-stats="chart.stats"
                  :v-item="chart.item">
    </metric-chart>
</metric-board>