Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
0a4fc57f
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
0a4fc57f
编写于
8月 05, 2019
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add report bug ui
上级
d670c692
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
190 addition
and
10 deletion
+190
-10
src/model/http.go
src/model/http.go
+13
-0
src/model/test.go
src/model/test.go
+0
-6
src/model/zentao.go
src/model/zentao.go
+24
-0
src/ui/pageReportBug.go
src/ui/pageReportBug.go
+148
-0
src/ui/pageTestResult.go
src/ui/pageTestResult.go
+5
-4
未找到文件。
src/model/http.go
0 → 100644
浏览文件 @
0a4fc57f
package
model
type
Response
struct
{
Code
int
Name
string
Modules
[]
Module
Categories
[]
Category
Versions
[]
Version
Priorities
[]
Priority
Cases
[]
TestCase
}
src/model/
model
.go
→
src/model/
test
.go
浏览文件 @
0a4fc57f
...
...
@@ -2,12 +2,6 @@ package model
import
"github.com/easysoft/zentaoatf/src/misc"
type
Response
struct
{
Code
int
Name
string
Cases
[]
TestCase
}
type
TestCase
struct
{
Id
int
Title
string
...
...
src/model/zentao.go
0 → 100644
浏览文件 @
0a4fc57f
package
model
type
Module
struct
{
Id
string
Code
string
Name
string
}
type
Category
struct
{
Id
string
Code
string
Name
string
}
type
Version
struct
{
Id
string
Code
string
Name
string
}
type
Priority
struct
{
Id
string
Code
string
Name
string
}
src/ui/pageReportBug.go
浏览文件 @
0a4fc57f
package
ui
import
(
"encoding/json"
"fmt"
"github.com/easysoft/zentaoatf/src/action"
httpClient
"github.com/easysoft/zentaoatf/src/http"
"github.com/easysoft/zentaoatf/src/utils"
"github.com/jroimartin/gocui"
"strings"
"time"
)
func
InitReportBugPage
()
error
{
DestoryReportBugPage
()
maxX
,
maxY
:=
utils
.
Cui
.
Size
()
x
:=
maxX
/
2
-
50
y
:=
maxY
/
2
-
14
reportBugPanel
:=
NewPanelWidget
(
"reportBugPanel"
,
x
,
y
,
100
,
25
,
""
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
reportBugPanel
.
Name
())
y
+=
1
reportBugTitle
:=
NewLabelWidgetAutoWidth
(
"reportBugTitle"
,
x
+
2
+
LabelWidth
+
Space
,
y
,
"Report Bug"
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
reportBugTitle
.
Name
())
// title
y
+=
2
left
:=
x
+
2
right
:=
left
+
LabelWidth
titleLabel
:=
NewLabelWidget
(
"titleLabel"
,
left
,
y
+
1
,
"Title"
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
titleLabel
.
Name
())
left
=
right
+
Space
right
=
left
+
TextWidthFull
titleInput
:=
NewTextWidget
(
"titleInput"
,
left
,
y
+
1
,
TextWidthFull
,
""
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
titleInput
.
Name
())
// module
left
=
x
+
2
right
=
left
+
LabelWidth
moduleLabel
:=
NewLabelWidget
(
"moduleLabel"
,
left
,
y
+
4
,
"Module"
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
moduleLabel
.
Name
())
left
=
right
+
Space
right
=
left
+
TextWidthHalf
moduleInput
:=
NewTextWidget
(
"moduleInput"
,
left
,
y
+
4
,
TextWidthHalf
,
""
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
moduleInput
.
Name
())
// category
left
=
right
+
Space
right
=
left
+
LabelWidth
categoryLabel
:=
NewLabelWidget
(
"categoryLabel"
,
left
,
y
+
4
,
"Category"
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
categoryLabel
.
Name
())
left
=
right
+
Space
right
=
left
+
TextWidthHalf
categoryInput
:=
NewTextWidget
(
"categoryInput"
,
left
,
y
+
4
,
TextWidthHalf
,
""
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
categoryInput
.
Name
())
// version
left
=
x
+
2
right
=
left
+
LabelWidth
versionLabel
:=
NewLabelWidget
(
"versionLabel"
,
left
,
y
+
7
,
"Version"
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
versionLabel
.
Name
())
left
=
right
+
Space
right
=
left
+
TextWidthHalf
versionInput
:=
NewTextWidget
(
"versionInput"
,
left
,
y
+
7
,
TextWidthHalf
,
""
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
versionInput
.
Name
())
// priority
left
=
right
+
Space
right
=
left
+
LabelWidth
priorityLabel
:=
NewLabelWidget
(
"priorityLabel"
,
left
,
y
+
7
,
"Priority"
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
priorityLabel
.
Name
())
left
=
right
+
Space
right
=
left
+
TextWidthHalf
priorityInput
:=
NewTextWidget
(
"priorityInput"
,
left
,
y
+
7
,
TextWidthHalf
,
""
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
priorityInput
.
Name
())
// buttons
buttonX
:=
maxX
/
2
-
50
+
2
+
LabelWidth
+
Space
submitInput
:=
NewButtonWidgetAutoWidth
(
"submitInput"
,
buttonX
,
y
+
10
,
"Submit"
,
reportBug
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
submitInput
.
Name
())
cancelReportBugInput
:=
NewButtonWidgetAutoWidth
(
"cancelReportBugInput"
,
buttonX
+
12
,
y
+
10
,
"Cancel"
,
cancelReportBug
)
ViewMap
[
"reportBug"
]
=
append
(
ViewMap
[
"reportBug"
],
cancelReportBugInput
.
Name
())
keyBindsInput
(
ViewMap
[
"reportBug"
])
return
nil
}
func
reportBug
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
urlView
,
_
:=
g
.
View
(
"urlInput"
)
productView
,
_
:=
g
.
View
(
"productInput"
)
taskView
,
_
:=
g
.
View
(
"taskInput"
)
languageView
,
_
:=
g
.
View
(
"languageInput"
)
singleFileView
,
_
:=
g
.
View
(
"singleFileInput"
)
url
:=
strings
.
TrimSpace
(
urlView
.
ViewBuffer
())
productCode
:=
strings
.
TrimSpace
(
productView
.
Buffer
())
taskId
:=
strings
.
TrimSpace
(
taskView
.
Buffer
())
language
:=
strings
.
TrimSpace
(
languageView
.
Buffer
())
singleFileStr
:=
strings
.
TrimSpace
(
singleFileView
.
Buffer
())
singleFile
:=
ParseRadioVal
(
singleFileStr
)
params
:=
make
(
map
[
string
]
string
)
if
productCode
!=
""
{
params
[
"entityType"
]
=
"product"
params
[
"entityVal"
]
=
productCode
}
else
{
params
[
"entityType"
]
=
"task"
params
[
"entityVal"
]
=
taskId
}
jsonStr
,
_
:=
json
.
Marshal
(
params
)
url
=
utils
.
UpdateUrl
(
url
)
utils
.
PrintToCmd
(
fmt
.
Sprintf
(
"#atf gen -u %s -t %s -v %s -l %s -s %t"
,
url
,
params
[
"entityType"
],
params
[
"entityVal"
],
language
,
singleFile
))
json
,
e
:=
httpClient
.
Post
(
url
+
utils
.
UrlImportProject
,
string
(
jsonStr
))
if
e
!=
nil
{
utils
.
PrintToCmd
(
e
.
Error
())
return
nil
}
count
,
err
:=
action
.
Generate
(
json
,
url
,
params
[
"entityType"
],
params
[
"entityVal"
],
language
,
singleFile
)
if
err
==
nil
{
utils
.
PrintToCmd
(
fmt
.
Sprintf
(
"success to generate %d test scripts in '%s' at %s"
,
count
,
utils
.
ScriptDir
,
utils
.
DateTimeStr
(
time
.
Now
())))
}
else
{
utils
.
PrintToCmd
(
err
.
Error
())
}
return
nil
}
func
cancelReportBug
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
DestoryReportBugPage
()
return
nil
}
func
DestoryReportBugPage
()
{
for
_
,
v
:=
range
ViewMap
[
"reportBug"
]
{
utils
.
Cui
.
DeleteView
(
v
)
utils
.
Cui
.
DeleteKeybindings
(
v
)
}
}
src/ui/pageTestResult.go
浏览文件 @
0a4fc57f
...
...
@@ -69,7 +69,7 @@ func selectResultEvent(g *gocui.Gui, v *gocui.View) error {
fmt
.
Fprintln
(
panelCaseList
,
strings
.
Join
(
content
,
"
\n
"
))
maxX
,
_
:=
g
.
Size
()
uploadButton
:=
NewButtonWidgetAutoWidth
(
"uploadButton"
,
maxX
-
35
,
0
,
"[Upload Result]"
,
u
ploadResult
)
uploadButton
:=
NewButtonWidgetAutoWidth
(
"uploadButton"
,
maxX
-
35
,
0
,
"[Upload Result]"
,
toU
ploadResult
)
uploadButton
.
Frame
=
false
runViews
=
append
(
runViews
,
uploadButton
.
Name
())
...
...
@@ -88,7 +88,7 @@ func selectCaseEvent(g *gocui.Gui, v *gocui.View) error {
// show submit bug button
maxX
,
_
:=
g
.
Size
()
bugButton
:=
NewButtonWidgetAutoWidth
(
"bugButton"
,
maxX
-
18
,
0
,
"[Report Bug]"
,
r
eportBug
)
bugButton
:=
NewButtonWidgetAutoWidth
(
"bugButton"
,
maxX
-
18
,
0
,
"[Report Bug]"
,
toR
eportBug
)
bugButton
.
Frame
=
false
runViews
=
append
(
runViews
,
bugButton
.
Name
())
...
...
@@ -103,7 +103,7 @@ func clearPanelCaseResult() {
utils
.
Cui
.
DeleteView
(
"bugButton"
)
}
func
u
ploadResult
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
func
toU
ploadResult
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
caseList
:=
script
.
GetTestResult
(
CurrAsset
,
CurrResult
)
biz
.
SubmitResult
(
caseList
)
...
...
@@ -111,7 +111,8 @@ func uploadResult(g *gocui.Gui, v *gocui.View) error {
return
nil
}
func
reportBug
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
func
toReportBug
(
g
*
gocui
.
Gui
,
v
*
gocui
.
View
)
error
{
InitReportBugPage
()
return
nil
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录