提交 6dce10bd 编写于 作者: Z zhaoke

Merge branch 'morden-ui' of github.com:easysoft/zentaoatf into morden-ui

...@@ -24,8 +24,9 @@ var ( ...@@ -24,8 +24,9 @@ var (
productId string productId string
moduleId string moduleId string
taskId string taskIdOrName string
suiteId string suiteId string
taskName string
noNeedConfirm bool noNeedConfirm bool
...@@ -52,8 +53,8 @@ func main() { ...@@ -52,8 +53,8 @@ func main() {
flagSet.StringVar(&suiteId, "s", "", "") flagSet.StringVar(&suiteId, "s", "", "")
flagSet.StringVar(&suiteId, "suite", "", "") flagSet.StringVar(&suiteId, "suite", "", "")
flagSet.StringVar(&taskId, "t", "", "") flagSet.StringVar(&taskIdOrName, "t", "", "")
flagSet.StringVar(&taskId, "task", "", "") flagSet.StringVar(&taskIdOrName, "task", "", "")
flagSet.StringVar(&language, "l", "", "") flagSet.StringVar(&language, "l", "", "")
flagSet.StringVar(&language, "language", "", "") flagSet.StringVar(&language, "language", "", "")
...@@ -96,7 +97,7 @@ func main() { ...@@ -96,7 +97,7 @@ func main() {
case "checkout", "co": case "checkout", "co":
if err := flagSet.Parse(os.Args[2:]); err == nil { if err := flagSet.Parse(os.Args[2:]); err == nil {
action.Checkout(productId, moduleId, suiteId, taskId, independentFile, language) action.Checkout(productId, moduleId, suiteId, taskIdOrName, independentFile, language)
} }
case "ci": case "ci":
...@@ -108,8 +109,8 @@ func main() { ...@@ -108,8 +109,8 @@ func main() {
case "cr": case "cr":
files := fileUtils.GetFilesFromParams(os.Args[2:]) files := fileUtils.GetFilesFromParams(os.Args[2:])
if err := flagSet.Parse(os.Args[len(files)+2:]); err == nil { if err := flagSet.Parse(os.Args[len(files)+2:]); err == nil {
action.CommitZTFTestResult(files, stringUtils.ParseInt(productId), stringUtils.ParseInt(taskId), action.CommitZTFTestResult(files, stringUtils.ParseInt(productId),
noNeedConfirm) taskIdOrName, noNeedConfirm)
} }
case "cb": case "cb":
...@@ -166,7 +167,7 @@ func run(args []string) { ...@@ -166,7 +167,7 @@ func run(args []string) {
if commConsts.AutoCommitResult && productId != "" { if commConsts.AutoCommitResult && productId != "" {
action.CommitZTFTestResult([]string{commConsts.ExecLogDir}, action.CommitZTFTestResult([]string{commConsts.ExecLogDir},
stringUtils.ParseInt(productId), stringUtils.ParseInt(productId), true) stringUtils.ParseInt(productId), taskIdOrName, true)
} }
if commConsts.AutoCommitBug && productId != "" { if commConsts.AutoCommitBug && productId != "" {
...@@ -198,7 +199,7 @@ func runFuncTest(args []string) { ...@@ -198,7 +199,7 @@ func runFuncTest(args []string) {
msgStr := i118Utils.Sprintf("run_with_specific_interpreter", commConsts.Interpreter) msgStr := i118Utils.Sprintf("run_with_specific_interpreter", commConsts.Interpreter)
logUtils.ExecConsolef(color.FgCyan, msgStr) logUtils.ExecConsolef(color.FgCyan, msgStr)
} }
action.RunZTFTest(files, moduleId, suiteId, taskId) action.RunZTFTest(files, moduleId, suiteId, taskIdOrName)
} }
func runUnitTest(args []string) { func runUnitTest(args []string) {
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
"strconv" "strconv"
) )
func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bool) { func CommitZTFTestResult(files []string, productId int, taskIdOrName string, noNeedConfirm bool) {
var resultDir string var resultDir string
if len(files) > 0 { if len(files) > 0 {
resultDir = files[0] resultDir = files[0]
...@@ -26,6 +26,12 @@ func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bo ...@@ -26,6 +26,12 @@ func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bo
productId, _ = strconv.Atoi(productIdStr) productId, _ = strconv.Atoi(productIdStr)
} }
taskName := ""
taskId, err := strconv.Atoi(taskIdOrName)
if err != nil {
taskName = taskIdOrName
}
if taskId == 0 && !noNeedConfirm { if taskId == 0 && !noNeedConfirm {
taskIdStr := stdinUtils.GetInput("\\d*", "", taskIdStr := stdinUtils.GetInput("\\d*", "",
i118Utils.Sprintf("pls_enter")+" "+i118Utils.Sprintf("task_id")+ i118Utils.Sprintf("pls_enter")+" "+i118Utils.Sprintf("task_id")+
...@@ -36,6 +42,7 @@ func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bo ...@@ -36,6 +42,7 @@ func CommitZTFTestResult(files []string, productId, taskId int, noNeedConfirm bo
result := serverDomain.ZentaoResultSubmitReq{ result := serverDomain.ZentaoResultSubmitReq{
ProductId: productId, ProductId: productId,
TaskId: taskId, TaskId: taskId,
Name: taskName,
Seq: resultDir, Seq: resultDir,
} }
......
...@@ -146,6 +146,8 @@ type ZentaoBug struct { ...@@ -146,6 +146,8 @@ type ZentaoBug struct {
} }
type ZtfReport struct { type ZtfReport struct {
Name string `json:"name"`
TestEnv commConsts.OsType `json:"testEnv,omitempty"` TestEnv commConsts.OsType `json:"testEnv,omitempty"`
TestType commConsts.TestType `json:"testType"` TestType commConsts.TestType `json:"testType"`
TestTool commConsts.TestTool `json:"testTool"` TestTool commConsts.TestTool `json:"testTool"`
......
...@@ -43,6 +43,7 @@ func GenUnitTestReport(req serverDomain.TestSet, startTime, endTime int64, ...@@ -43,6 +43,7 @@ func GenUnitTestReport(req serverDomain.TestSet, startTime, endTime int64,
} }
report = commDomain.ZtfReport{ report = commDomain.ZtfReport{
Name: req.Name,
TestEnv: commonUtils.GetOs(), TestEnv: commonUtils.GetOs(),
TestType: commConsts.TestUnit, TestType: commConsts.TestUnit,
TestTool: req.TestTool, TestTool: req.TestTool,
......
...@@ -26,6 +26,8 @@ type WsReq struct { ...@@ -26,6 +26,8 @@ type WsReq struct {
} }
type TestSet struct { type TestSet struct {
Name string `json:"name"`
WorkspaceId int `json:"workspaceId"` WorkspaceId int `json:"workspaceId"`
WorkspaceType commConsts.TestTool `json:"workspaceType"` WorkspaceType commConsts.TestTool `json:"workspaceType"`
WorkspacePath string `json:"workspacePath"` WorkspacePath string `json:"workspacePath"`
......
...@@ -10,7 +10,7 @@ type ZentaoRespData struct { ...@@ -10,7 +10,7 @@ type ZentaoRespData struct {
} }
type ZentaoResultSubmitReq struct { type ZentaoResultSubmitReq struct {
Title string `json:"title"` Name string `json:"name"`
Seq string `json:"seq"` Seq string `json:"seq"`
WorkspaceId int `json:"workspaceId"` WorkspaceId int `json:"workspaceId"`
ProductId int `json:"productId"` ProductId int `json:"productId"`
......
...@@ -150,6 +150,7 @@ func (s *TestResultService) Submit(result serverDomain.ZentaoResultSubmitReq, si ...@@ -150,6 +150,7 @@ func (s *TestResultService) Submit(result serverDomain.ZentaoResultSubmitReq, si
} }
config := configHelper.LoadBySite(site) config := configHelper.LoadBySite(site)
report.Name = result.Name
err = zentaoHelper.CommitResult(report, result.ProductId, result.TaskId, config, nil) err = zentaoHelper.CommitResult(report, result.ProductId, result.TaskId, config, nil)
return return
......
...@@ -226,6 +226,8 @@ export default { ...@@ -226,6 +226,8 @@ export default {
'pls_select_task': 'Please select task', 'pls_select_task': 'Please select task',
'or_input_task_name': 'Or input new task name', 'or_input_task_name': 'Or input new task name',
'task_name': 'Zentao Task Name',
'pls_select_workspace': 'Please select workspace.', 'pls_select_workspace': 'Please select workspace.',
'pls_add_zentao_site': 'Please add zentao site.', 'pls_add_zentao_site': 'Please add zentao site.',
'pls_create_workspace': 'Please create workspace to continue.', 'pls_create_workspace': 'Please create workspace to continue.',
......
...@@ -237,6 +237,7 @@ export default { ...@@ -237,6 +237,7 @@ export default {
'pls_select_task': '请选择任务', 'pls_select_task': '请选择任务',
'or_input_task_name': '或输入新任务标题', 'or_input_task_name': '或输入新任务标题',
'task_name': '禅道任务标题',
'pls_select_workspace': '请选择导出到的工作目录。', 'pls_select_workspace': '请选择导出到的工作目录。',
'pls_add_zentao_site': '初次使用,请点击右上按钮新建禅道站点。', 'pls_add_zentao_site': '初次使用,请点击右上按钮新建禅道站点。',
......
...@@ -168,7 +168,7 @@ const exec = (data: any) => { ...@@ -168,7 +168,7 @@ const exec = (data: any) => {
msg = {act: 'execCase', testSets: sets} msg = {act: 'execCase', testSets: sets}
} else if (execType === 'unit') { } else if (execType === 'unit') {
const set = {workspaceId: data.id, workspaceType: data.type, cmd: data.cmd, submitResult: data.submitResult} const set = {workspaceId: data.id, workspaceType: data.type, cmd: data.cmd, submitResult: data.submitResult, name: data.name}
msg = {act: 'execUnit', testSets: [set]} msg = {act: 'execUnit', testSets: [set]}
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
<input v-model="modelRef.submitResult" type="checkbox"> <input v-model="modelRef.submitResult" type="checkbox">
</FormItem> </FormItem>
<FormItem labelWidth="100px" v-if="modelRef.submitResult" name="name" :label="t('task_name')">
<input v-model="modelRef.name">
</FormItem>
<FormItem labelWidth="100px"> <FormItem labelWidth="100px">
<Button :disabled="isRunning === 'true' || !modelRef.cmd" @click="start" class="rounded primary"> <Button :disabled="isRunning === 'true' || !modelRef.cmd" @click="start" class="rounded primary">
{{ t('exec') }} {{ t('exec') }}
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
</div> </div>
</FormItem> </FormItem>
<FormItem v-if="!modelRef.taskId" name="title" :label="t('or_input_task_name')" labelWidth="120px"> <FormItem v-if="!modelRef.taskId" name="name" :label="t('or_input_task_name')" labelWidth="120px">
<input type="text" v-model="modelRef.title" /> <input type="text" v-model="modelRef.name" />
</FormItem> </FormItem>
</Form> </Form>
</ZModal> </ZModal>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册