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
eade9f0d
Commit
eade9f0d
authored
May 07, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑删除模板
parent
3b6534e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
8 deletions
+65
-8
docker.js
src/api/docker.js
+16
-0
createEnv.vue
src/views/docker/createEnv.vue
+1
-1
envTemplate.vue
src/views/docker/envTemplate.vue
+48
-7
No files found.
src/api/docker.js
View file @
eade9f0d
...
@@ -32,6 +32,22 @@ export function createEnvTemplate(data) {
...
@@ -32,6 +32,22 @@ export function createEnvTemplate(data) {
})
})
}
}
export
function
saveEnvTemplate
(
data
)
{
return
request
({
url
:
'
/envTemplate/save
'
,
method
:
'
post
'
,
data
})
}
export
function
deleteEnvTemplate
(
query
)
{
return
request
({
url
:
'
/envTemplate/delete
'
,
method
:
'
get
'
,
params
:
query
})
}
export
function
createEnv
(
data
)
{
export
function
createEnv
(
data
)
{
return
request
({
return
request
({
url
:
'
/env/create
'
,
url
:
'
/env/create
'
,
...
...
src/views/docker/createEnv.vue
View file @
eade9f0d
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<el-form-item
v-for=
"(ns, index) in repoNamespaces"
:label=
"ns.type | upper"
:key=
"index"
>
<el-form-item
v-for=
"(ns, index) in repoNamespaces"
:label=
"ns.type | upper"
:key=
"index"
>
<el-card>
<el-card>
<el-button
<el-button
v-loading=
"l
istL
oading"
v-loading=
"loading"
v-for=
"item in ns.repos"
v-for=
"item in ns.repos"
:key=
"item.domain"
:key=
"item.domain"
:type=
"dependant[ns.type] && dependant[ns.type].find(sys => sys.appname === item.appname) ? 'success' : ''"
:type=
"dependant[ns.type] && dependant[ns.type].find(sys => sys.appname === item.appname) ? 'success' : ''"
...
...
src/views/docker/envTemplate.vue
View file @
eade9f0d
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<el-card>
<el-card>
<el-button
<el-button
v-for=
"item in ns.repos"
v-for=
"item in ns.repos"
:key=
"item.
domain
"
:key=
"item.
appname
"
:type=
"dependant[ns.type] && dependant[ns.type].find(sys => sys.appname === item.appname) ? 'success' : ''"
:type=
"dependant[ns.type] && dependant[ns.type].find(sys => sys.appname === item.appname) ? 'success' : ''"
style=
"margin:3px"
style=
"margin:3px"
@
click=
"selectSystem(item, ns.type)"
>
@
click=
"selectSystem(item, ns.type)"
>
...
@@ -21,13 +21,17 @@
...
@@ -21,13 +21,17 @@
</el-button>
</el-button>
</el-card>
</el-card>
</el-form-item>
</el-form-item>
</el-form>
</el-form
>
<el-button
v-permission=
"['admin']"
:disabled=
"loading"
style=
"margin-right:40px;margin-bottom:40px;float:right"
type=
"primary"
@
click=
"createData()"
>
{{
$t
(
'
table.confirm
'
)
}}
</el-button>
<div
style=
"float:right"
>
<el-button
v-permission=
"['admin']"
:disabled=
"name.length === 0"
style=
"margin-right:10px;margin-bottom:40px;"
type=
"primary"
@
click=
"createData()"
>
新建
</el-button>
<el-button
v-permission=
"['admin']"
:disabled=
"!currentTemplateObj.base"
style=
"margin-right:10px;margin-bottom:40px;"
type=
"primary"
@
click=
"saveData()"
>
保存
</el-button>
<el-button
v-permission=
"['admin']"
:disabled=
"!currentTemplateObj.base"
style=
"margin-right:40px;margin-bottom:40px;"
type=
"danger"
@
click=
"deleteData()"
>
删除
</el-button>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getAllRepos
,
getAllEnvTemplate
,
createEnvTemplate
}
from
'
@/api/docker
'
import
{
getAllRepos
,
getAllEnvTemplate
,
createEnvTemplate
,
saveEnvTemplate
,
deleteEnvTemplate
}
from
'
@/api/docker
'
import
permission
from
'
@/directive/permission/index.js
'
// 权限判断指令
import
permission
from
'
@/directive/permission/index.js
'
// 权限判断指令
export
default
{
export
default
{
...
@@ -47,6 +51,7 @@ export default {
...
@@ -47,6 +51,7 @@ export default {
dependant
:
{},
dependant
:
{},
repoNamespaces
:
[],
repoNamespaces
:
[],
currentTemplate
:
''
,
currentTemplate
:
''
,
currentTemplateObj
:
{},
templates
:
{},
templates
:
{},
loading
:
true
loading
:
true
}
}
...
@@ -84,15 +89,15 @@ export default {
...
@@ -84,15 +89,15 @@ export default {
useTemplate
()
{
useTemplate
()
{
const
vm
=
this
const
vm
=
this
const
t
=
this
.
templates
.
find
(
item
=>
item
.
name
===
this
.
currentTemplate
)
this
.
currentTemplateObj
=
this
.
templates
.
find
(
item
=>
item
.
name
===
this
.
currentTemplate
)
// 清空所有选择
// 清空所有选择
vm
.
$set
(
this
,
'
dependant
'
,
{})
vm
.
$set
(
this
,
'
dependant
'
,
{})
// 遍历设置
// 遍历设置
const
keys
=
Object
.
keys
(
t
)
const
keys
=
Object
.
keys
(
t
his
.
currentTemplateObj
)
keys
.
forEach
(
key
=>
{
keys
.
forEach
(
key
=>
{
if
(
key
!==
'
name
'
&&
key
!==
'
_id
'
)
{
if
(
key
!==
'
name
'
&&
key
!==
'
_id
'
)
{
t
[
key
].
forEach
(
repo
=>
{
t
his
.
currentTemplateObj
[
key
].
forEach
(
repo
=>
{
vm
.
selectSystem
(
repo
,
key
)
vm
.
selectSystem
(
repo
,
key
)
})
})
}
}
...
@@ -111,6 +116,42 @@ export default {
...
@@ -111,6 +116,42 @@ export default {
type
:
'
success
'
,
type
:
'
success
'
,
duration
:
1000
duration
:
1000
})
})
this
.
getAllEnvTemplate
()
})
},
saveData
()
{
const
param
=
{
name
:
this
.
currentTemplateObj
.
name
,
_id
:
this
.
currentTemplateObj
.
_id
,
...
this
.
dependant
}
saveEnvTemplate
(
param
).
then
(
res
=>
{
// todo: 异常在http服务统一处理
this
.
$message
({
message
:
res
.
data
||
'
环境模板保存成功
'
,
type
:
'
success
'
,
duration
:
1000
})
this
.
getAllEnvTemplate
()
})
},
deleteData
()
{
const
vm
=
this
const
param
=
{
_id
:
this
.
currentTemplateObj
.
_id
}
deleteEnvTemplate
(
param
).
then
(
res
=>
{
// todo: 异常在http服务统一处理
this
.
$message
({
message
:
'
环境模板删除成功
'
,
type
:
'
success
'
,
duration
:
1000
})
this
.
getAllEnvTemplate
()
this
.
currentTemplate
=
'
空
'
vm
.
$set
(
this
,
'
dependant
'
,
{})
})
})
}
}
}
}
...
...
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