Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
78fbe0ab
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
78fbe0ab
编写于
3月 24, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get interpreter info by lang
上级
e835964b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
8 deletion
+32
-8
internal/comm/consts/enum.go
internal/comm/consts/enum.go
+1
-0
internal/server/modules/v1/controller/interpreter.go
internal/server/modules/v1/controller/interpreter.go
+6
-0
internal/server/modules/v1/service/interpreter.go
internal/server/modules/v1/service/interpreter.go
+16
-7
ui/src/views/interpreter/index.vue
ui/src/views/interpreter/index.vue
+9
-1
未找到文件。
internal/comm/consts/enum.go
浏览文件 @
78fbe0ab
...
...
@@ -14,6 +14,7 @@ var (
NeedInitErr
=
ResponseCode
{
1000
,
"data not init"
}
BizErrZentaoRequest
=
ResponseCode
{
2000
,
"zentao request err"
}
BizErrNameNotExist
=
ResponseCode
{
3000
,
"record not found"
}
NotAvailable
=
ResponseCode
{
4000
,
"not available"
}
)
type
ResultStatus
string
...
...
internal/server/modules/v1/controller/interpreter.go
浏览文件 @
78fbe0ab
...
...
@@ -2,6 +2,7 @@ package controller
import
(
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
commonUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/model"
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/service"
"github.com/kataras/iris/v12"
...
...
@@ -39,6 +40,11 @@ func (c *InterpreterCtrl) GetLangInterpreter(ctx iris.Context) {
}
func
(
c
*
InterpreterCtrl
)
List
(
ctx
iris
.
Context
)
{
if
!
commonUtils
.
IsWin
()
{
ctx
.
JSON
(
c
.
SuccessResp
(
nil
))
return
}
data
,
err
:=
c
.
InterpreterService
.
List
()
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
CommErr
,
err
.
Error
()))
...
...
internal/server/modules/v1/service/interpreter.go
浏览文件 @
78fbe0ab
...
...
@@ -5,6 +5,7 @@ import (
"fmt"
commConsts
"github.com/aaronchen2k/deeptest/internal/comm/consts"
langHelper
"github.com/aaronchen2k/deeptest/internal/comm/helper/lang"
commonUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
fileUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/file"
shellUtils
"github.com/aaronchen2k/deeptest/internal/pkg/lib/shell"
"github.com/aaronchen2k/deeptest/internal/server/modules/v1/model"
...
...
@@ -54,16 +55,23 @@ func (s *InterpreterService) Delete(id uint) error {
}
func
(
s
*
InterpreterService
)
GetLangSettings
()
(
mp
map
[
string
]
interface
{},
err
error
)
{
l
angs
:=
langHelper
.
GetSupportLanguageArrSort
()
allL
angs
:=
langHelper
.
GetSupportLanguageArrSort
()
langs
:=
[]
string
{}
mpData
:=
map
[
string
]
map
[
string
]
string
{}
for
_
,
lang
:=
range
langs
{
for
_
,
lang
:=
range
allLangs
{
mp
:=
commConsts
.
LangMap
[
lang
]
if
mp
[
"interpreter"
]
==
""
{
continue
}
subMap
:=
map
[
string
]
string
{
"name"
:
commConsts
.
LangMap
[
lang
]
[
"name"
],
"interpreter"
:
commConsts
.
LangMap
[
lang
]
[
"interpreter"
],
"versionCmd"
:
commConsts
.
LangMap
[
lang
]
[
"versionCmd"
],
"name"
:
mp
[
"name"
],
"interpreter"
:
mp
[
"interpreter"
],
"versionCmd"
:
mp
[
"versionCmd"
],
}
mpData
[
lang
]
=
subMap
langs
=
append
(
langs
,
lang
)
}
mp
=
map
[
string
]
interface
{}{}
...
...
@@ -74,6 +82,8 @@ func (s *InterpreterService) GetLangSettings() (mp map[string]interface{}, err e
}
func
(
s
*
InterpreterService
)
GetLangInterpreter
(
language
string
)
(
mp
map
[
string
]
interface
{},
err
error
)
{
mp
=
map
[
string
]
interface
{}{}
langSettings
:=
commConsts
.
LangMap
[
language
]
whereCmd
:=
strings
.
TrimSpace
(
langSettings
[
"whereCmd"
])
versionCmd
:=
strings
.
TrimSpace
(
langSettings
[
"versionCmd"
])
...
...
@@ -81,7 +91,7 @@ func (s *InterpreterService) GetLangInterpreter(language string) (mp map[string]
path
:=
langSettings
[
"interpreter"
]
info
:=
""
if
whereCmd
==
""
{
if
!
commonUtils
.
IsWin
()
||
whereCmd
==
""
{
return
}
...
...
@@ -97,7 +107,6 @@ func (s *InterpreterService) GetLangInterpreter(language string) (mp map[string]
return
}
mp
=
map
[
string
]
interface
{}{}
mp
[
"path"
]
=
path
mp
[
"info"
]
=
info
...
...
ui/src/views/interpreter/index.vue
浏览文件 @
78fbe0ab
...
...
@@ -9,13 +9,19 @@
</
template
>
<
template
#extra
>
<a-button
type=
"primary"
@
click=
"create()
"
>
<a-button
v-if=
"interpreters"
@
click=
"create()"
type=
"primary
"
>
<template
#icon
><PlusCircleOutlined
/></
template
>
{{t('create_interpreter')}}
</a-button>
</template>
<div
v-if=
"!interpreters"
style=
"padding: 20px;"
>
非Windows平台中,请参照
<a-link
to=
"https://ztf.im/book/ztf/ztf-about-26.html"
>
此文
</a-link>
将可执行文件加入PATH变量中,
即可在任意目录中执行测试,不需要为各种语言设置运行环境。
</div>
<a-table
v-if=
"interpreters"
row-key=
"id"
:columns=
"columns"
:data-source=
"interpreters"
...
...
@@ -68,6 +74,7 @@ import EditInterpreterForm from './component/edit.vue';
import
{
getLangSettings
}
from
"
./service
"
;
import
{
listInterpreter
,
removeInterpreter
}
from
"
@/views/interpreter/service
"
;
import
{
momentUtcDef
}
from
"
@/utils/datetime
"
;
import
ALink
from
"
@/components/ALink/index.vue
"
;
interface
InterpreterListSetupData
{
t
:
(
key
:
string
|
number
)
=>
string
;
...
...
@@ -94,6 +101,7 @@ interface InterpreterListSetupData {
export
default
defineComponent
({
name
:
'
InterpreterList
'
,
components
:
{
ALink
,
EditInterpreterForm
,
PlusCircleOutlined
,
},
setup
(
props
):
InterpreterListSetupData
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录