Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
344f4819
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
11 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
344f4819
编写于
3月 23, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
send zentao request error to client
上级
bd1dc70f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
55 addition
and
22 deletion
+55
-22
internal/comm/consts/enum.go
internal/comm/consts/enum.go
+10
-9
internal/comm/helper/zentao/zentao.go
internal/comm/helper/zentao/zentao.go
+1
-1
internal/pkg/lib/http/http.go
internal/pkg/lib/http/http.go
+21
-0
internal/server/middleware/initcheck.go
internal/server/middleware/initcheck.go
+1
-1
internal/server/modules/v1/controller/base.go
internal/server/modules/v1/controller/base.go
+1
-1
internal/server/modules/v1/controller/zentao.go
internal/server/modules/v1/controller/zentao.go
+12
-7
ui/src/utils/cache.ts
ui/src/utils/cache.ts
+2
-0
ui/src/views/script/index.vue
ui/src/views/script/index.vue
+3
-1
ui/src/views/workspace/index.vue
ui/src/views/workspace/index.vue
+4
-2
未找到文件。
internal/comm/consts/enum.go
浏览文件 @
344f4819
package
commConsts
type
ResponseCode
struct
{
Code
int64
`json:"code"`
Key
string
`json:"message"`
Code
int64
`json:"code"`
Message
string
`json:"message"`
}
var
(
Success
=
ResponseCode
{
0
,
"request_success"
}
CommErr
=
ResponseCode
{
100
,
"comm_err"
}
ParamErr
=
ResponseCode
{
200
,
"param_error"
}
NeedInitErr
=
ResponseCode
{
1000
,
"data_not_init"
}
BizErrWorkspaceConfig
=
ResponseCode
{
2000
,
"workspace_config_err"
}
BizErrNameNotExist
=
ResponseCode
{
3000
,
"record_not_found_by_name"
}
Success
=
ResponseCode
{
0
,
"request success"
}
CommErr
=
ResponseCode
{
100
,
"common err"
}
ParamErr
=
ResponseCode
{
200
,
"param error"
}
UnAuthorizedErr
=
ResponseCode
{
401
,
"unauthorized"
}
NeedInitErr
=
ResponseCode
{
1000
,
"data not init"
}
BizErrZentaoRequest
=
ResponseCode
{
2000
,
"zentao request err"
}
BizErrNameNotExist
=
ResponseCode
{
3000
,
"record not found"
}
)
type
ResultStatus
string
...
...
internal/comm/helper/zentao/zentao.go
浏览文件 @
344f4819
...
...
@@ -89,7 +89,7 @@ func LoadSiteProduct(currSite serverDomain.ZentaoSite, currProductId int) (
products
,
err
=
loadProduct
(
config
)
if
err
!=
nil
{
products
=
make
([]
serverDomain
.
ZentaoProduct
,
0
)
return
}
var
first
serverDomain
.
ZentaoProduct
...
...
internal/pkg/lib/http/http.go
浏览文件 @
344f4819
...
...
@@ -9,6 +9,7 @@ import (
"github.com/aaronchen2k/deeptest/internal/pkg/lib/log"
serverDomain
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/domain"
"github.com/ajg/form"
"github.com/bitly/go-simplejson"
"github.com/fatih/color"
"io/ioutil"
"net/http"
...
...
@@ -51,6 +52,16 @@ func Get(url string) (ret []byte, err error) {
logUtils
.
Infof
(
logUtils
.
ConvertUnicode
(
ret
))
}
jsn
,
err
:=
simplejson
.
NewJson
(
ret
)
if
err
!=
nil
{
return
}
errMsg
,
_
:=
jsn
.
Get
(
"error"
)
.
String
()
if
strings
.
ToLower
(
errMsg
)
==
"unauthorized"
{
err
=
errors
.
New
(
commConsts
.
UnAuthorizedErr
.
Message
)
return
}
return
}
...
...
@@ -102,6 +113,16 @@ func Post(url string, data interface{}) (ret []byte, err error) {
logUtils
.
Infof
(
logUtils
.
ConvertUnicode
(
ret
))
}
jsn
,
err
:=
simplejson
.
NewJson
(
ret
)
if
err
!=
nil
{
return
}
errMsg
,
_
:=
jsn
.
Get
(
"error"
)
.
String
()
if
strings
.
ToLower
(
errMsg
)
==
"unauthorized"
{
err
=
errors
.
New
(
commConsts
.
UnAuthorizedErr
.
Message
)
return
}
return
}
...
...
internal/server/middleware/initcheck.go
浏览文件 @
344f4819
...
...
@@ -15,7 +15,7 @@ func InitCheck() iris.Handler {
return
func
(
ctx
*
context
.
Context
)
{
if
dao
.
GetDB
()
==
nil
{
ctx
.
StopWithJSON
(
http
.
StatusOK
,
domain
.
Response
{
Code
:
commConsts
.
NeedInitErr
.
Code
,
Msg
:
i118Utils
.
Sprintf
(
commConsts
.
NeedInitErr
.
Key
)})
domain
.
Response
{
Code
:
commConsts
.
NeedInitErr
.
Code
,
Msg
:
i118Utils
.
Sprintf
(
commConsts
.
NeedInitErr
.
Message
)})
return
}
...
...
internal/server/modules/v1/controller/base.go
浏览文件 @
344f4819
...
...
@@ -26,7 +26,7 @@ func (c *BaseCtrl) ErrResp(err commConsts.ResponseCode, msg string) (ret domain.
}
func
(
c
*
BaseCtrl
)
ErrMsg
(
err
commConsts
.
ResponseCode
,
msg
string
)
(
ret
string
)
{
ret
=
i118Utils
.
Sprintf
(
err
.
Key
)
ret
=
i118Utils
.
Sprintf
(
err
.
Message
)
if
ret
!=
""
{
ret
+=
": "
...
...
internal/server/modules/v1/controller/zentao.go
浏览文件 @
344f4819
...
...
@@ -28,7 +28,7 @@ func (c *ZentaoCtrl) GetProfile(ctx iris.Context) {
data
,
err
:=
zentaoHelper
.
GetProfile
(
workspacePath
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErr
WorkspaceConfig
,
err
.
Error
()))
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErr
ZentaoRequest
,
err
.
Error
()))
return
}
...
...
@@ -40,7 +40,12 @@ func (c *ZentaoCtrl) ListSiteAndProduct(ctx iris.Context) {
currProductId
,
_
:=
ctx
.
URLParamInt
(
"currProductId"
)
sites
,
currSite
,
_
:=
c
.
SiteService
.
LoadSites
(
currSiteId
)
products
,
currProduct
,
_
:=
zentaoHelper
.
LoadSiteProduct
(
currSite
,
currProductId
)
products
,
currProduct
,
err
:=
zentaoHelper
.
LoadSiteProduct
(
currSite
,
currProductId
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErrZentaoRequest
,
err
.
Error
()))
return
}
data
:=
iris
.
Map
{
"sites"
:
sites
,
"products"
:
products
,
"currSite"
:
currSite
,
"currProduct"
:
currProduct
}
...
...
@@ -57,7 +62,7 @@ func (c *ZentaoCtrl) ListProduct(ctx iris.Context) {
data
,
err
:=
zentaoHelper
.
ListProduct
(
workspacePath
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErr
WorkspaceConfig
,
err
.
Error
()))
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErr
ZentaoRequest
,
err
.
Error
()))
return
}
...
...
@@ -74,7 +79,7 @@ func (c *ZentaoCtrl) ListModule(ctx iris.Context) {
data
,
err
:=
zentaoHelper
.
ListModule
(
productId
,
workspacePath
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
CommErr
,
err
.
Error
()))
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErrZentaoRequest
,
err
.
Error
()))
return
}
...
...
@@ -91,7 +96,7 @@ func (c *ZentaoCtrl) ListSuite(ctx iris.Context) {
data
,
err
:=
zentaoHelper
.
ListSuite
(
productId
,
workspacePath
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
CommErr
,
err
.
Error
()))
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErrZentaoRequest
,
err
.
Error
()))
return
}
...
...
@@ -108,7 +113,7 @@ func (c *ZentaoCtrl) ListTask(ctx iris.Context) {
data
,
err
:=
zentaoHelper
.
ListTask
(
productId
,
workspacePath
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
CommErr
,
err
.
Error
()))
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErrZentaoRequest
,
err
.
Error
()))
return
}
...
...
@@ -126,7 +131,7 @@ func (c *ZentaoCtrl) GetDataForBugSubmition(ctx iris.Context) {
fields
,
err
:=
zentaoHelper
.
GetBugFiledOptions
(
req
,
workspacePath
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
CommErr
,
err
.
Error
()))
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
BizErrZentaoRequest
,
err
.
Error
()))
return
}
...
...
ui/src/utils/cache.ts
浏览文件 @
344f4819
...
...
@@ -24,6 +24,8 @@ export const getCurrProductIdBySite = async (currSiteId) => {
return
currProductId
}
export
const
setCurrProductIdBySite
=
async
(
currSiteId
,
currProductId
)
=>
{
if
(
!
currSiteId
)
return
let
mp
=
await
getCache
(
settings
.
currProductIdBySite
);
if
(
!
mp
)
mp
=
{}
mp
[
currSiteId
+
''
]
=
currProductId
...
...
ui/src/views/script/index.vue
浏览文件 @
344f4819
...
...
@@ -62,8 +62,10 @@
<div
id=
"content"
>
<div
class=
"toolbar"
>
<a-button
@
click=
"extract"
type=
"primary"
size=
"small"
>
{{ t('extract_step') }}
</a-button>
<a-button
v-if=
"scriptCode !== ''"
@
click=
"extract"
type=
"primary"
size=
"small"
>
{{ t('extract_step') }}
</a-button>
</div>
<div
class=
"editor-panel"
>
<MonacoEditor
v-if=
"scriptCode !== ''"
...
...
ui/src/views/workspace/index.vue
浏览文件 @
344f4819
...
...
@@ -13,10 +13,10 @@
placeholder=
"输入关键字搜索"
style=
"width:270px;margin-left: 16px;"
/>
</div>
</div>
</
template
>
<
template
#extra
>
<a-button
type=
"primary"
@
click=
"create()"
>
<a-button
v-if=
"currProduct?.id"
type=
"primary"
@
click=
"create()"
>
<template
#icon
><PlusCircleOutlined
/></
template
>
{{t('create_workspace')}}
</a-button>
...
...
@@ -86,6 +86,7 @@ interface WorkspaceListSetupData {
pagination
:
ComputedRef
<
PaginationConfig
>
;
columns
:
any
;
currProduct
:
ComputedRef
models
:
ComputedRef
<
any
[]
>
;
loading
:
Ref
<
boolean
>
;
getList
:
(
curr
)
=>
void
...
...
@@ -223,6 +224,7 @@ export default defineComponent({
queryParams
,
pagination
,
currProduct
,
columns
,
models
,
loading
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录