Skip to content

Commit

Permalink
frontend: application added
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskaliX committed Jun 24, 2023
2 parents c7bd55a + 8563085 commit 16b05d2
Show file tree
Hide file tree
Showing 13 changed files with 251 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/webconsole/api/grpc/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ func AgentBasic(c *gin.Context) {
var cpu, rss float64
cpu = detail["cpu"].(float64)
rss = detail["rss"].(float64)
<<<<<<< HEAD
=======
for _, v := range as.PluginDetail {
// pass the lost ones
if !as.IsOnline() {
continue
}
cpu += v["cpu"].(float64)
rss += v["rss"].(float64)
fmt.Println(v["cpu"].(float64), v["rss"].(float64))
}
>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907

tmp := AgentBasicResp{
AgentID: as.AgentID,
Expand Down
24 changes: 24 additions & 0 deletions server/webconsole/api/host/application/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ import (
"context"
"hboat/api/common"
"hboat/pkg/basic/mongo"
<<<<<<< HEAD
"time"

"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
=======

"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907
"go.mongodb.org/mongo-driver/mongo/options"
)

Expand All @@ -20,6 +26,7 @@ type dashboardResp struct {
ApplicationCount int64 `json:"application_count"`
CrontabCount int64 `json:"crontab_count"`
KmodCount int64 `json:"kmod_count"`
<<<<<<< HEAD
SocketCount int64 `json:"socket_count"` // open port
BpfCount int64 `json:"bpf_count"`
SocketTop []top `json:"socket_top"`
Expand All @@ -35,6 +42,14 @@ type top struct {
const countLimit int64 = 9999

func Dashboard(c *gin.Context) {
=======
}

const countLimit int64 = 99999

func Dashboard(c *gin.Context) {

>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907
var resp dashboardResp

containerCount, err := getCount(bson.M{"data_type": 3018})
Expand Down Expand Up @@ -79,6 +94,7 @@ func Dashboard(c *gin.Context) {
return
}
resp.KmodCount = kmodCount
<<<<<<< HEAD
socketCount, err := getCount(bson.M{"data_type": 5001, "sip": "0.0.0.0"})
if err != nil {
common.Response(c, common.ErrorCode, err.Error())
Expand Down Expand Up @@ -179,22 +195,30 @@ func Dashboard(c *gin.Context) {
resp.ApplicationTop = fillTop(resp.ApplicationTop)
resp.SystemdTop = fillTop(resp.SystemdTop)
resp.SocketTop = fillTop(resp.SocketTop)
=======
>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907

common.Response(c, common.SuccessCode, &resp)
}

func getCount(filter bson.M) (int64, error) {
<<<<<<< HEAD
filter["update_time"] = bson.M{"$gt": time.Now().Unix() - 60*60*24}
=======
>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907
var max int64 = countLimit
opts := &options.CountOptions{
Limit: &max,
}
return mongo.MongoProxyImpl.AssetC.CountDocuments(context.Background(), filter, opts)
}
<<<<<<< HEAD

func fillTop(t []top) []top {
if len(t) < 5 {
t = append(t, make([]top, 5-len(t))...)
}
return t
}
=======
>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907
42 changes: 42 additions & 0 deletions server/webconsole/api/static/frontend/316.23f0b946.async.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions server/webconsole/api/static/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
</head>
<body>
<div id="root"></div>
<<<<<<< HEAD
<script src="/umi.3e99c535.js"></script>
=======
<script src="/umi.51cff279.js"></script>
>>>>>>> 8563085b7fec8effadc3c3a82883b84312af7907

</body></html>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 16b05d2

Please sign in to comment.