Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
cade43be
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,发现更多精彩内容 >>
提交
cade43be
编写于
3月 21, 2022
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
filter scripts by work dir
上级
6d5ff6d7
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
53 addition
and
41 deletion
+53
-41
internal/server/modules/v1/controller/zentao.go
internal/server/modules/v1/controller/zentao.go
+2
-1
internal/server/modules/v1/index/zentao.go
internal/server/modules/v1/index/zentao.go
+1
-1
internal/server/modules/v1/service/test-script.go
internal/server/modules/v1/service/test-script.go
+6
-2
ui/src/config/routes.ts
ui/src/config/routes.ts
+1
-1
ui/src/layouts/IndexLayout/components/TopSiteProduct.vue
ui/src/layouts/IndexLayout/components/TopSiteProduct.vue
+4
-4
ui/src/services/zentao.ts
ui/src/services/zentao.ts
+1
-1
ui/src/store/zentao.ts
ui/src/store/zentao.ts
+5
-5
ui/src/utils/cache.ts
ui/src/utils/cache.ts
+1
-1
ui/src/views/script/index.vue
ui/src/views/script/index.vue
+30
-23
ui/src/views/site/edit.vue
ui/src/views/site/edit.vue
+1
-1
ui/src/views/site/index.vue
ui/src/views/site/index.vue
+1
-1
未找到文件。
internal/server/modules/v1/controller/zentao.go
浏览文件 @
cade43be
...
...
@@ -38,6 +38,7 @@ func (c *ZentaoCtrl) GetProfile(ctx iris.Context) {
func
(
c
*
ZentaoCtrl
)
ListSiteAndProductWithScripts
(
ctx
iris
.
Context
)
{
currSiteId
,
_
:=
ctx
.
URLParamInt
(
"currSiteId"
)
currProductId
,
_
:=
ctx
.
URLParamInt
(
"currProductId"
)
workspaceId
,
_
:=
ctx
.
URLParamInt
(
"workspaceId"
)
needLoadScript
,
_
:=
ctx
.
URLParamBool
(
"needLoadScript"
)
sites
,
currSite
,
_
:=
c
.
SiteService
.
LoadSites
(
currSiteId
)
...
...
@@ -47,7 +48,7 @@ func (c *ZentaoCtrl) ListSiteAndProductWithScripts(ctx iris.Context) {
"currSite"
:
currSite
,
"currProduct"
:
currProduct
}
if
needLoadScript
{
testScripts
,
_
:=
c
.
TestScriptService
.
LoadTestScriptsBySiteProduct
(
currSite
,
currProduct
)
testScripts
,
_
:=
c
.
TestScriptService
.
LoadTestScriptsBySiteProduct
(
currSite
,
currProduct
,
workspaceId
)
data
[
"testScripts"
]
=
testScripts
}
...
...
internal/server/modules/v1/index/zentao.go
浏览文件 @
cade43be
...
...
@@ -23,7 +23,7 @@ func (m *ZentaoModule) Party() module.WebModule {
index
.
Get
(
"/listLang"
,
m
.
ZentaoCtrl
.
ListLang
)
.
Name
=
"脚本语言列表"
index
.
Get
(
"/getProfile"
,
m
.
ZentaoCtrl
.
GetProfile
)
.
Name
=
"脚本语言列表"
index
.
Get
(
"/listSiteAndProduct"
,
m
.
ZentaoCtrl
.
ListSiteAndProductWithScripts
)
.
Name
=
"获取禅道站点及其下产品"
index
.
Get
(
"/listSiteAndProduct
WithScripts
"
,
m
.
ZentaoCtrl
.
ListSiteAndProductWithScripts
)
.
Name
=
"获取禅道站点及其下产品"
index
.
Get
(
"/listProduct"
,
m
.
ZentaoCtrl
.
ListProduct
)
.
Name
=
"产品列表"
index
.
Get
(
"/listModule"
,
m
.
ZentaoCtrl
.
ListModule
)
.
Name
=
"模块列表"
...
...
internal/server/modules/v1/service/test-script.go
浏览文件 @
cade43be
...
...
@@ -17,14 +17,18 @@ func NewTestScriptService() *TestScriptService {
return
&
TestScriptService
{}
}
func
(
s
*
TestScriptService
)
LoadTestScriptsBySiteProduct
(
site
serverDomain
.
ZentaoSite
,
product
serverDomain
.
ZentaoProduct
)
(
root
serverDomain
.
TestAsset
,
err
error
)
{
func
(
s
*
TestScriptService
)
LoadTestScriptsBySiteProduct
(
site
serverDomain
.
ZentaoSite
,
product
serverDomain
.
ZentaoProduct
,
workspaceId
int
)
(
root
serverDomain
.
TestAsset
,
err
error
)
{
workspaces
,
_
:=
s
.
WorkspaceRepo
.
ListWorkspacesByProduct
(
site
.
Id
,
product
.
Id
)
root
=
serverDomain
.
TestAsset
{
Path
:
""
,
Title
:
"测试脚本"
,
Type
:
commConsts
.
Root
,
Slots
:
iris
.
Map
{
"icon"
:
"icon"
}}
for
_
,
workspace
:=
range
workspaces
{
if
workspace
.
Type
==
commConsts
.
ZTF
{
if
workspaceId
>
0
&&
uint
(
workspaceId
)
!=
workspace
.
ID
{
continue
}
scriptsInDir
,
_
:=
scriptUtils
.
LoadScriptTree
(
workspace
.
Path
)
root
.
Children
=
append
(
root
.
Children
,
&
scriptsInDir
)
...
...
ui/src/config/routes.ts
浏览文件 @
cade43be
...
...
@@ -22,7 +22,7 @@ const routes: RoutesDataItem[] = [
{
title
:
'
empty
'
,
path
:
'
/
'
,
redirect
:
'
/script/
list
'
,
redirect
:
'
/script/
index
'
,
component
:
IndexLayout
,
children
:
IndexLayoutRoutes
},
...
...
ui/src/layouts/IndexLayout/components/TopSiteProduct.vue
浏览文件 @
cade43be
...
...
@@ -74,7 +74,7 @@ export default defineComponent({
const
{
t
}
=
useI18n
();
const
router
=
useRouter
();
const
needLoadScript
=
router
.
currentRoute
.
value
.
path
===
'
/script/index
'
const
needLoadScript
=
false
//
router.currentRoute.value.path === '/script/index'
const
store
=
useStore
<
{
zentao
:
ZentaoData
}
>
();
...
...
@@ -84,7 +84,7 @@ export default defineComponent({
const
currSite
=
computed
<
any
>
(()
=>
store
.
state
.
zentao
.
currSite
);
const
currProduct
=
computed
<
any
>
(()
=>
store
.
state
.
zentao
.
currProduct
);
store
.
dispatch
(
'
zentao/fetchSitesAndProducts
'
,
{
needLoadScript
:
needLoadScript
})
store
.
dispatch
(
'
zentao/fetchSitesAndProduct
WithScript
s
'
,
{
needLoadScript
:
needLoadScript
})
onMounted
(()
=>
{
console
.
log
(
'
onMounted
'
)
...
...
@@ -92,11 +92,11 @@ export default defineComponent({
const
selectSite
=
(
site
):
void
=>
{
console
.
log
(
'
selectSite
'
,
site
)
store
.
dispatch
(
'
zentao/fetchSitesAndProducts
'
,
{
currSiteId
:
site
.
id
,
needLoadScript
:
true
})
store
.
dispatch
(
'
zentao/fetchSitesAndProduct
WithScript
s
'
,
{
currSiteId
:
site
.
id
,
needLoadScript
:
true
})
}
const
selectProduct
=
(
product
):
void
=>
{
console
.
log
(
'
selectProduct
'
,
product
)
store
.
dispatch
(
'
zentao/fetchSitesAndProducts
'
,
{
currProductId
:
product
.
id
,
needLoadScript
:
true
})
store
.
dispatch
(
'
zentao/fetchSitesAndProduct
WithScript
s
'
,
{
currProductId
:
product
.
id
,
needLoadScript
:
true
})
}
return
{
...
...
ui/src/services/zentao.ts
浏览文件 @
cade43be
...
...
@@ -23,7 +23,7 @@ export async function getProfile(): Promise<any> {
export
async
function
querySiteAndProduct
(
params
):
Promise
<
any
>
{
return
request
({
url
:
`/
${
apiPath
}
/listSiteAndProduct`
,
url
:
`/
${
apiPath
}
/listSiteAndProduct
WithScripts
`
,
method
:
'
get
'
,
params
,
});
...
...
ui/src/store/zentao.ts
浏览文件 @
cade43be
...
...
@@ -32,7 +32,7 @@ export interface ModuleType extends StoreModuleType<ZentaoData> {
saveProfile
:
Mutation
<
any
>
;
saveSitesAndProducts
:
Mutation
<
any
>
;
saveSitesAndProduct
WithScript
s
:
Mutation
<
any
>
;
saveProducts
:
Mutation
<
any
>
;
saveModules
:
Mutation
<
any
>
;
saveSuites
:
Mutation
<
any
>
;
...
...
@@ -42,7 +42,7 @@ export interface ModuleType extends StoreModuleType<ZentaoData> {
fetchLangs
:
Action
<
ZentaoData
,
ZentaoData
>
;
getProfile
:
Action
<
ZentaoData
,
ZentaoData
>
;
fetchSitesAndProducts
:
Action
<
ZentaoData
,
ZentaoData
>
;
fetchSitesAndProduct
WithScript
s
:
Action
<
ZentaoData
,
ZentaoData
>
;
fetchProducts
:
Action
<
ZentaoData
,
ZentaoData
>
;
fetchModules
:
Action
<
ZentaoData
,
ZentaoData
>
;
fetchSuites
:
Action
<
ZentaoData
,
ZentaoData
>
;
...
...
@@ -84,7 +84,7 @@ const StoreModel: ModuleType = {
console
.
log
(
'
payload
'
,
payload
)
state
.
profile
=
payload
},
async
saveSitesAndProducts
(
state
,
payload
)
{
async
saveSitesAndProduct
WithScript
s
(
state
,
payload
)
{
state
.
sites
=
payload
.
sites
;
state
.
products
=
payload
.
products
;
state
.
scriptLoaded
=
payload
.
needLoadScript
...
...
@@ -148,13 +148,13 @@ const StoreModel: ModuleType = {
}
},
async
fetchSitesAndProducts
({
commit
},
payload
)
{
async
fetchSitesAndProduct
WithScript
s
({
commit
},
payload
)
{
const
response
:
ResponseData
=
await
querySiteAndProduct
(
payload
);
const
{
data
}
=
response
;
data
.
needLoadScript
=
payload
.
needLoadScript
commit
(
'
saveSitesAndProducts
'
,
data
)
commit
(
'
saveSitesAndProduct
WithScript
s
'
,
data
)
return
true
;
},
...
...
ui/src/utils/cache.ts
浏览文件 @
cade43be
...
...
@@ -56,4 +56,4 @@ export const retrieveExpandedKeys = async () => {
console
.
log
(
'
retrieveExpandedKeys
'
)
const
keys
=
await
getCache
(
settings
.
expandedKeys
);
return
[...
keys
]
}
}
\ No newline at end of file
ui/src/views/script/index.vue
浏览文件 @
cade43be
<
template
>
<div
class=
"
indexlayout-main-conent
"
>
<div
class=
"
script-main
"
>
<div
id=
"main"
>
<div
id=
"left"
>
<div
class=
"toolbar"
>
...
...
@@ -63,9 +63,9 @@
<div
id=
"content"
>
<div
class=
"toolbar"
>
<a-button
@
click=
"extract"
type=
"primary"
>
{{ t('extract_step') }}
</a-button>
<a-button
@
click=
"extract"
type=
"primary"
size=
"small"
>
{{ t('extract_step') }}
</a-button>
</div>
<div
class=
"panel"
>
<div
class=
"
editor-
panel"
>
<MonacoEditor
v-if=
"scriptCode !== ''"
class=
"editor"
...
...
@@ -150,7 +150,7 @@ export default defineComponent({
watch
(
treeData
,
(
currConfig
)
=>
{
console
.
log
(
'
watch treeData
'
,
treeData
.
value
)
retrieveExpandedKeys
().
then
(
async
keys
=>
{
console
.
log
(
'
keys
'
,
keys
,
expandedKeys
.
value
)
console
.
log
(
'
keys
'
)
if
(
keys
)
expandedKeys
.
value
=
keys
if
(
!
expandedKeys
.
value
||
expandedKeys
.
value
.
length
===
0
)
{
...
...
@@ -160,11 +160,6 @@ export default defineComponent({
})
},
{
deep
:
true
})
console
.
log
(
`treeData loaded
${
scriptLoaded
.
value
}
`
,
treeData
.
value
.
length
)
if
(
!
scriptLoaded
.
value
)
{
// switch to current page
zentaoStore
.
dispatch
(
'
zentao/fetchSitesAndProducts
'
,
{
needLoadScript
:
true
})
}
let
filerItems
=
ref
([]
as
any
)
const
filerType
=
ref
(
''
)
const
filerValue
=
ref
(
''
)
...
...
@@ -173,20 +168,36 @@ export default defineComponent({
const
filter
=
await
getScriptFilters
()
filerType
.
value
=
filter
.
by
filerValue
.
value
=
filter
.
val
listFilterItems
(
filerType
.
value
).
then
((
data
)
=>
{
filerItems
.
value
=
data
.
data
})
const
result
=
await
listFilterItems
(
filerType
.
value
)
filerItems
.
value
=
result
.
data
}
const
loadScripts
=
async
()
=>
{
console
.
log
(
'
----------------- filerType.value
'
,
filerType
.
value
)
const
params
=
{
needLoadScript
:
true
}
as
any
if
(
filerType
.
value
===
'
workspace
'
)
params
.
workspaceId
=
filerValue
.
value
zentaoStore
.
dispatch
(
'
zentao/fetchSitesAndProductWithScripts
'
,
params
)
}
loadFilterItems
()
loadFilterItems
().
then
(()
=>
{
console
.
log
(
`treeData loaded
${
scriptLoaded
.
value
}
`
,
treeData
.
value
.
length
)
if
(
!
scriptLoaded
.
value
)
{
// switch to current page
loadScripts
()
}
})
const
selectFilerType
=
async
(
val
)
=>
{
console
.
log
(
'
selectFilerType
'
,
val
)
await
setScriptFilters
(
val
,
null
)
await
loadFilterItems
()
await
loadScripts
()
}
const
selectFilerValue
=
async
(
val
)
=>
{
console
.
log
(
'
selectFilerValue
'
,
val
)
await
setScriptFilters
(
filerType
.
value
,
val
)
await
loadScripts
()
}
const
expandedKeys
=
ref
<
string
[]
>
([]);
...
...
@@ -236,16 +247,16 @@ export default defineComponent({
}
const
expandNode
=
(
keys
:
string
[],
e
:
any
)
=>
{
console
.
log
(
'
expandNode
'
,
expandedKeys
.
value
)
console
.
log
(
'
expandNode
'
,
keys
)
cacheExpandedKeys
(
expandedKeys
.
value
)
}
const
expandAll
=
(
e
)
=>
{
console
.
log
(
'
expandAll
'
)
isExpand
.
value
=
!
isExpand
.
value
expandedKeys
.
value
=
[]
if
(
isExpand
.
value
)
getOpenKeys
(
treeData
.
value
[
0
],
true
)
console
.
log
(
'
expandAll
'
,
expandedKeys
.
value
)
cacheExpandedKeys
(
expandedKeys
.
value
)
}
...
...
@@ -297,14 +308,10 @@ export default defineComponent({
</
script
>
<
style
lang=
"less"
scoped
>
.
indexlayout-main-conent
{
.
script-main
{
margin: 0px;
height: 100%;
.panel {
padding: 20px;
}
#main {
display: flex;
height: 100%;
...
...
@@ -363,12 +370,12 @@ export default defineComponent({
.toolbar {
padding: 5px 10px;
height:
4
6px;
height:
3
6px;
text-align: right;
}
.panel {
padding: 0
16px 0 12
px;
.
editor-
panel {
padding: 0
6px 0 8
px;
height: calc(100% - 46px);
overflow: auto;
}
...
...
ui/src/views/site/edit.vue
浏览文件 @
cade43be
...
...
@@ -116,7 +116,7 @@ export default defineComponent({
.
then
(()
=>
{
console
.
log
(
modelRef
.
value
);
store
.
dispatch
(
'
Site/save
'
,
modelRef
.
value
).
then
((
success
)
=>
{
zentaoStore
.
dispatch
(
'
zentao/fetchSitesAndProducts
'
).
then
((
success
)
=>
{
zentaoStore
.
dispatch
(
'
zentao/fetchSitesAndProduct
WithScript
s
'
).
then
((
success
)
=>
{
notification
.
success
({
message
:
t
(
'
save_success
'
)
});
router
.
push
(
`/site/list`
)
})
...
...
ui/src/views/site/index.vue
浏览文件 @
cade43be
...
...
@@ -201,7 +201,7 @@ export default defineComponent({
onOk
:
()
=>
{
removeLoading
.
value
=
[
id
];
store
.
dispatch
(
'
Site/delete
'
,
id
).
then
((
success
)
=>
{
zentaoStore
.
dispatch
(
'
zentao/fetchSitesAndProducts
'
).
then
((
success
)
=>
{
zentaoStore
.
dispatch
(
'
zentao/fetchSitesAndProduct
WithScript
s
'
).
then
((
success
)
=>
{
message
.
success
(
t
(
'
delete_success
'
));
getList
(
pagination
.
value
.
page
)
removeLoading
.
value
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录