127.0.
智能大石头 authored at 2024-11-20 00:19:29
5.75 KiB
Stardust
@model IList<AppDeployNode>
@using Stardust.Data.Deployment
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@using XCode.Membership;
@using NewLife.Cube;
@{
    var fact = ViewBag.Factory as IEntityFactory;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as IList<FieldItem>;
    var ukey = fact.Unique;
    var set = ViewBag.PageSetting as PageSetting;
    //var provider = ManageProvider.Provider;

    var nodeId = Context.Request.Query["nodeId"].ToInt(0);
    var appId = Context.Request.Query["appId"].ToInt(0);
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            @if (set.EnableSelect && ukey != null)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Id"))">编号</a></th>
            @if (appId == 0)
            {
                <th class="text-center" title="应用。原始应用"><a href="@Html.Raw(page.GetSortUrl("DeployId"))">应用</a></th>
            }
            @if (nodeId == 0)
            {
                <th class="text-center" title="节点。节点服务器"><a href="@Html.Raw(page.GetSortUrl("NodeId"))">节点</a></th>
            }
            <th class="text-center" title="IP地址"><a href="@Html.Raw(page.GetSortUrl("IP"))">IP</a></th>
            <th class="text-center" title="延迟。发布下去后,延迟执行时间,单位秒"><a href="@Html.Raw(page.GetSortUrl("Delay"))">顺序</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Enable"))">启用</a></th>
            <th class="text-center" title="进程"><a href="@Html.Raw(page.GetSortUrl("ProcessId"))">进程</a></th>
            <th class="text-center" title="进程时间"><a href="@Html.Raw(page.GetSortUrl("StartTime"))">进程时间</a></th>
            <th class="text-center" title="版本。客户端"><a href="@Html.Raw(page.GetSortUrl("Version"))">版本</a></th>
            <th class="text-center" title="编译时间。客户端"><a href="@Html.Raw(page.GetSortUrl("Compile"))">编译时间</a></th>
            <th class="text-center" title="最后活跃。最后一次上报心跳的时间"><a href="@Html.Raw(page.GetSortUrl("LastActive"))">最后活跃</a></th>
            <th class="text-center">远程操作</th>
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            <tr>
                @if (set.EnableSelect && ukey != null)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity.Id" /></td>
                }
                <td class="text-center">@entity.Id</td>
                @if (appId == 0)
                {
                    <td class="text-center"><a href="/Deployment/AppDeploy?Id=@entity.DeployId" target="_blank">@entity.DeployName</a></td>
                }
                @if (nodeId == 0)
                {
                    <td class="text-center"><a href="/Nodes/Node?Id=@entity.NodeId" target="_blank">@entity.NodeName</a></td>
                }
                <td class="text-center">@entity.IP</td>
                <td class="text-right">@entity.Delay</td>
                <td class="text-center">
                    <i class="glyphicon glyphicon-@(entity.Enable ? "ok" : "remove")" style="color: @(entity.Enable ? "green" : "red");"></i>
                </td>
                <td>@entity.ProcessId</td>
                <td>@entity.StartTime.ToFullString("")</td>
                <td>@entity.Version</td>
                <td>@entity.Compile.ToFullString("")</td>
                <td>@entity.LastActive.ToFullString("")</td>
                <td class="text-center">
                    <i class="glyphicon glyphicon-save" style="color: green;"></i>
                    <a data-action="action" data-url="@Url.Action("Operate",new { act="install",id=entity.Id})" data-confirm="危险操作!确认执行?" title="发布应用服务">发布</a>
                    &nbsp;
                    <i class="glyphicon glyphicon-play" style="color: green;"></i>
                    <a data-action="action" data-url="@Url.Action("Operate",new { act="start",id=entity.Id})" data-confirm="危险操作!确认执行?" title="拉起应用服务">启动</a>
                    &nbsp;
                    <i class="glyphicon glyphicon-stop" style="color: red;"></i>
                    <a data-action="action" data-url="@Url.Action("Operate",new { act="stop",id=entity.Id})" data-confirm="危险操作!确认执行?" title="终止应用服务">终止</a>
                    &nbsp;
                    <i class="glyphicon glyphicon-refresh" style="color: coral;"></i>
                    <a data-action="action" data-url="@Url.Action("Operate",new { act="restart",id=entity.Id})" data-confirm="危险操作!确认执行?" title="重启应用服务">重启</a>
                    &nbsp;
                    <i class="glyphicon glyphicon-remove" style="color: red;"></i>
                    <a data-action="action" data-url="@Url.Action("Operate",new { act="uninstall",id=entity.Id})" data-confirm="危险操作!确认执行?" title="卸载应用服务">卸载</a>
                </td>
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @await Html.PartialAsync("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>