Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

7.5 KB
Raw Blame
@using Microsoft.AspNetCore.Http
@model SystemInfoModel

@inject IHttpContextAccessor httpContextAccessor;

@{
    //page title
    ViewBag.Title = Loc["Admin.System.SystemInfo"];
}

@* One page for both of the old panels: the environment as read-only facts, the two long lists in
   cards of their own with the Show/Hide link in the header, and the warnings as a list with a
   state icon per line. The toggled panels and their links keep the ids the script uses. *@
<admin-page title="@Loc["Admin.System.SystemInfo"]" icon="bi-list-task">
    <page-actions>
        <vc:admin-widget widget-zone="system_info_buttons" additional-data="null"/>
    </page-actions>

    <vc:admin-widget widget-zone="system_info_top" additional-data="null"/>

    <admin-card>
        <div class="grand-facts">
            <div>
                <admin-label asp-for="GrandVersion" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.GrandVersion</div>
            </div>
            <div>
                <admin-label asp-for="GitBranch" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.GitBranch</div>
            </div>
            <div>
                <admin-label asp-for="GitCommit" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.GitCommit</div>
            </div>
            <div>
                <admin-label asp-for="OperatingSystem" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.OperatingSystem</div>
            </div>
            <div>
                <admin-label asp-for="MachineName" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.MachineName</div>
            </div>
            <div>
                <admin-label asp-for="AspNetInfo" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.AspNetInfo</div>
            </div>
            <div>
                <admin-label asp-for="EnvironmentName" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.EnvironmentName</div>
            </div>
            <div>
                <admin-label asp-for="ServerTimeZone" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.ServerTimeZone</div>
            </div>
            <div>
                <admin-label asp-for="ServerLocalTime" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.ServerLocalTime.ToString("F")</div>
            </div>
            <div>
                <admin-label asp-for="ApplicationTime" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.ApplicationTime.ToString("F")</div>
            </div>
            <div>
                <admin-label asp-for="UtcTime" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.UtcTime.ToString("F")</div>
            </div>
            <div>
                <admin-label asp-for="RequestScheme" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@httpContextAccessor.HttpContext.Request.Scheme</div>
            </div>
            <div>
                <admin-label asp-for="IsHttps" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@httpContextAccessor.HttpContext.Request.IsHttps</div>
            </div>
        </div>
        @* the two paths are long, so they get a row of their own and half the width each *@
        <div class="grand-facts mt-3">
            <div>
                <admin-label asp-for="WebRootPath" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.WebRootPath</div>
            </div>
            <div>
                <admin-label asp-for="ContentRootPath" asp-display-hint="false" class="grand-fact__label"/>
                <div class="grand-fact__value text-break">@Model.ContentRootPath</div>
            </div>
        </div>
    </admin-card>

    <admin-card title="@Loc["Admin.System.SystemInfo.ServerVariables"]">
        <card-actions>
            <a id="serverVariablesShowHide" class="btn btn-outline-secondary btn-sm" href="javascript:toggleLoadedServerVariables();">@Loc["Admin.Common.Show"]</a>
        </card-actions>
        <div id="pnlServerVariables" class="text-break small" style="display:none">
            @foreach (var serverVariable in Model.ServerVariables)
            {
                @serverVariable.Name<text>:</text>
                @serverVariable.Value
                <br/>
            }
        </div>
    </admin-card>

    <admin-card title="@Loc["Admin.System.SystemInfo.LoadedAssemblies"]">
        <card-actions>
            <a id="loadedAssembliesShowHide" class="btn btn-outline-secondary btn-sm" href="javascript:toggleLoadedAssemblies();">@Loc["Admin.Common.Show"]</a>
        </card-actions>
        <div id="pnlLoadedAssemblies" class="text-break small" style="display:none">
            @foreach (var assembly in Model.LoadedAssemblies)
            {
                @assembly.FullName
                if (!string.IsNullOrEmpty(assembly.Location))
                {
                    <br/>
                    <em>@assembly.Location</em>
                }

                <br/>
            }
        </div>
    </admin-card>

    <vc:admin-widget widget-zone="system_info_bottom" additional-data="null"/>

    <admin-card title="@Loc["Admin.System.Warnings"]">
        <card-actions>
            <vc:admin-widget widget-zone="warnings_buttons" additional-data="null"/>
        </card-actions>
        <vc:admin-widget widget-zone="warnings_top" additional-data="null"/>
        <ul class="list-unstyled mb-0">
            @foreach (var warning in Model.SystemWarnings)
            {
                var icon = warning.Level switch
                {
                    SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass => "bi-check-circle text-success",
                    SystemInfoModel.SystemWarningModel.SystemWarningLevel.Warning => "bi-exclamation-triangle text-warning",
                    _ => "bi-x-circle text-danger"
                };
                <li class="d-flex gap-2 py-1">
                    <i class="bi @icon" aria-hidden="true"></i>
                    <span>@warning.Text</span>
                </li>
            }
        </ul>
        <vc:admin-widget widget-zone="warnings_bottom" additional-data="null"/>
    </admin-card>
</admin-page>

<script>
    function toggleLoadedAssemblies() {
        $('#pnlLoadedAssemblies').toggle();
        if ($('#pnlLoadedAssemblies').css('display') == 'none') {
            $('#loadedAssembliesShowHide').html('@Loc["Admin.Common.Show"]');
        }
        else {
            $('#loadedAssembliesShowHide').html('@Loc["Admin.Common.Hide"]');
        }
    }

    function toggleLoadedServerVariables() {
        $('#pnlServerVariables').toggle();
        if ($('#pnlServerVariables').css('display') == 'none') {
            $('#serverVariablesShowHide').html('@Loc["Admin.Common.Show"]');
        }
        else {
            $('#serverVariablesShowHide').html('@Loc["Admin.Common.Hide"]');
        }
    }
</script>