优化界面

This commit is contained in:
GoEdgeLab
2020-11-02 09:50:31 +08:00
parent 93e45af3db
commit 39459a2d13
2 changed files with 21 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package clusters
import ( import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/grants/grantutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/maps"
@@ -54,11 +55,28 @@ func (this *IndexAction) RunGet(params struct{}) {
return return
} }
// grant
var grantMap maps.Map = nil
if cluster.GrantId > 0 {
grantResp, err := this.RPC().NodeGrantRPC().FindEnabledGrant(this.AdminContext(), &pb.FindEnabledGrantRequest{GrantId: cluster.GrantId})
if err != nil {
this.ErrorPage(err)
return
}
if grantResp.Grant != nil {
grantMap = maps.Map{
"id": grantResp.Grant.Id,
"name": grantResp.Grant.Name,
"methodName": grantutils.FindGrantMethodName(grantResp.Grant.Method),
}
}
}
clusterMaps = append(clusterMaps, maps.Map{ clusterMaps = append(clusterMaps, maps.Map{
"id": cluster.Id, "id": cluster.Id,
"name": cluster.Name, "name": cluster.Name,
"installDir": cluster.InstallDir, "installDir": cluster.InstallDir,
"hasGrant": cluster.GrantId > 0, "grant": grantMap,
"countAllNodes": countNodesResp.Count, "countAllNodes": countNodesResp.Count,
"countActiveNodes": countActiveNodesResp.Count, "countActiveNodes": countActiveNodesResp.Count,
}) })

View File

@@ -24,8 +24,8 @@
<span class="disabled" v-else>-</span> <span class="disabled" v-else>-</span>
</td> </td>
<td> <td>
<span v-if="cluster.hasGrant" class="green">Y</span> <span v-if="cluster.grant != null">{{cluster.grant.name}}<span class="small">{{cluster.grant.methodName}}</span></span>
<span v-else class="disabled">N</span> <span v-else class="disabled">-</span>
</td> </td>
<td> <td>
<a :href="'/clusters/cluster?clusterId=' + cluster.id">详情</a> <a :href="'/clusters/cluster?clusterId=' + cluster.id">详情</a>