Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qahome-diamond
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qahome-diamond
Commits
48195e22
Commit
48195e22
authored
May 07, 2019
by
薛智杰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kewei' into 'master'
pipeline 功能修改 See merge request !22
parents
eade9f0d
7bbc4a75
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
71 deletions
+124
-71
dev.env.js
config/dev.env.js
+1
-1
prod.env.js
config/prod.env.js
+2
-1
pipelineNode.js
src/api/pipelineNode.js
+37
-0
application.vue
src/views/pipeline/application.vue
+84
-69
No files found.
config/dev.env.js
View file @
48195e22
...
...
@@ -4,5 +4,5 @@ module.exports = {
// QA_API: '"http://172.30.220.22:3003"',
QA_API
:
'
"http://127.0.0.1:3003"
'
,
TESTDATA_API
:
'
"http://172.30.220.22:3333"
'
,
PIPELINE_API
:
'
"http://pipes.liangkebang.com"
'
// PIPELINE_API:'"http://pipes.liangkebang.com"',
}
config/prod.env.js
View file @
48195e22
...
...
@@ -3,5 +3,6 @@ module.exports = {
ENV_CONFIG
:
'
"prod"
'
,
QA_API
:
'
"http://172.30.220.22:3003"
'
,
TESTDATA_API
:
'
"http://172.30.220.22:3333"
'
,
PIPELINE_API
:
'
"http://pipes.liangkebang.com"
'
PIPELINE_API
:
'
"http://pipes.liangkebang.com"
'
,
PIPELINE_API_JAVA
:
'
"http://pipes.liangkebang.com"
'
,
}
src/api/pipelineNode.js
0 → 100644
View file @
48195e22
import
request
from
'
@/utils/request
'
export
function
getMaster
(
data
)
{
return
request
({
url
:
'
/pipeline/master
'
,
method
:
'
post
'
,
data
})
}
export
function
saveApplication
(
data
)
{
return
request
({
url
:
'
/pipeline/save
'
,
method
:
'
post
'
,
data
})
}
export
function
getApplications
(
data
)
{
return
request
({
url
:
'
/pipeline/find
'
,
method
:
'
post
'
,
data
})
}
export
function
deleteApplication
(
data
)
{
return
request
({
url
:
`/pipeline/delete`
,
method
:
'
post
'
,
data
})
}
export
function
updateApplication
(
data
)
{
return
request
({
url
:
'
/manage/application
'
,
method
:
'
put
'
,
data
})
}
src/views/pipeline/application.vue
View file @
48195e22
<
template
>
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<el-input
v-model=
"listQuery.
tag
"
placeholder=
"应用名称"
clearable
style=
"width: 200px;"
class=
"filter-item"
@
keyup.enter.native=
"handleFilter"
/>
<el-input
v-model=
"listQuery.
own
er"
placeholder=
"新建用户"
clearable
style=
"width: 200px;"
class=
"filter-item"
@
keyup.enter.native=
"handleFilter"
/>
<el-input
v-model=
"listQuery.
application_name
"
placeholder=
"应用名称"
clearable
style=
"width: 200px;"
class=
"filter-item"
@
keyup.enter.native=
"handleFilter"
/>
<el-input
v-model=
"listQuery.
new_us
er"
placeholder=
"新建用户"
clearable
style=
"width: 200px;"
class=
"filter-item"
@
keyup.enter.native=
"handleFilter"
/>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleFilter"
>
{{
$t
(
'
table.search
'
)
}}
</el-button>
<el-button
class=
"filter-item"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleCreate"
>
添加
</el-button>
</div>
...
...
@@ -19,41 +19,19 @@
<span>
{{
scope
.
$index
+
1
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"应用名称"
prop=
"
tag
"
align=
"center"
>
<el-table-column
label=
"应用名称"
prop=
"
application_name
"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<span
class=
"link-type"
@
click=
"handleUpdate(scope.row)"
>
{{
scope
.
row
.
tag
}}
</span>
<span
class=
"link-type"
@
click=
"handleUpdate(scope.row)"
>
{{
scope
.
row
.
application_name
}}
</span>
</
template
>
</el-table-column>
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">
<span>{{ scope.row.status }}</span>
</template>
</el-table-column> -->
<!-- <el-table-column label="通知方式" align="center">
<template slot-scope="scope">
<span>{{ scope.row.noticeType }}</span>
</template>
</el-table-column> -->
<el-table-column
label=
"项目与分支"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<div
v-for=
"item in scope.row.repos"
:key=
"item.id"
>
{{
item
.
repository
.
name
}}
:
{{
item
.
ref
.
name
|
replaceeRef
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"新建用户->修改用户"
align=
"center"
>
<el-table-column
label=
"项目->分支"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.editor"
>
{{
scope
.
row
.
owner
}}
->
{{
scope
.
row
.
editor
}}
</span>
<span
v-if=
"!scope.row.editor"
>
{{
scope
.
row
.
owner
}}
</span>
<div
v-for=
"item in scope.row.repos"
:key=
"item.id"
><b>
{{
item
.
repository
}}
</b>
->
{{
item
.
ref
.
name
|
replaceeRef
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"更新时间"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
updateTime
|
formatDate
}}
</span>
</
template
>
</el-table-column>
<el-table-column
prop=
"new_user"
label=
"创建者"
align=
"center"
/>
<el-table-column
prop=
"create_time"
label=
"创建时间"
align=
"center"
/>
<el-table-column
:label=
"$t('table.actions')"
align=
"center"
width=
"180"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"primary"
size=
"mini"
@
click=
"handleUpdate(scope.row)"
>
{{
$t
(
'
table.edit
'
)
}}
</el-button>
...
...
@@ -67,18 +45,18 @@
<el-dialog
:title=
"dialogStatus"
:visible.sync=
"dialogFormVisible"
>
<el-form
ref=
"dataForm"
:rules=
"rules"
:model=
"temp"
label-position=
"left"
label-width=
"80px"
style=
"width: 90%; margin-left:40px;"
>
<el-form-item
label=
"应用名称"
prop=
"
tag
"
>
<el-input
v-model=
"temp.
tag
"
/>
<el-form-item
label=
"应用名称"
prop=
"
application_name
"
>
<el-input
v-model=
"temp.
application_name
"
/>
</el-form-item>
<div
>
<div
v-for=
"(repoAndRefItem,index) in temp.repos"
:key=
"repoAndRefItem.id"
style=
"width:110%;margin-bottom:20px"
>
<label
style=
"margin-right:20px"
>
项目
</label>
<el-select
v-model=
"repoAndRefItem.repository"
value-key=
"id"
style=
"width:30%"
class=
"filter-item"
@
change=
"getRefs
"
>
<el-option
v-for=
"item in repos"
:value=
"item
"
:label=
"item.name"
:key=
"item.id
"
/>
<el-select
v-model=
"repoAndRefItem.repository"
filterable
value-key=
"id"
style=
"width:30%"
class=
"filter-item"
@
change=
"getRefs(repoAndRefItem.repository,true)
"
>
<el-option
v-for=
"item in repos"
:value=
"item
.project_name"
:label=
"item.project_name"
:key=
"item.project_name
"
/>
</el-select>
<label
style=
"margin:20px"
>
分支
</label>
<el-select
v-model=
"repoAndRefItem.ref"
value-key=
"id"
style=
"width:30%"
class=
"filter-item"
>
<el-option
v-for=
"item in refs[repoAndRefItem.repository
.id]"
:value=
"item"
:label=
"item.name | replaceeRef"
:key=
"item.id
"
/>
<el-select
v-model=
"repoAndRefItem.ref"
filterable
value-key=
"id"
style=
"width:30%"
class=
"filter-item"
>
<el-option
v-for=
"item in refs[repoAndRefItem.repository
]"
:value=
"item"
:label=
"item.name"
:key=
"item.name
"
/>
</el-select>
<el-button
:disabled=
"index===0?true:false"
style=
"margin-left:5px"
@
click=
"temp.repos.splice(index, 1)"
>
删除
</el-button>
</div>
...
...
@@ -94,6 +72,16 @@
<el-form-item
v-if=
"temp.noticeType === 'dingding'"
label=
"通知地址"
>
<el-input
:autosize=
"{ minRows: 3, maxRows: 4}"
v-model=
"temp.noticeAddress"
type=
"textarea"
placeholder=
"Please input"
/>
</el-form-item>
<el-form-item
label=
"是否部署到容器"
label-width=
"120"
>
<el-switch
v-model=
"temp.isDeploy"
inactive-color=
"#efefef"
active-color=
"#13ce66"
/>
</el-form-item>
<el-form-item
v-if=
"temp.isDeploy"
label=
"namespace"
prop=
"namespace"
>
<el-input
v-model=
"temp.namespace"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogFormVisible = false"
>
{{ $t('table.cancel') }}
</el-button>
...
...
@@ -103,7 +91,7 @@
<el-dialog
:visible.sync=
"dialogDeleteVisible"
:data=
"temp"
title=
"Delete"
>
<span
>
确定要删除{{ temp.
tag
}}吗?
确定要删除{{ temp.
application_name
}}吗?
</span>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogDeleteVisible = false"
>
{{ $t('table.cancel') }}
</el-button>
...
...
@@ -115,7 +103,8 @@
</template>
<
script
>
import
{
getApplications
,
saveApplication
,
updateApplication
,
deleteApplication
,
getRepos
,
getRefs
}
from
'
@/api/pipeline
'
import
{
getApplications
,
saveApplication
,
updateApplication
,
deleteApplication
,
getMaster
}
from
'
@/api/pipelineNode
'
import
{
getProjects
}
from
'
@/api/proconfig
'
import
waves
from
'
@/directive/waves
'
// Waves directive
import
Pagination
from
'
@/components/Pagination
'
// Secondary package based on el-pagination
import
moment
from
'
moment
'
...
...
@@ -136,6 +125,7 @@ export default {
return
{
repository
:
''
,
total
:
0
,
cacheData
:
{},
listLoading
:
true
,
listQuery
:
{
},
...
...
@@ -145,9 +135,9 @@ export default {
dialogDeleteVisible
:
false
,
dialogStatus
:
''
,
rules
:
{
tag
:
[{
required
:
true
,
message
:
'
请输入
'
,
trigger
:
'
change
'
}]
application_name
:
[{
required
:
true
,
message
:
'
请输入
'
,
trigger
:
'
change
'
}],
// timestamp: [{ type: 'date', required: true, message: 'timestamp is required', trigger: 'change' }],
// title: [{ required: true, message: 'title is required
', trigger: 'blur' }]
namespace
:
[{
required
:
true
,
message
:
'
请输入
'
,
trigger
:
'
blur
'
}]
},
noticeTypes
:
[
'
dingding
'
,
'
mail
'
],
applications
:
[],
...
...
@@ -173,28 +163,14 @@ export default {
delete
this
.
listQuery
[
prop
]
}
}
getApplications
(
this
.
listQuery
).
then
(
res
=>
{
this
.
applications
=
res
.
data
.
data
var
arr
=
Object
.
keys
(
this
.
listQuery
)
getApplications
(
arr
.
length
>
0
?
this
.
listQuery
:
null
).
then
(
res
=>
{
this
.
applications
=
res
.
data
this
.
listLoading
=
false
})
},
getRefs
(
repo
)
{
console
.
log
(
repo
)
getRefs
(
repo
.
id
).
then
(
res
=>
{
this
.
$set
(
this
.
refs
,
repo
.
id
,
res
.
data
.
data
.
map
(
item
=>
{
return
{
id
:
item
.
id
,
name
:
item
.
ref
}
}))
this
.
refs
[
repo
.
id
].
push
({
id
:
'
0
'
,
name
:
'
请选择
'
})
this
.
refs
[
repo
.
id
].
reverse
()
})
},
newRepoAndRef
()
{
this
.
temp
.
repos
.
push
({
repository
:
{}
,
ref
:
{}})
this
.
temp
.
repos
.
push
({
repository
:
''
,
ref
:
{}})
},
handleFilter
()
{
...
...
@@ -204,31 +180,68 @@ export default {
resetTemp
()
{
this
.
temp
=
{
id
:
0
,
namespace
:
null
,
noticeAddress
:
''
,
noticeType
:
''
,
repos
:
[{
repository
:
{
id
:
'
请选择
'
},
ref
:
{
id
:
'
请选择
'
}}],
status
:
'
run
'
,
tag
:
''
isDeploy
:
false
,
repos
:
[{
repository
:
''
,
ref
:
{
id
:
'
请选择
'
}}],
application_name
:
''
,
create_time
:
moment
().
format
(
'
YYYY-MM-DD HH:mm:ss
'
),
new_user
:
''
,
update_user
:
''
}
},
handleCreate
()
{
this
.
resetTemp
()
this
.
dialogStatus
=
'
新建
'
get
Repos
(
).
then
(
res
=>
{
this
.
repos
=
res
.
data
.
data
get
Projects
({
is_active
:
true
}
).
then
(
res
=>
{
this
.
repos
=
res
.
data
this
.
repos
.
sort
((
s1
,
s2
)
=>
{
return
s1
.
name
.
localeCompare
(
s2
.
name
)
return
s1
.
project_name
.
localeCompare
(
s2
.
project_
name
)
})
this
.
listLoading
=
false
})
this
.
dialogFormVisible
=
true
},
getRefs
(
repo
,
flag
)
{
if
(
flag
)
{
this
.
temp
.
repos
.
forEach
(
item
=>
{
if
(
item
.
repository
===
repo
)
{
item
.
ref
=
{}
}
})
}
getMaster
({
name
:
repo
}).
then
(
res
=>
{
if
(
res
.
data
.
code
===
'
0001
'
)
{
console
.
log
(
'
无法获取分支
'
)
}
else
{
this
.
$set
(
this
.
refs
,
repo
,
res
.
data
.
data
.
map
(
item
=>
{
return
{
id
:
item
.
commit
.
id
,
name
:
item
.
name
}
}))
this
.
refs
[
repo
].
push
({
id
:
'
0
'
,
name
:
'
请选择
'
})
this
.
refs
[
repo
].
reverse
()
}
})
},
createData
()
{
this
.
$refs
[
'
dataForm
'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
// 数组清洗整合,
this
.
temp
.
repos
.
forEach
(
item
=>
{
this
.
repos
.
forEach
(
value
=>
{
if
(
item
.
repository
===
value
.
project_name
)
{
this
.
$set
(
item
,
'
type
'
,
value
.
type
)
this
.
$set
(
item
,
'
groupName
'
,
value
.
git_path_group
)
}
})
})
if
(
this
.
dialogStatus
===
'
新建
'
)
{
this
.
temp
.
new_user
=
this
.
$store
.
getters
.
name
saveApplication
(
this
.
temp
).
then
(()
=>
{
this
.
dialogFormVisible
=
false
this
.
$notify
({
...
...
@@ -240,6 +253,7 @@ export default {
this
.
getApplications
()
})
}
else
{
this
.
temp
.
update_user
=
this
.
$store
.
getters
.
name
updateApplication
(
this
.
temp
).
then
(()
=>
{
this
.
dialogFormVisible
=
false
this
.
$notify
({
...
...
@@ -256,13 +270,14 @@ export default {
},
handleUpdate
(
row
)
{
console
.
log
(
row
)
this
.
temp
=
Object
.
assign
({},
row
)
// copy obj
this
.
dialogStatus
=
'
编辑
'
this
.
dialogFormVisible
=
true
get
Repos
(
).
then
(
res
=>
{
this
.
repos
=
res
.
data
.
data
get
Projects
({
is_active
:
true
}
).
then
(
res
=>
{
this
.
repos
=
res
.
data
this
.
repos
.
sort
((
s1
,
s2
)
=>
{
return
s1
.
name
.
localeCompare
(
s2
.
name
)
return
s1
.
project_name
.
localeCompare
(
s2
.
project_
name
)
})
this
.
listLoading
=
false
})
...
...
@@ -270,14 +285,14 @@ export default {
this
.
getRefs
(
item
.
repository
)
})
},
handleDelete
(
row
)
{
console
.
log
(
row
)
this
.
temp
=
row
this
.
dialogDeleteVisible
=
true
},
deleteData
()
{
deleteApplication
(
this
.
temp
.
id
).
then
(()
=>
{
deleteApplication
(
{
id
:
this
.
temp
.
_id
}
).
then
(()
=>
{
this
.
dialogDeleteVisible
=
false
this
.
$notify
({
title
:
'
成功
'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment