节点在线、应用在线、配置在线使用令牌查询
大石头 authored at 2021-12-16 19:49:30
2.63 KiB
Stardust
@using Stardust.Data.Nodes
@using NewLife.Cube
@using NewLife.Web
@using XCode.Membership
@{
    var node = ViewBag.Node as Node;
    var recs = ViewBag.Recs as IList<(DotNetPackage Package, String Label)>;
    var page = ViewBag.Page as Pager;
}
<div class="panel panel-default">
    <div class="panel-heading">
        <strong>@L.T("框架推荐")</strong>
        <span class="pull-right text-muted" style="font-weight:normal;font-size:12px">@L.T("当前框架:")<strong>@(node?.Framework ?? L.T("未知"))</strong>&nbsp; @L.T("操作系统:")<strong>@(node?.OSKind)</strong>&nbsp; @L.T("架构:")<strong>@(node?.Architecture)</strong>
        </span>
    </div>
    <div class="panel-body">
        @if (recs == null || recs.Count == 0)
        {
            <div class="alert alert-success" role="alert">@L.T("当前已是最新版本,无需升级。")</div>
        }
        else
        {
            <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>@L.T("版本")</th>
                        <th>@L.T("安装类型")</th>
                        <th>@L.T("目标系统")</th>
                        <th>@L.T("架构")</th>
                        <th>@L.T("操作")</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var (pkg, label) in recs)
                    {
                        <tr>
                            <td>@pkg.Version</td>
                            <td>@pkg.Kind</td>
                            <td>@pkg.OSKind</td>
                            <td>@pkg.Architecture</td>
                            <td>
                                <form method="post" action="@Url.Action("InstallFramework", "NodeFramework", new { Area = "Nodes" })" style="display:inline">
                                    @* 传入当前节点作为选中 key *@
                                    <input type="hidden" name="keys" value="@node?.ID" />
                                    <input type="hidden" name="ver" value="@pkg.Version" />
                                    <input type="hidden" name="kind" value="@pkg.Kind" />
                                    <button type="submit" class="btn btn-success btn-xs">@L.T("安装")</button>
                                </form>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="text-muted" style="font-size:12px">@L.T("提示:安装将向节点下发") <code>framework/install</code> @L.T("指令,节点在线时会立即执行。")</div>
        }
    </div>
</div>