Skip to content

Commit

Permalink
v3.0.0-alpha - fixing tables
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Dec 9, 2022
1 parent 3fdd0fb commit 3767515
Show file tree
Hide file tree
Showing 81 changed files with 5,660 additions and 557 deletions.
193 changes: 91 additions & 102 deletions .idea/workspace.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion cmd/cmd_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ func (c *CmdShow) AttachCommand(cmd *cobra.Command) *cobra.Command {
cmd.AddCommand(c.SelfCmd)
c.SelfCmd.Example = cmdHelp.PrintExamples(c.SelfCmd, "")

c.AttachPsId(c.SelfCmd)
c.AttachPs(c.SelfCmd)
c.AttachDevice(c.SelfCmd)
c.AttachTemplate(c.SelfCmd)
c.AttachPoint(c.SelfCmd)
c.AttachMeta(c.SelfCmd)
}
return c.SelfCmd
}
2 changes: 1 addition & 1 deletion cmd/cmd_show_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *CmdShow) AttachDevicePoints(cmd *cobra.Command) *cobra.Command {
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcDevicePoints,
Args: cobra.MinimumNArgs(1),
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self,
Expand Down
66 changes: 66 additions & 0 deletions cmd/cmd_show_meta.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package cmd

import (
"fmt"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/cmdHelp"
"github.com/spf13/cobra"
)


func (c *CmdShow) AttachMeta(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
var self = &cobra.Command{
Use: "meta",
Aliases: []string{},
Annotations: map[string]string{"group": "Meta"},
Short: fmt.Sprintf("Meta related Sungrow commands."),
Long: fmt.Sprintf("Meta related Sungrow commands."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")

c.AttachMetaList(self)
// c.AttachMetaTree(self)
// c.AttachMetaPoints(self)
// c.AttachMetaData(self)
// c.AttachMetaGraph(self)
}
return c.SelfCmd
}


func (c *CmdShow) AttachMetaList(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "unit-list",
Aliases: []string{},
Annotations: map[string]string{"group": "Meta"},
Short: fmt.Sprintf("Show all unit lists."),
Long: fmt.Sprintf("Show all unit lists."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcMetaList,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")

return cmd
}
func (c *CmdShow) funcMetaList(_ *cobra.Command, _ []string) error {
for range Only.Once {
c.Error = cmds.Api.SunGrow.MetaUnitList()
if c.Error != nil {
break
}
}
return c.Error
}
2 changes: 1 addition & 1 deletion cmd/cmd_show_psid.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)


func (c *CmdShow) AttachPsId(cmd *cobra.Command) *cobra.Command {
func (c *CmdShow) AttachPs(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
var self = &cobra.Command{
Use: "ps",
Expand Down
18 changes: 9 additions & 9 deletions docs/data/getPsList.response.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"fault_alarm_offline_dev_count":0,
"fault_count":0,
"fault_dev_count":0,
"gcj_latitude":"-33.732621764598136",
"gcj_longitude":"151.04299275383877",
"gcj_latitude":"",
"gcj_longitude":"",
"gprs_latitude":null,
"gprs_longitude":null,
"images":[
Expand All @@ -87,11 +87,11 @@
"is_bank_ps":0,
"is_tuv":0,
"join_year_init_elec":0.0000,
"latitude":-35.4429347,
"latitude":,
"location":"HERE",
"longitude":147.7136952,
"map_latitude":"-35.4429347",
"map_longitude":"147.7136952",
"longitude":,
"map_latitude":"",
"map_longitude":"",
"mlpe_flag":0,
"nmi":"",
"offline_dev_count":0,
Expand Down Expand Up @@ -185,9 +185,9 @@
"value":"55.2"
},
"valid_flag":1,
"wgs_latitude":-33.73262176459814,
"wgs_longitude":151.04299275383877,
"zip_code":"2125"
"wgs_latitude":,
"wgs_longitude":,
"zip_code":""
}
],
"rowCount":1
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ require (
github.com/MickMake/GoUnify/cmdHelp v0.0.0-20221125023651-ff4a37b1928a
github.com/MickMake/GoUnify/cmdLog v0.0.0-20221125023651-ff4a37b1928a
github.com/MickMake/GoUnify/cmdPath v0.0.0-20221125023651-ff4a37b1928a
github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee
github.com/eclipse/paho.mqtt.golang v1.4.2
github.com/go-co-op/gocron v1.18.0
github.com/olekukonko/tablewriter v0.0.5
Expand All @@ -47,7 +46,6 @@ require (
github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 // indirect
github.com/alecthomas/chroma v0.7.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/bndr/gotabulate v1.1.2 // indirect
github.com/briandowns/spinner v1.19.0 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ github.com/abiosoft/ishell/v2 v2.0.2 h1:5qVfGiQISaYM8TkbBl7RFO6MddABoXpATrsFbVI+
github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs=
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db h1:CjPUSXOiYptLbTdr1RceuZgSFDQ7U15ITERUGrUORx8=
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530=
github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee h1:0RklYSvekYaIFI9JUx7TFPQvo++TdILmZiV17QI4nXk=
github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee/go.mod h1:M9nmO4lBRWR/bBv7UCOmDJ1MB2DVoqz19B4JchDA+K0=
github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 h1:XBNSe5eibe5Fh131ah+xnO6s4A97U1T3tKZKLQQvqu0=
github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4/go.mod h1:n7qJAqL9BKqGqiJyjPbWtxpdswTL5wX0IVP2Uw4vVhQ=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
Expand All @@ -85,8 +83,6 @@ github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkx
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U=
github.com/briandowns/spinner v1.19.0 h1:s8aq38H+Qju89yhp89b4iIiMzMm8YN3p6vGpwyh/a8E=
github.com/briandowns/spinner v1.19.0/go.mod h1:mQak9GHqbspjC/5iUx3qMlIho8xBS/ppAL/hX5SmPJU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
33 changes: 6 additions & 27 deletions iSolarCloud/AppService/exportParamSettingValPDF/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package exportParamSettingValPDF
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct"
"GoSungrow/iSolarCloud/api/GoStruct/valueTypes"

"github.com/MickMake/GoUnify/Only"
"fmt"
)

Expand All @@ -13,6 +13,7 @@ const Disabled = false
const EndPointName = "AppService.exportParamSettingValPDF"

type RequestData struct {
TaskId valueTypes.String `json:"task_id" required:"true"`
}

func (rd RequestData) IsValid() error {
Expand All @@ -25,40 +26,18 @@ func (rd RequestData) Help() string {
}


type ResultData struct {
// Dummy valueTypes.String `json:"dummy"`
type ResultData struct {
Code valueTypes.Integer `json:"code"`
ReturnValPdfURL valueTypes.String `json:"return_val_pdf_url"`
}

func (e *ResultData) IsValid() error {
var err error
return err
}

//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}

func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
}

entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
return entries
}
32 changes: 5 additions & 27 deletions iSolarCloud/AppService/exportPlantReportPDF/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package exportPlantReportPDF
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct"
"GoSungrow/iSolarCloud/api/GoStruct/valueTypes"

"github.com/MickMake/GoUnify/Only"
"fmt"
)

Expand All @@ -13,6 +13,7 @@ const Disabled = false
const EndPointName = "AppService.exportPlantReportPDF"

type RequestData struct {
PsId valueTypes.PsId `json:"ps_id" required:"true"`
}

func (rd RequestData) IsValid() error {
Expand All @@ -25,40 +26,17 @@ func (rd RequestData) Help() string {
}


type ResultData struct {
// Dummy valueTypes.String `json:"dummy"`
type ResultData struct {
Code valueTypes.String `json:"code"`
}

func (e *ResultData) IsValid() error {
var err error
return err
}

//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}

func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
}

entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
return entries
}
28 changes: 2 additions & 26 deletions iSolarCloud/AppService/getApiCallsForAppkeys/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct"

"github.com/MickMake/GoUnify/Only"
"fmt"
)

Expand All @@ -25,40 +24,17 @@ func (rd RequestData) Help() string {
}


type ResultData struct {
// Dummy valueTypes.String `json:"dummy"`
type ResultData []struct {
}

func (e *ResultData) IsValid() error {
var err error
return err
}

//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}

func (e *EndPoint) GetData() api.DataMap {
entries := api.NewDataMap()

for range Only.Once {
entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
}

entries.StructToDataMap(*e, "", GoStruct.EndPointPath{})
return entries
}
Loading

0 comments on commit 3767515

Please sign in to comment.