mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-29 16:10:26 +08:00
35 lines
810 B
Go
35 lines
810 B
Go
|
|
package groups
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||
|
|
"github.com/iwind/TeaGo/maps"
|
||
|
|
)
|
||
|
|
|
||
|
|
type IndexAction struct {
|
||
|
|
actionutils.ParentAction
|
||
|
|
}
|
||
|
|
|
||
|
|
func (this *IndexAction) Init() {
|
||
|
|
this.Nav("", "", "group")
|
||
|
|
}
|
||
|
|
|
||
|
|
func (this *IndexAction) RunGet(params struct{}) {
|
||
|
|
groupsResp, err := this.RPC().MessageRecipientGroupRPC().FindAllEnabledMessageRecipientGroups(this.AdminContext(), &pb.FindAllEnabledMessageRecipientGroupsRequest{})
|
||
|
|
if err != nil {
|
||
|
|
this.ErrorPage(err)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
groupMaps := []maps.Map{}
|
||
|
|
for _, group := range groupsResp.MessageRecipientGroups {
|
||
|
|
groupMaps = append(groupMaps, maps.Map{
|
||
|
|
"id": group.Id,
|
||
|
|
"name": group.Name,
|
||
|
|
"isOn": group.IsOn,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
this.Data["groups"] = groupMaps
|
||
|
|
|
||
|
|
this.Show()
|
||
|
|
}
|