提交 7db1d9d7 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix issues

上级 1ec5a4f7
......@@ -25,14 +25,15 @@ func LoadBySite(site model.Site) (config commDomain.WorkspaceConf) {
return config
}
func LoadByWorkspacePath(workspacePath string) (config commDomain.WorkspaceConf) {
pth := filepath.Join(workspacePath, commConsts.ConfigDir, commConsts.ConfigFile)
ini.MapTo(&config, pth)
func LoadByConfigPath(configPath string) (config commDomain.WorkspaceConf) {
ini.MapTo(&config, configPath)
config.Url = commonUtils.AddSlashForUrl(config.Url)
return config
}
func LoadByWorkspacePath(workspacePath string) (config commDomain.WorkspaceConf) {
pth := filepath.Join(workspacePath, commConsts.ConfigDir, commConsts.ConfigFile)
return LoadByConfigPath(pth)
}
func UpdateSite(site model.Site, workspacePath string) (err error) {
config := LoadByWorkspacePath(workspacePath)
......
......@@ -6,6 +6,7 @@ import (
commDomain "github.com/easysoft/zentaoatf/internal/comm/domain"
configHelper "github.com/easysoft/zentaoatf/internal/comm/helper/config"
scriptHelper "github.com/easysoft/zentaoatf/internal/comm/helper/script"
zentaoHelper "github.com/easysoft/zentaoatf/internal/comm/helper/zentao"
commonUtils "github.com/easysoft/zentaoatf/internal/pkg/lib/common"
i118Utils "github.com/easysoft/zentaoatf/internal/pkg/lib/i118"
logUtils "github.com/easysoft/zentaoatf/internal/pkg/lib/log"
......@@ -120,11 +121,18 @@ func InputForSet(dir string) {
stdinUtils.InputForBool(&configSite, true, "config_zentao_site")
if configSite {
SetZentao:
conf.Url = stdinUtils.GetInput("((http|https)://.*)", conf.Url, "enter_url", conf.Url)
conf.Url = getZenTaoBaseUrl(conf.Url)
conf.Username = stdinUtils.GetInput("(.{2,})", conf.Username, "enter_account", conf.Username)
conf.Password = stdinUtils.GetInput("(.{2,})", conf.Password, "enter_password", conf.Password)
err := zentaoHelper.Login(conf)
if err != nil {
goto SetZentao
}
}
if commonUtils.IsWin() {
......
......@@ -27,11 +27,14 @@ func InitConfig() {
commConsts.WorkDir = fileUtils.GetWorkDir()
commConsts.ZtfDir = fileUtils.GetZTFDir()
commConsts.ConfigPath = commConsts.WorkDir + commConsts.ConfigFile
commConsts.ConfigPath = filepath.Join(commConsts.WorkDir, commConsts.ConfigDir, commConsts.ConfigFile)
if commConsts.IsRelease {
commConsts.ConfigPath = commConsts.ZtfDir + commConsts.ConfigFile
commConsts.ConfigPath = filepath.Join(commConsts.ZtfDir, commConsts.ConfigDir, commConsts.ConfigFile)
}
config := configHelper.LoadByConfigPath(commConsts.ConfigPath)
commConsts.Language = config.Language
v := viper.New()
serverConfig.VIPER = v
serverConfig.VIPER.SetConfigType("yaml")
......
......@@ -13,13 +13,17 @@ import (
)
func Get(url string) (ret []byte, err error) {
logUtils.Infof("===DEBUG=== request: %s", url)
if commConsts.Verbose {
logUtils.Infof("===DEBUG=== request: %s", url)
}
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
logUtils.Infof(color.RedString("get request failed, error: %s.", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("get request failed, error: %s.", err.Error()))
}
return
}
......@@ -30,12 +34,16 @@ func Get(url string) (ret []byte, err error) {
resp, err := client.Do(req)
defer resp.Body.Close()
if err != nil {
logUtils.Infof(color.RedString("get request failed, error: %s.", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("get request failed, error: %s.", err.Error()))
}
return
}
if !IsSuccessCode(resp.StatusCode) {
logUtils.Infof(color.RedString("read response failed, StatusCode: %d.", resp.StatusCode))
if commConsts.Verbose {
logUtils.Infof(color.RedString("read response failed, StatusCode: %d.", resp.StatusCode))
}
err = errors.New(resp.Status)
return
}
......@@ -46,7 +54,9 @@ func Get(url string) (ret []byte, err error) {
}
if err != nil {
logUtils.Infof(color.RedString("read response failed, error ", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("read response failed, error ", err.Error()))
}
return
}
......@@ -75,7 +85,9 @@ func Put(url string, data interface{}) (ret []byte, err error) {
}
func PostOrPut(url string, method string, data interface{}) (ret []byte, err error) {
logUtils.Infof("===DEBUG=== request: %s", url)
if commConsts.Verbose {
logUtils.Infof("===DEBUG=== request: %s", url)
}
client := &http.Client{}
......@@ -85,7 +97,9 @@ func PostOrPut(url string, method string, data interface{}) (ret []byte, err err
}
if err != nil {
logUtils.Infof(color.RedString("marshal request failed, error: %s.", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("marshal request failed, error: %s.", err.Error()))
}
return
}
......@@ -93,7 +107,9 @@ func PostOrPut(url string, method string, data interface{}) (ret []byte, err err
req, err := http.NewRequest(method, url, strings.NewReader(dataStr))
if err != nil {
logUtils.Infof(color.RedString("post request failed, error: %s.", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("post request failed, error: %s.", err.Error()))
}
return
}
......@@ -105,12 +121,16 @@ func PostOrPut(url string, method string, data interface{}) (ret []byte, err err
resp, err := client.Do(req)
if err != nil {
logUtils.Infof(color.RedString("post request failed, error: %s.", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("post request failed, error: %s.", err.Error()))
}
return
}
if !IsSuccessCode(resp.StatusCode) {
logUtils.Infof(color.RedString("post request return '%s'.", resp.Status))
if commConsts.Verbose {
logUtils.Infof(color.RedString("post request return '%s'.", resp.Status))
}
err = errors.New(resp.Status)
return
}
......@@ -123,7 +143,9 @@ func PostOrPut(url string, method string, data interface{}) (ret []byte, err err
}
if err != nil {
logUtils.Infof(color.RedString("read response failed, error: %s.", err.Error()))
if commConsts.Verbose {
logUtils.Infof(color.RedString("read response failed, error: %s.", err.Error()))
}
return
}
......
......@@ -109,7 +109,7 @@ onBeforeUnmount( () => {
}
#centerPane {
min-width: var(--pane-center-min-width, 100px);
min-width: 500px;
#tabsPane {
min-width: var(--pane-tabs-min-width, 100px);
......
......@@ -158,7 +158,7 @@
/* Panel settings 面板设置 */
--pane-left-min-width: 230px;
--pane-center-min-width: 100px;
--pane-center-min-width: 500px;
--pane-right-min-width: 200px;
--pane-tabs-min-height: 200px;
--pane-bottom-min-height: 200px;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册