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