添加发布节点时,限制只能选择本项目节点和公共项目节点,本项目优先,按活跃时间降序
大石头 authored at 2024-07-13 12:27:23
1.29 KiB
Stardust
@model AppDeployNode
@using NewLife.Cube.ViewModels
@using Stardust.Data.Deployment;
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@using XCode.Membership;
@using NewLife.Cube;
@using Stardust.Web.Models;
@{
    var entity = Model;
    var fields = ViewBag.Fields as FieldCollection;
    var isNew = (entity as IEntity).IsNullKey;

    var projectId = entity.Deploy?.ProjectId ?? 0;

    var set = CubeSetting.Current;
    var cls = set.FormGroupClass;
    if (cls.IsNullOrEmpty()) { cls = "form-group col-xs-12 col-sm-6 col-lg-4"; }
}
@foreach (var item in fields)
{
    if (!item.Field.IsIdentity)
    {
        if (item.Name == "NodeName")
        {
            <div class="@cls">
                <label class="control-label col-xs-3 col-sm-3">节点</label>
                <div class="input-group col-xs-9 col-sm-9">
                    @await Html.PartialAsync("_SelectNode", new SelectNodeModel { Id = "nodeId", NodeId = entity.NodeId, ProjectId = projectId, Product = "StarAgent" })
                </div>
            </div>
        }
        else
        {
            @await Html.PartialAsync("_Form_Group", new ValueTuple<IEntity, DataField>(entity, item))
        }
    }
}
@*@await Html.PartialAsync("_Form_Footer", entity)
@await Html.PartialAsync("_Form_Action", entity)*@