@using ZelWiki.Models
@model ZelWiki.Models.ViewModels.Admin.MetricsViewModel
@{
    Layout = "/Views/Shared/_Layout.cshtml";
    var sessionState = ViewData["SessionState"] as ZelWiki.SessionState ?? throw new Exception("Wiki State Context cannot be null.");
}

<h3>
    数据矩阵
</h3>

<p>
<br /><br />
</p>

@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
    <div class="alert alert-danger">@Html.Raw(Model.ErrorMessage)</div>
}
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
    <div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}

<h2>基本数据</h2>
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><strong>页面数</strong></td>
        <td><strong>页面修订数</strong></td>
        <td><strong>页面附件数</strong></td>
        <td><strong>页面间链接数</strong></td>
    </tr>

    <tr>
        <td><a href="@GlobalConfiguration.BasePath/Admin/Pages">@Model.Metrics.Pages.ToString("N0")</a></td>
        <td>@Model.Metrics.PageRevisions.ToString("N0")</td>
        <td>@Model.Metrics.PageAttachments.ToString("N0")</td>
        <td>@Model.Metrics.IntraLinks.ToString("N0")</td>
    </tr>

    <tr>
        <td><strong>页面Tags数量</strong></td>
        <td><strong>页面附件修订数</strong></td>
        <td><strong>页面搜索Token</strong></td>
        <td><strong>命名空间数</strong></td>
    </tr>

    <tr>
        <td>@Model.Metrics.PageTags.ToString("N0")</td>
        <td>@Model.Metrics.PageAttachmentRevisions.ToString("N0")</td>
        <td><a href="@GlobalConfiguration.BasePath/Page/Search">@Model.Metrics.PageSearchTokens.ToString("N0")</a></td>
        <td><a href="@GlobalConfiguration.BasePath/Admin/Namespaces">@Model.Metrics.Namespaces.ToString("N0")</a></td>
    </tr>

    <tr>
        <td><strong>用户数量</strong></td>
        <td><strong>&nbsp;</strong></td>
        <td><strong>异常</strong></td>
        <td><strong>&nbsp;</strong></td>
    </tr>

    <tr>
        <td><a href="@GlobalConfiguration.BasePath/Admin/Accounts">@Model.Metrics.Users.ToString("N0")</a></td>
        <td>&nbsp;</td>
        <td><a href="@GlobalConfiguration.BasePath/Admin/Exceptions">@Model.Metrics.Exceptions.ToString("N0")</a></td>
        <td>&nbsp;</td>
    </tr>
</table>

<h2>Cache</h2>
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath,
        "所有缓存将被清理,数据将会从数据库重新获取,确认继续吗?",
    "清理本地缓存", "/Admin/PurgeMemoryCache", Context.Request.Path.Value))
<br />

<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><strong>Items</strong></td>
        <td><strong>Puts</strong></td>
        <td><strong>Gets</strong></td>
        <td><strong>Hits</strong></td>
        <td><strong>Misses</strong></td>
        <td><strong>Limit(MB)</strong></td>
    </tr>
    <tr>
        <td>@ZelWiki.Caching.WikiCache.CacheItemCount.ToString("N0")</td>
        <td>@ZelWiki.Caching.WikiCache.CachePuts.ToString("N0")</td>
        <td>@ZelWiki.Caching.WikiCache.CacheGets.ToString("N0")</td>
        <td>@ZelWiki.Caching.WikiCache.CacheHits.ToString("N0")</td>
        <td>@ZelWiki.Caching.WikiCache.CacheMisses.ToString("N0")</td>
        <td>@NTDLS.Helpers.Formatters.FileSize((long)ZelWiki.Caching.WikiCache.CacheMemoryLimit)</td>
    </tr>
</table>
