config valid
This commit is contained in:
parent
32fcd9f691
commit
c6c3e4ed14
@ -4,5 +4,5 @@ Website = "http://legu.cc"
|
|||||||
Icon = "app.png"
|
Icon = "app.png"
|
||||||
Name = "RobotGUI"
|
Name = "RobotGUI"
|
||||||
ID = "cc.legu.app"
|
ID = "cc.legu.app"
|
||||||
Version = "1.2.9"
|
Version = "1.2.10"
|
||||||
Build = 39
|
Build = 40
|
||||||
|
@ -98,6 +98,7 @@ const (
|
|||||||
TOOLBAR_AUTO = "自动化"
|
TOOLBAR_AUTO = "自动化"
|
||||||
TOOLBAR_PING = "端口扫描"
|
TOOLBAR_PING = "端口扫描"
|
||||||
TOOLBAR_MGODB = "MongoDB"
|
TOOLBAR_MGODB = "MongoDB"
|
||||||
|
TOOLBAR_VALID = "配置校验"
|
||||||
|
|
||||||
TOOLBAR_PERF_TIP = "开始"
|
TOOLBAR_PERF_TIP = "开始"
|
||||||
TOOLBAR_PERF_CONF = "配置"
|
TOOLBAR_PERF_CONF = "配置"
|
||||||
|
@ -2,7 +2,7 @@ package storage
|
|||||||
|
|
||||||
import "go_dreamfactory/pb"
|
import "go_dreamfactory/pb"
|
||||||
|
|
||||||
//默认配置
|
// 默认配置
|
||||||
func NewDefaultConfig() *Config {
|
func NewDefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
Pressure: PressureConfig{
|
Pressure: PressureConfig{
|
||||||
@ -40,6 +40,7 @@ type Config struct {
|
|||||||
Servers []*ServerConfig `json:"servers,omitempty"` //区服配置
|
Servers []*ServerConfig `json:"servers,omitempty"` //区服配置
|
||||||
MgoDB *MgoDB `json:"mgoDB,omitempty"` //MongoDB配置
|
MgoDB *MgoDB `json:"mgoDB,omitempty"` //MongoDB配置
|
||||||
ServiceDBInfo *pb.ServiceDBInfo `json:"serviceDBInfo,omitempty"` //
|
ServiceDBInfo *pb.ServiceDBInfo `json:"serviceDBInfo,omitempty"` //
|
||||||
|
JsonDir string `json:"jsonDir,omitempty"` //json配置目录
|
||||||
}
|
}
|
||||||
|
|
||||||
type MgoDB struct {
|
type MgoDB struct {
|
||||||
@ -51,14 +52,14 @@ type MgoDB struct {
|
|||||||
Database string `json:"database,omitempty"`
|
Database string `json:"database,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//压测配置
|
// 压测配置
|
||||||
type PressureConfig struct {
|
type PressureConfig struct {
|
||||||
TimeoutMs int32 `json:"timeout,omitempty"` //超时时间 毫秒
|
TimeoutMs int32 `json:"timeout,omitempty"` //超时时间 毫秒
|
||||||
Concurrency int32 `json:"concurrency,omitempty"` //并发量
|
Concurrency int32 `json:"concurrency,omitempty"` //并发量
|
||||||
DurationS int32 `json:"duration,omitempty"` //持续时间 秒
|
DurationS int32 `json:"duration,omitempty"` //持续时间 秒
|
||||||
}
|
}
|
||||||
|
|
||||||
//luban
|
// luban
|
||||||
type LubanConfig struct {
|
type LubanConfig struct {
|
||||||
ServerAddr string
|
ServerAddr string
|
||||||
ProjectDir string
|
ProjectDir string
|
||||||
|
@ -33,7 +33,6 @@ var (
|
|||||||
logger *logrus.Logger
|
logger *logrus.Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
|
||||||
func init() {
|
func init() {
|
||||||
_ = os.Setenv("FYNE_SCALE", "0.9")
|
_ = os.Setenv("FYNE_SCALE", "0.9")
|
||||||
var err error
|
var err error
|
||||||
@ -162,7 +161,6 @@ func setupLogger() (err error) {
|
|||||||
|
|
||||||
// check version
|
// check version
|
||||||
func checkVersion(app fyne.App, parent fyne.Window) {
|
func checkVersion(app fyne.App, parent fyne.Window) {
|
||||||
logrus.Debug("check version")
|
|
||||||
b, err := connService.HttpConnect("http://10.0.0.9:8080/" + "version")
|
b, err := connService.HttpConnect("http://10.0.0.9:8080/" + "version")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dialog.ShowError(errors.New("版本检查:"+err.Error()), parent)
|
dialog.ShowError(errors.New("版本检查:"+err.Error()), parent)
|
||||||
|
File diff suppressed because one or more lines are too long
BIN
cmd/v2/theme/icon/excel.jpg
Normal file
BIN
cmd/v2/theme/icon/excel.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
cmd/v2/theme/icon/mongodb.jpg
Normal file
BIN
cmd/v2/theme/icon/mongodb.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
@ -34,6 +34,7 @@ var (
|
|||||||
&appTerm{},
|
&appTerm{},
|
||||||
&appPing{},
|
&appPing{},
|
||||||
&appMgo{},
|
&appMgo{},
|
||||||
|
&appConfigValid{},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -431,3 +431,6 @@ func openFile(entry *widget.Entry, w fyne.Window) {
|
|||||||
func (a *appGen) GetAppName() string {
|
func (a *appGen) GetAppName() string {
|
||||||
return common.TOOLBAR_GEN
|
return common.TOOLBAR_GEN
|
||||||
}
|
}
|
||||||
|
func(a *appGen) Icon() fyne.Resource{
|
||||||
|
return theme.ContentCopyIcon()
|
||||||
|
}
|
@ -11,6 +11,8 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
mytheme "go_dreamfactory/cmd/v2/theme"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
@ -244,3 +246,6 @@ func (this *appMgo) showConWin() {
|
|||||||
func (a *appMgo) GetAppName() string {
|
func (a *appMgo) GetAppName() string {
|
||||||
return common.TOOLBAR_MGODB
|
return common.TOOLBAR_MGODB
|
||||||
}
|
}
|
||||||
|
func (a *appMgo) Icon() fyne.Resource {
|
||||||
|
return mytheme.ResourceMongodbJpg
|
||||||
|
}
|
||||||
|
@ -68,3 +68,6 @@ func (this *appLock) LazyInit(ptService service.PttService, obs observer.Observe
|
|||||||
func (a *appLock) GetAppName() string {
|
func (a *appLock) GetAppName() string {
|
||||||
return common.TOOLBAR_SEC
|
return common.TOOLBAR_SEC
|
||||||
}
|
}
|
||||||
|
func (a *appLock) Icon() fyne.Resource {
|
||||||
|
return theme.DownloadIcon()
|
||||||
|
}
|
||||||
|
@ -191,6 +191,9 @@ func (this *appPbGen) LazyInit(ptService service.PttService, obs observer.Observ
|
|||||||
func (a *appPbGen) GetAppName() string {
|
func (a *appPbGen) GetAppName() string {
|
||||||
return common.TOOLBAR_PB
|
return common.TOOLBAR_PB
|
||||||
}
|
}
|
||||||
|
func (a *appPbGen) Icon() fyne.Resource {
|
||||||
|
return theme.ContentAddIcon()
|
||||||
|
}
|
||||||
|
|
||||||
type folderList struct {
|
type folderList struct {
|
||||||
selItemIds []string //选择的ID
|
selItemIds []string //选择的ID
|
||||||
|
@ -130,3 +130,7 @@ func (this *appPing) ping(targetHost string, ports []string) {
|
|||||||
func (a *appPing) GetAppName() string {
|
func (a *appPing) GetAppName() string {
|
||||||
return common.TOOLBAR_PING
|
return common.TOOLBAR_PING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *appPing) Icon() fyne.Resource {
|
||||||
|
return theme.ComputerIcon()
|
||||||
|
}
|
||||||
|
@ -549,6 +549,9 @@ func (app *appTerm) LazyInit(ptService service.PttService, obs observer.Observer
|
|||||||
func (a *appTerm) GetAppName() string {
|
func (a *appTerm) GetAppName() string {
|
||||||
return common.TOOLBAR_TERM
|
return common.TOOLBAR_TERM
|
||||||
}
|
}
|
||||||
|
func (a *appTerm) Icon() fyne.Resource {
|
||||||
|
return theme.MailSendIcon()
|
||||||
|
}
|
||||||
|
|
||||||
func OpenExplor(dir string) {
|
func OpenExplor(dir string) {
|
||||||
if dir == "" {
|
if dir == "" {
|
||||||
|
122
cmd/v2/ui/tool_valid.go
Normal file
122
cmd/v2/ui/tool_valid.go
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
package ui
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
|
os_storage "go_dreamfactory/cmd/v2/lib/storage"
|
||||||
|
"go_dreamfactory/cmd/v2/service"
|
||||||
|
"go_dreamfactory/cmd/v2/service/observer"
|
||||||
|
mytheme "go_dreamfactory/cmd/v2/theme"
|
||||||
|
"io/ioutil"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/dialog"
|
||||||
|
fyne_storage "fyne.io/fyne/v2/storage"
|
||||||
|
"fyne.io/fyne/v2/theme"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
type jsonFileList struct {
|
||||||
|
selItemId string //选择的文件ID
|
||||||
|
cacheList common.List
|
||||||
|
itemList *widget.List
|
||||||
|
fileTotal int //文件数
|
||||||
|
}
|
||||||
|
|
||||||
|
func newJsonFileList() *jsonFileList {
|
||||||
|
return &jsonFileList{
|
||||||
|
cacheList: common.NewList(""),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type appConfigValid struct {
|
||||||
|
appAdapter
|
||||||
|
jsonFileList
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *appConfigValid) LazyInit(pt service.PttService, obs observer.Observer) error {
|
||||||
|
a.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_VALID, mytheme.ResourceExcelJpg, nil)
|
||||||
|
a.jsonFileList = *newJsonFileList()
|
||||||
|
|
||||||
|
//load conf
|
||||||
|
storage, _ := os_storage.NewOSStorage()
|
||||||
|
conf, err := storage.LoadConfig()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf.JsonDir!=""{
|
||||||
|
|
||||||
|
}
|
||||||
|
content := container.NewMax()
|
||||||
|
content.Objects = []fyne.CanvasObject{}
|
||||||
|
|
||||||
|
// 打开目录
|
||||||
|
openFolder := func(entry *widget.Entry) {
|
||||||
|
dConf := dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) {
|
||||||
|
if lu == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
entry.Text = lu.Path()
|
||||||
|
entry.Refresh()
|
||||||
|
}, toolWin.w)
|
||||||
|
luri, _ := fyne_storage.ListerForURI(fyne_storage.NewFileURI("."))
|
||||||
|
dConf.SetLocation(luri)
|
||||||
|
dConf.SetConfirmText("打开")
|
||||||
|
dConf.SetDismissText("取消")
|
||||||
|
dConf.Resize(fyne.NewSize(750, 500))
|
||||||
|
dConf.Show()
|
||||||
|
}
|
||||||
|
//配置json路径
|
||||||
|
jsonDir := widget.NewEntry()
|
||||||
|
jsonDir.PlaceHolder = "json目录"
|
||||||
|
form := widget.NewForm(
|
||||||
|
widget.NewFormItem("json目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||||
|
openFolder(jsonDir)
|
||||||
|
a.jsonFileList.initItem(jsonDir.Text)
|
||||||
|
}), jsonDir)),
|
||||||
|
)
|
||||||
|
|
||||||
|
jsonDir.SetText(conf.JsonDir)
|
||||||
|
|
||||||
|
c := container.NewBorder(form, nil, nil, nil)
|
||||||
|
|
||||||
|
content.Objects = append(content.Objects, c)
|
||||||
|
a.tabItem.Content = content
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *appConfigValid) GetAppName() string {
|
||||||
|
return common.TOOLBAR_VALID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *appConfigValid) Icon() fyne.Resource {
|
||||||
|
return mytheme.ResourceExcelJpg
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *jsonFileList) initItem(dir string) {
|
||||||
|
files, err := ioutil.ReadDir(dir)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
if file.IsDir() {
|
||||||
|
if file.Name() == ".vscode" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fm := common.Item{
|
||||||
|
Text: file.Name(),
|
||||||
|
Checked: false,
|
||||||
|
}
|
||||||
|
f.cacheList.Items = append(f.cacheList.Items, fm)
|
||||||
|
// f.selItemIds = append(f.selItemIds, fm.Id)
|
||||||
|
f.fileTotal++
|
||||||
|
// logrus.Debugf("%v", fm.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,6 +10,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
mytheme "go_dreamfactory/cmd/v2/theme"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
@ -64,10 +66,15 @@ func NewToolWindow(ui *UIImpl, parent fyne.Window) ToolWindow {
|
|||||||
widget.NewToolbarAction(theme.ComputerIcon(), func() {
|
widget.NewToolbarAction(theme.ComputerIcon(), func() {
|
||||||
openApp2(mw.at, common.TOOLBAR_PING)
|
openApp2(mw.at, common.TOOLBAR_PING)
|
||||||
}),
|
}),
|
||||||
widget.NewToolbarAction(theme.SettingsIcon(), func() {
|
|
||||||
|
widget.NewToolbarAction(mytheme.ResourceMongodbJpg, func() {
|
||||||
openApp2(mw.at, common.TOOLBAR_MGODB)
|
openApp2(mw.at, common.TOOLBAR_MGODB)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
widget.NewToolbarAction(mytheme.ResourceExcelJpg, func() {
|
||||||
|
openApp2(mw.at, common.TOOLBAR_VALID)
|
||||||
|
}),
|
||||||
|
|
||||||
widget.NewToolbarSpacer(),
|
widget.NewToolbarSpacer(),
|
||||||
widget.NewToolbarAction(theme.HelpIcon(), func() {
|
widget.NewToolbarAction(theme.HelpIcon(), func() {
|
||||||
showAbout()
|
showAbout()
|
||||||
@ -126,7 +133,7 @@ func (ui *ToolWindowImpl) quiteHandle() {
|
|||||||
|
|
||||||
func (ui *ToolWindowImpl) syncConfig() {
|
func (ui *ToolWindowImpl) syncConfig() {
|
||||||
cli := http.Client{Timeout: time.Second * 10}
|
cli := http.Client{Timeout: time.Second * 10}
|
||||||
r, err := cli.Get("http://10.0.0.9:8081/prd/config.json")
|
r, err := cli.Get("http://10.0.0.9:8080/prd/config.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
dialog.ShowError(err, ui.w)
|
dialog.ShowError(err, ui.w)
|
||||||
|
Loading…
Reference in New Issue
Block a user