Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
86fe8b8b
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 搜索 >>
提交
86fe8b8b
编写于
5月 18, 2022
作者:
Z
zhaoke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* fix ceate workspace fail
上级
e5860960
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
106 addition
and
56 deletion
+106
-56
ui/src/layouts/MainLayout/components/LastTestInfo.vue
ui/src/layouts/MainLayout/components/LastTestInfo.vue
+5
-8
ui/src/layouts/MainLayout/components/ResultList.vue
ui/src/layouts/MainLayout/components/ResultList.vue
+2
-2
ui/src/layouts/MainLayout/components/WorkDir.vue
ui/src/layouts/MainLayout/components/WorkDir.vue
+58
-45
ui/src/main.ts
ui/src/main.ts
+1
-0
ui/src/store/workspace.ts
ui/src/store/workspace.ts
+10
-0
ui/src/views/result/service.ts
ui/src/views/result/service.ts
+8
-0
ui/src/views/result/store.ts
ui/src/views/result/store.ts
+22
-1
未找到文件。
ui/src/layouts/MainLayout/components/LastTestInfo.vue
浏览文件 @
86fe8b8b
...
...
@@ -12,22 +12,19 @@
<
script
setup
lang=
"ts"
>
import
Button
from
'
./Button.vue
'
;
import
Icon
from
'
./Icon.vue
'
;
import
{
StateType
}
from
"
@/src/views/result/store
"
;
import
{
useRouter
}
from
"
vue-router
"
;
import
{
StateType
}
from
"
@/views/result/store
"
;
import
{
useStore
}
from
"
vuex
"
;
import
{
computed
,
onMounted
}
from
"
vue
"
;
import
{
useI18n
}
from
"
vue-i18n
"
;
const
{
t
}
=
useI18n
();
const
store
=
useStore
<
{
Result
:
StateType
}
>
();
const
models
=
computed
<
any
[]
>
(()
=>
store
.
state
.
Result
.
queryResult
.
result
)
var
model
=
computed
<
any
[]
>
(()
=>
models
.
value
.
length
>
0
?
models
.
value
[
0
]
:
{})
const
model
=
computed
<
any
[]
>
(()
=>
store
.
state
.
Result
.
lastResult
)
const
list
=
(
page
:
number
)
=>
{
store
.
dispatch
(
'
Result/list
'
,
{
page
:
page
});
const
latest
=
()
=>
{
store
.
dispatch
(
'
Result/latest
'
,
{});
}
l
ist
(
1
);
l
atest
(
);
const
showDetail
=
(
item
)
=>
{
console
.
log
(
item
)
...
...
ui/src/layouts/MainLayout/components/ResultList.vue
浏览文件 @
86fe8b8b
...
...
@@ -7,7 +7,7 @@
class=
"inline-left"
iconClass=
"text-green"
v-if=
"item.fail==0"
:title=
"item.total > 1 ?
'Workspace 1 (' + item.total + ')' : item.no
"
:title=
"item.total > 1 ?
item.workspaceName + '(' + item.total + ')' : item.testScriptName
"
trailingTextClass=
"muted small"
>
</ListItem>
...
...
@@ -16,7 +16,7 @@
class=
"inline-left"
iconClass=
"text-red"
v-else
:title=
"item.total > 1 ?
'Workspace 1 (' + item.total + ')' : item.no
"
:title=
"item.total > 1 ?
item.workspaceName + '(' + item.total + ')' : item.testScriptName
"
trailingTextClass=
"muted small"
/>
<span
v-if=
"item.checked == 0 || item.checked == undefined"
>
{{
momentTime
(
item
.
startTime
,
'
hh:mm
'
)
}}
</span>
...
...
ui/src/layouts/MainLayout/components/WorkDir.vue
浏览文件 @
86fe8b8b
...
...
@@ -14,24 +14,29 @@
@
onOk=
"createNode"
:title=
"t('pls_name')"
>
<Form
labelCol=
"50px"
wrapperCol=
"60"
>
<FormItem
name=
"name"
:label=
"t('name')"
:info=
"
v
alidateInfos.name"
>
<input
v-model=
"
m
odelRef.name"
class=
"form-control"
/>
<Form
labelCol=
"50px"
v-if=
"currentNode.path==''"
wrapperCol=
"60"
>
<FormItem
name=
"name"
:label=
"t('name')"
:info=
"
wsV
alidateInfos.name"
>
<input
v-model=
"
wsM
odelRef.name"
class=
"form-control"
/>
</FormItem>
<FormItem
v-if=
"currentNode.path==''"
name=
"path"
:label=
"t('path')"
:info=
"v
alidateInfos.path"
>
<input
v-model=
"
m
odelRef.path"
class=
"form-control"
/>
<FormItem
name=
"path"
:label=
"t('path')"
:info=
"wsV
alidateInfos.path"
>
<input
v-model=
"
wsM
odelRef.path"
class=
"form-control"
/>
</FormItem>
<FormItem
v-if=
"currentNode.path==''"
name=
"type"
:label=
"t('type')"
:info=
"v
alidateInfos.type"
>
<select
name=
"type"
v-model=
"
m
odelRef.type"
class=
"form-control"
>
<FormItem
name=
"type"
:label=
"t('type')"
:info=
"wsV
alidateInfos.type"
>
<select
name=
"type"
v-model=
"
wsM
odelRef.type"
class=
"form-control"
>
<option
v-for=
"item in testTypes"
:key=
"item.value"
:value=
"item.value"
>
{{
item
.
label
}}
</option>
</select>
</FormItem>
<FormItem
v-if=
"currentNode.path==''"
name=
"lang"
:label=
"t('default_lang')"
:info=
"v
alidateInfos.lang"
>
<select
name=
"type"
v-model=
"
m
odelRef.lang"
class=
"form-control"
>
<FormItem
name=
"lang"
:label=
"t('default_lang')"
:info=
"wsV
alidateInfos.lang"
>
<select
name=
"type"
v-model=
"
wsM
odelRef.lang"
class=
"form-control"
>
<option
v-for=
"item in langs"
:key=
"item.code"
:value=
"item.code"
>
{{
item
.
name
}}
</option>
</select>
</FormItem>
</Form>
<Form
labelCol=
"50px"
v-else
wrapperCol=
"60"
>
<FormItem
name=
"name"
:label=
"t('name')"
:info=
"validateInfos.name"
>
<input
v-model=
"modelRef.name"
class=
"form-control"
/>
</FormItem>
</Form>
</ZModal>
</div>
</
template
>
...
...
@@ -49,7 +54,7 @@ import Tree from "./Tree.vue";
import
ZModal
from
'
./Modal.vue
'
;
import
notification
from
"
@/utils/notification
"
;
import
{
unitTestTypesDef
,
ZentaoCasePrefix
,
ztfTestTypesDef
}
from
"
@/utils/const
"
;
import
{
WorkspaceData
}
from
"
@/views/workspace/store
"
;
import
{
computed
,
defineExpose
,
onMounted
,
onUnmounted
,
ref
,
watch
,
getCurrentInstance
}
from
"
vue
"
;
import
{
Modal
}
from
"
ant-design-vue
"
;
...
...
@@ -80,7 +85,6 @@ import {ExecStatus} from "@/store/exec";
import
debounce
from
"
lodash.debounce
"
;
import
throttle
from
"
lodash.debounce
"
;
import
{
isInArray
}
from
"
@/utils/array
"
;
import
{
PageType
}
from
"
@/store/tabs
"
;
const
{
t
}
=
useI18n
();
...
...
@@ -114,7 +118,7 @@ const isRunning = computed<any>(() => execStore.state.Exec.isRunning);
const
store
=
useStore
<
{
Script
:
ScriptData
}
>
();
const
treeDataEmpty
=
computed
<
boolean
>
(()
=>
!
(
treeData
.
value
.
length
>
0
&&
treeData
.
value
[
0
]
&&
treeData
.
value
[
0
].
children
))
const
workspaceStore
=
useStore
<
{
Workspace
:
WorkspaceData
}
>
();
const
filerType
=
ref
(
''
)
const
filerValue
=
ref
(
''
)
const
showModal
=
ref
(
false
)
...
...
@@ -165,6 +169,15 @@ const rulesRef = ref({
name
:
[
{
required
:
true
,
msg
:
t
(
'
pls_name
'
)},
],
})
const
{
validate
,
reset
,
validateInfos
}
=
useForm
(
modelRef
,
rulesRef
);
const
wsModelRef
=
ref
({})
const
wsRulesRef
=
ref
({
name
:
[
{
required
:
true
,
msg
:
t
(
'
pls_name
'
)},
],
path
:
[
{
required
:
true
,
msg
:
t
(
'
pls_workspace_path
'
)},
],
...
...
@@ -175,8 +188,7 @@ const rulesRef = ref({
{
required
:
true
,
msg
:
t
(
'
pls_workspace_type
'
)},
],
})
const
{
validate
,
reset
,
validateInfos
}
=
useForm
(
modelRef
,
rulesRef
);
const
{
validate
:
wsValidate
,
reset
:
wsReset
,
validateInfos
:
wsValidateInfos
}
=
useForm
(
wsModelRef
,
wsRulesRef
);
const
treeRef
=
ref
<
{
isAllCollapsed
:
()
=>
boolean
,
toggleAllCollapsed
:
()
=>
void
}
>
();
...
...
@@ -511,19 +523,18 @@ const cancelUpdate = (path) => {
}
const
createWorkSpace
=
()
=>
{
if
(
validate
()){
store
.
dispatch
(
'
Workspace/save
'
,
modelRef
.
value
).
then
((
response
)
=>
{
if
(
response
)
{
modelRef
.
value
=
{};
notification
.
success
({
message
:
t
(
'
save_success
'
)});
showModal
.
value
=
false
;
if
(
wsValidate
()){
console
.
log
(
workspaceStore
)
workspaceStore
.
dispatch
(
'
Workspace/save
'
,
wsModelRef
.
value
).
then
((
response
)
=>
{
if
(
response
)
{
wsModelRef
.
value
=
{};
notification
.
success
({
message
:
t
(
'
save_success
'
)});
showModal
.
value
=
false
;
}
})
}
})
}
};
const
createNode
=
()
=>
{
if
(
currentNode
.
value
.
path
==
''
)
{
createWorkSpace
();
...
...
@@ -534,27 +545,29 @@ const createNode = () => {
if
(
currentNode
.
value
.
isLeaf
)
{
type
=
'
node
'
;
}
scriptStore
.
dispatch
(
'
Script/createScript
'
,
{
name
:
modelRef
.
value
.
name
,
mode
:
mode
,
type
:
type
,
target
:
currentNode
.
value
.
path
,
workspaceId
:
currentNode
.
value
.
workspaceId
,
productId
:
currProduct
.
value
.
id
,
}).
then
((
result
)
=>
{
if
(
result
)
{
showModal
.
value
=
false
;
notification
.
success
({
message
:
t
(
'
create_success
'
)});
nameFormVisible
.
value
=
false
if
(
mode
==
'
child
'
)
{
expandedKeys
.
value
.
push
(
rightClickedNode
.
path
)
}
if
(
type
===
'
dir
'
)
{
expandedKeys
.
value
.
push
(
result
)
}
setExpandedKeys
(
currSite
.
value
.
id
,
currProduct
.
value
.
id
,
expandedKeys
.
value
)
}
else
{
notification
.
error
({
message
:
t
(
'
create_fail
'
)});
}
})
if
(
validate
()){
scriptStore
.
dispatch
(
'
Script/createScript
'
,
{
name
:
modelRef
.
value
.
name
,
mode
:
mode
,
type
:
type
,
target
:
currentNode
.
value
.
path
,
workspaceId
:
currentNode
.
value
.
workspaceId
,
productId
:
currProduct
.
value
.
id
,
}).
then
((
result
)
=>
{
if
(
result
)
{
showModal
.
value
=
false
;
notification
.
success
({
message
:
t
(
'
create_success
'
)});
nameFormVisible
.
value
=
false
if
(
mode
==
'
child
'
)
{
expandedKeys
.
value
.
push
(
rightClickedNode
.
path
)
}
if
(
type
===
'
dir
'
)
{
expandedKeys
.
value
.
push
(
result
)
}
setExpandedKeys
(
currSite
.
value
.
id
,
currProduct
.
value
.
id
,
expandedKeys
.
value
)
}
else
{
notification
.
error
({
message
:
t
(
'
create_fail
'
)});
}
})
}
}
const
menuClick
=
(
act
:
string
,
node
:
any
)
=>
{
...
...
ui/src/main.ts
浏览文件 @
86fe8b8b
...
...
@@ -19,6 +19,7 @@ import _ from "lodash";
import
mitt
,
{
Emitter
}
from
"
@/utils/mitt
"
;
import
Toast
,
{
PluginOptions
}
from
"
vue-toastification
"
;
import
"
vue-toastification/dist/index.css
"
;
const
app
=
createApp
(
App
)
app
.
use
(
store
);
app
.
use
(
router
)
...
...
ui/src/store/workspace.ts
浏览文件 @
86fe8b8b
...
...
@@ -4,6 +4,7 @@ import { ResponseData } from '@/utils/request';
import
{
deleteWorkspace
,
getWorkspace
}
from
"
@/services/workspace
"
;
import
{
setCache
}
from
"
@/utils/localCache
"
;
import
settings
from
'
@/config/settings
'
;
import
{
save
}
from
'
@/views/workspace/service
'
;
export
interface
WorkspaceData
{
workspaces
:
any
[]
...
...
@@ -20,6 +21,7 @@ export interface ModuleType extends StoreModuleType<WorkspaceData> {
actions
:
{
fetchWorkspace
:
Action
<
WorkspaceData
,
WorkspaceData
>
;
removeWorkspace
:
Action
<
WorkspaceData
,
WorkspaceData
>
;
save
:
Action
<
WorkspaceData
,
WorkspaceData
>
;
};
}
...
...
@@ -73,6 +75,14 @@ const StoreModel: ModuleType = {
return
false
;
}
},
async
save
({
commit
},
payload
)
{
try
{
await
save
(
payload
);
return
true
;
}
catch
(
error
)
{
return
false
;
}
},
}
}
...
...
ui/src/views/result/service.ts
浏览文件 @
86fe8b8b
...
...
@@ -18,6 +18,14 @@ export async function get(params: any): Promise<any> {
});
}
export
async
function
getLastest
(
params
:
any
):
Promise
<
any
>
{
return
request
({
url
:
`/
${
apiPath
}
/latest`
,
method
:
'
get
'
,
params
,
});
}
export
async
function
remove
(
params
:
any
):
Promise
<
any
>
{
return
request
({
url
:
`/
${
apiPath
}
`
,
...
...
ui/src/views/result/store.ts
浏览文件 @
86fe8b8b
...
...
@@ -3,12 +3,13 @@ import { StoreModuleType } from "@/utils/store";
import
{
ResponseData
}
from
'
@/utils/request
'
;
import
{
QueryParams
,
QueryResult
}
from
'
@/types/data.d
'
;
import
{
list
,
get
,
remove
,
list
,
get
,
remove
,
getLastest
,
}
from
'
./service
'
;
export
interface
StateType
{
queryResult
:
QueryResult
;
detailResult
:
any
;
lastResult
:
any
;
}
export
interface
ModuleType
extends
StoreModuleType
<
StateType
>
{
...
...
@@ -16,11 +17,13 @@ export interface ModuleType extends StoreModuleType<StateType> {
mutations
:
{
setQueryResult
:
Mutation
<
StateType
>
;
setDetailResult
:
Mutation
<
StateType
>
;
setLastResult
:
Mutation
<
StateType
>
;
};
actions
:
{
list
:
Action
<
StateType
,
StateType
>
;
get
:
Action
<
StateType
,
StateType
>
;
delete
:
Action
<
StateType
,
StateType
>
;
latest
:
Action
<
StateType
,
StateType
>
;
};
}
const
initState
:
StateType
=
{
...
...
@@ -35,6 +38,7 @@ const initState: StateType = {
},
},
detailResult
:
{},
lastResult
:
{},
};
const
StoreModel
:
ModuleType
=
{
...
...
@@ -50,6 +54,9 @@ const StoreModel: ModuleType = {
setDetailResult
(
state
,
payload
)
{
state
.
detailResult
=
payload
;
},
setLastResult
(
state
,
payload
)
{
state
.
lastResult
=
payload
;
},
},
actions
:
{
async
list
({
commit
},
params
:
QueryParams
)
{
...
...
@@ -79,6 +86,20 @@ const StoreModel: ModuleType = {
await
remove
(
data
);
dispatch
(
'
list
'
,
{})
return
true
;
}
catch
(
error
)
{
return
false
;
}
},
async
latest
({
commit
},
params
:
QueryParams
)
{
try
{
const
response
:
ResponseData
=
await
getLastest
(
params
);
if
(
response
.
code
!=
0
)
{
return
;
}
const
data
=
response
.
data
;
commit
(
'
setLastResult
'
,
data
);
return
true
;
}
catch
(
error
)
{
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录