diff --git a/internal/web/actions/default/clusters/grants/index.go b/internal/web/actions/default/clusters/grants/index.go index c1298b5f..5574f1e1 100644 --- a/internal/web/actions/default/clusters/grants/index.go +++ b/internal/web/actions/default/clusters/grants/index.go @@ -15,8 +15,14 @@ func (this *IndexAction) Init() { this.Nav("", "grant", "index") } -func (this *IndexAction) RunGet(params struct{}) { - countResp, err := this.RPC().NodeGrantRPC().CountAllEnabledNodeGrants(this.AdminContext(), &pb.CountAllEnabledNodeGrantsRequest{}) +func (this *IndexAction) RunGet(params struct { + Keyword string +}) { + this.Data["keyword"] = params.Keyword + + countResp, err := this.RPC().NodeGrantRPC().CountAllEnabledNodeGrants(this.AdminContext(), &pb.CountAllEnabledNodeGrantsRequest{ + Keyword: params.Keyword, + }) if err != nil { this.ErrorPage(err) return @@ -25,8 +31,9 @@ func (this *IndexAction) RunGet(params struct{}) { this.Data["page"] = page.AsHTML() grantsResp, err := this.RPC().NodeGrantRPC().ListEnabledNodeGrants(this.AdminContext(), &pb.ListEnabledNodeGrantsRequest{ - Offset: page.Offset, - Size: page.Size, + Keyword: params.Keyword, + Offset: page.Offset, + Size: page.Size, }) if err != nil { this.ErrorPage(err) @@ -57,6 +64,7 @@ func (this *IndexAction) RunGet(params struct{}) { "type": grant.Method, "name": grantutils.FindGrantMethodName(grant.Method), }, + "username": grant.Username, "countClusters": countClusters, "countNodes": countNodes, }) diff --git a/internal/web/actions/default/clusters/grants/selectPopup.go b/internal/web/actions/default/clusters/grants/selectPopup.go index f5c0d316..a7950b7c 100644 --- a/internal/web/actions/default/clusters/grants/selectPopup.go +++ b/internal/web/actions/default/clusters/grants/selectPopup.go @@ -27,10 +27,12 @@ func (this *SelectPopupAction) RunGet(params struct{}) { grantMaps := []maps.Map{} for _, grant := range grants { grantMaps = append(grantMaps, maps.Map{ - "id": grant.Id, - "name": grant.Name, - "method": grant.Method, - "methodName": grantutils.FindGrantMethodName(grant.Method), + "id": grant.Id, + "name": grant.Name, + "method": grant.Method, + "methodName": grantutils.FindGrantMethodName(grant.Method), + "username": grant.Username, + "description": grant.Description, }) } this.Data["grants"] = grantMaps diff --git a/web/views/@default/clusters/grants/index.html b/web/views/@default/clusters/grants/index.html index 36b34547..c06b5e49 100644 --- a/web/views/@default/clusters/grants/index.html +++ b/web/views/@default/clusters/grants/index.html @@ -1,6 +1,21 @@ {$layout} {$template "menu"} + + +
+
+
+
+ +
+
+ +
+
+
+ +
暂时还没有认证信息。
@@ -8,6 +23,7 @@ + @@ -18,6 +34,10 @@ +
名称 类型用户名 集群数 节点数 操作 {{grant.method.name}} + {{grant.username}} + - + {{grant.countClusters}} 0 diff --git a/web/views/@default/clusters/grants/selectPopup.html b/web/views/@default/clusters/grants/selectPopup.html index dac31cee..00a93759 100644 --- a/web/views/@default/clusters/grants/selectPopup.html +++ b/web/views/@default/clusters/grants/selectPopup.html @@ -2,11 +2,19 @@

选择认证

- + +
+
+ +
+
+ + +
diff --git a/web/views/@default/clusters/grants/selectPopup.js b/web/views/@default/clusters/grants/selectPopup.js index ce4aba25..512ad3fa 100644 --- a/web/views/@default/clusters/grants/selectPopup.js +++ b/web/views/@default/clusters/grants/selectPopup.js @@ -1,5 +1,7 @@ Tea.context(function () { - this.grantId = 0; + this.grantId = 0 + this.keyword = "" + let allGrants = this.grants.$copy() this.selectGrant = function (grant) { NotifyPopup({ @@ -8,5 +10,20 @@ Tea.context(function () { grant: grant } }) - }; -}); \ No newline at end of file + } + + this.$delay(function () { + let that = this + this.$watch("keyword", function (keyword) { + if (keyword.length > 0) { + that.grants = allGrants.$findAll(function (k, grant) { + return teaweb.match(grant.name, keyword) + || teaweb.match(grant.description, keyword) + || teaweb.match(grant.username, keyword) + }) + } else { + that.grants = allGrants + } + }) + }) +}) \ No newline at end of file
暂时还没有可用的认证。 - {{grant.name}} ({{grant.methodName}}) + {{grant.name}} ({{grant.methodName}})({{grant.username}})

请点击选中某个认证。