dev
This commit is contained in:
parent
27da26336f
commit
708542ff72
21
cmd/ps.go
21
cmd/ps.go
|
@ -5,17 +5,25 @@ import (
|
|||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/engine/env"
|
||||
"git.apinb.com/bsm-sdk/engine/utils"
|
||||
"git.apinb.com/bsm-sdk/engine/vars"
|
||||
"github.com/modood/table"
|
||||
"github.com/spf13/cobra"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type JSONData struct {
|
||||
Msg string `json:"msg"`
|
||||
Code int `json:"code"`
|
||||
Data []ActionsReleases `json:"data"`
|
||||
}
|
||||
|
||||
type ActionsReleases struct {
|
||||
gorm.Model
|
||||
ID uint `gorm:"primarykey"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Identity string
|
||||
Origin string
|
||||
ServiceKey string
|
||||
|
@ -46,15 +54,16 @@ var psCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func psExecute() {
|
||||
fmt.Println("Blocks Registry:", registryUrl)
|
||||
pt := make([]PsTable, 0)
|
||||
body, err := utils.HttpGet(registryUrl)
|
||||
checkError(err)
|
||||
|
||||
var ms []ActionsReleases
|
||||
var ms JSONData
|
||||
err = json.Unmarshal(body, &ms)
|
||||
checkError(err)
|
||||
|
||||
for _, v := range ms {
|
||||
for _, v := range ms.Data {
|
||||
srvLine := getSrvStatus(v.ServiceKey)
|
||||
srvLine.ServiceKey = v.ServiceKey
|
||||
srvLine.Origin = v.Origin
|
||||
|
@ -83,10 +92,6 @@ func getSrvStatus(srv string) PsTable {
|
|||
|
||||
}
|
||||
|
||||
func getPerformance(srv string) string {
|
||||
|
||||
}
|
||||
|
||||
func getCurrentVersion(srv string) string {
|
||||
var data map[string]string
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ var (
|
|||
|
||||
func init() {
|
||||
// get os env.
|
||||
env.NewEnv()
|
||||
|
||||
psCmd.Flags().StringVarP(®istryUrl, "registry", "r", "", "registry url.")
|
||||
|
||||
|
|
Loading…
Reference in New Issue