Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
go-atomci
atomci
提交
171a94a2
atomci
项目概览
go-atomci
/
atomci
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
atomci
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
171a94a2
编写于
3月 02, 2022
作者:
C
colynn.liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: integrate add scm integrate
上级
03f7f62a
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
429 addition
and
15 deletion
+429
-15
constant/const.go
constant/const.go
+14
-0
internal/api/integrate.go
internal/api/integrate.go
+19
-3
internal/core/settings/settings.go
internal/core/settings/settings.go
+22
-4
internal/dao/integrate_settings.go
internal/dao/integrate_settings.go
+7
-4
internal/routers/router.go
internal/routers/router.go
+1
-0
web/src/api/backend.js
web/src/api/backend.js
+2
-2
web/src/router/index.js
web/src/router/index.js
+6
-0
web/src/views/project/components/EnvCreate.vue
web/src/views/project/components/EnvCreate.vue
+0
-2
web/src/views/setting/ScmIntegrate.vue
web/src/views/setting/ScmIntegrate.vue
+146
-0
web/src/views/setting/components/ScmIntegrateCreate.vue
web/src/views/setting/components/ScmIntegrateCreate.vue
+212
-0
未找到文件。
constant/const.go
浏览文件 @
171a94a2
...
...
@@ -54,3 +54,17 @@ const (
// HelmDeployType helm 部署
HelmDeployType
=
"helm"
)
// integrate type
const
(
SCMGitlab
=
"gitlab"
SCMGithub
=
"github"
SCMGitea
=
"gitea"
SCMGitee
=
"gitee"
IntegrateKubernetes
=
"kubernetes"
IntegrateJenkins
=
"jenkins"
IntegrateRegistry
=
"registry"
)
var
Integratetypes
=
[]
string
{
IntegrateKubernetes
,
IntegrateJenkins
,
IntegrateRegistry
}
var
ScmIntegratetypes
=
[]
string
{
SCMGitlab
,
SCMGithub
,
SCMGitea
,
SCMGitee
}
internal/api/integrate.go
浏览文件 @
171a94a2
...
...
@@ -17,6 +17,8 @@ limitations under the License.
package
api
import
(
"github.com/go-atomci/atomci/constant"
"github.com/go-atomci/atomci/internal/core/settings"
"github.com/go-atomci/atomci/internal/middleware/log"
)
...
...
@@ -28,7 +30,7 @@ type IntegrateController struct {
func
(
p
*
IntegrateController
)
GetClusterIntegrateSettings
()
{
pm
:=
settings
.
NewSettingManager
()
rsp
,
err
:=
pm
.
GetIntegrateSettings
(
"kubernetes"
)
rsp
,
err
:=
pm
.
GetIntegrateSettings
(
[]
string
{
constant
.
IntegrateKubernetes
}
)
if
err
!=
nil
{
p
.
HandleInternalServerError
(
err
.
Error
())
log
.
Log
.
Error
(
"Get integrate settings occur error: %s"
,
err
.
Error
())
...
...
@@ -41,7 +43,7 @@ func (p *IntegrateController) GetClusterIntegrateSettings() {
// GetIntegrateSettings ..
func
(
p
*
IntegrateController
)
GetIntegrateSettings
()
{
pm
:=
settings
.
NewSettingManager
()
rsp
,
err
:=
pm
.
GetIntegrateSettings
(
""
)
rsp
,
err
:=
pm
.
GetIntegrateSettings
(
constant
.
Integratetypes
)
if
err
!=
nil
{
p
.
HandleInternalServerError
(
err
.
Error
())
log
.
Log
.
Error
(
"Get integrate settings occur error: %s"
,
err
.
Error
())
...
...
@@ -55,7 +57,21 @@ func (p *IntegrateController) GetIntegrateSettings() {
func
(
p
*
IntegrateController
)
GetIntegrateSettingsByPagination
()
{
filterQuery
:=
p
.
GetFilterQuery
()
pm
:=
settings
.
NewSettingManager
()
rsp
,
err
:=
pm
.
GetIntegrateSettingsByPagination
(
filterQuery
)
rsp
,
err
:=
pm
.
GetIntegrateSettingsByPagination
(
filterQuery
,
constant
.
Integratetypes
)
if
err
!=
nil
{
p
.
HandleInternalServerError
(
err
.
Error
())
log
.
Log
.
Error
(
"Get integrate settings occur error: %s"
,
err
.
Error
())
return
}
p
.
Data
[
"json"
]
=
NewResult
(
true
,
rsp
,
""
)
p
.
ServeJSON
()
}
// GetSCMIntegrateSettingsByPagination ..
func
(
p
*
IntegrateController
)
GetSCMIntegrateSettingsByPagination
()
{
filterQuery
:=
p
.
GetFilterQuery
()
pm
:=
settings
.
NewSettingManager
()
rsp
,
err
:=
pm
.
GetIntegrateSettingsByPagination
(
filterQuery
,
constant
.
ScmIntegratetypes
)
if
err
!=
nil
{
p
.
HandleInternalServerError
(
err
.
Error
())
log
.
Log
.
Error
(
"Get integrate settings occur error: %s"
,
err
.
Error
())
...
...
internal/core/settings/settings.go
浏览文件 @
171a94a2
...
...
@@ -89,6 +89,16 @@ type RegistryConfig struct {
IsHttps
bool
`json:"isHttps,omitempty"`
}
type
ScmBaseConfig
struct
{
URL
string
`json:"url,omitempty"`
Token
string
`json:"token,omitempty"`
}
type
ScmGitlabConfig
struct
{
ScmBaseConfig
User
string
`json:"user,omitempty"`
}
type
JenkinsConfig
struct
{
BaseConfig
Token
string
`json:"token,omitempty"`
...
...
@@ -116,6 +126,14 @@ func (config *Config) Struct(sc string, settingType string) (interface{}, error)
registry
:=
&
RegistryConfig
{}
err
:=
json
.
Unmarshal
([]
byte
(
sc
),
registry
)
return
registry
,
err
case
"gitlab"
:
scmConf
:=
&
ScmGitlabConfig
{}
err
:=
json
.
Unmarshal
([]
byte
(
sc
),
scmConf
)
return
scmConf
,
err
case
"gitea"
,
"gitee"
,
"github"
:
scmConf
:=
&
ScmBaseConfig
{}
err
:=
json
.
Unmarshal
([]
byte
(
sc
),
scmConf
)
return
scmConf
,
err
default
:
log
.
Log
.
Warn
(
"this settings type %s is not support, return origin string"
,
settingType
)
return
sc
,
nil
...
...
@@ -130,8 +148,8 @@ func NewSettingManager() *SettingManager {
}
// GetIntegrateSettings ..
func
(
pm
*
SettingManager
)
GetIntegrateSettings
(
integrateType
string
)
([]
*
IntegrateSettingResponse
,
error
)
{
items
,
err
:=
pm
.
model
.
GetIntegrateSettings
(
integrateType
)
func
(
pm
*
SettingManager
)
GetIntegrateSettings
(
integrateType
s
[]
string
)
([]
*
IntegrateSettingResponse
,
error
)
{
items
,
err
:=
pm
.
model
.
GetIntegrateSettings
(
integrateType
s
)
if
err
!=
nil
{
log
.
Log
.
Error
(
"get interate settings error: %s"
,
err
.
Error
())
return
nil
,
err
...
...
@@ -152,8 +170,8 @@ func (pm *SettingManager) GetIntegrateSettingByID(id int64) (*IntegrateSettingRe
}
// GetIntegrateSettingsByPagination ..
func
(
pm
*
SettingManager
)
GetIntegrateSettingsByPagination
(
filter
*
query
.
FilterQuery
)
(
*
query
.
QueryResult
,
error
)
{
queryResult
,
settingsList
,
err
:=
pm
.
model
.
GetIntegrateSettingsByPagination
(
filter
)
func
(
pm
*
SettingManager
)
GetIntegrateSettingsByPagination
(
filter
*
query
.
FilterQuery
,
intergrateTypes
[]
string
)
(
*
query
.
QueryResult
,
error
)
{
queryResult
,
settingsList
,
err
:=
pm
.
model
.
GetIntegrateSettingsByPagination
(
filter
,
intergrateTypes
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
internal/dao/integrate_settings.go
浏览文件 @
171a94a2
...
...
@@ -50,11 +50,11 @@ func (model *SysSettingModel) GetIntegrateSettingByID(integrateSettingID int64)
}
// GetIntegrateSettings ...
func
(
model
*
SysSettingModel
)
GetIntegrateSettings
(
integrateType
string
)
([]
*
models
.
IntegrateSetting
,
error
)
{
func
(
model
*
SysSettingModel
)
GetIntegrateSettings
(
integrateType
s
[]
string
)
([]
*
models
.
IntegrateSetting
,
error
)
{
integrateSettings
:=
[]
*
models
.
IntegrateSetting
{}
qs
:=
model
.
ormer
.
QueryTable
(
model
.
IntegrateSettingTableName
)
.
Filter
(
"deleted"
,
false
)
if
integrateType
!=
""
{
qs
=
qs
.
Filter
(
"type
"
,
integrateType
)
if
len
(
integrateTypes
)
>
0
{
qs
=
qs
.
Filter
(
"type
__in"
,
integrateTypes
)
}
_
,
err
:=
qs
.
All
(
&
integrateSettings
)
if
err
!=
nil
{
...
...
@@ -64,7 +64,7 @@ func (model *SysSettingModel) GetIntegrateSettings(integrateType string) ([]*mod
}
// GetIntegrateSettingsByPagination ..
func
(
model
*
SysSettingModel
)
GetIntegrateSettingsByPagination
(
filter
*
query
.
FilterQuery
)
(
*
query
.
QueryResult
,
[]
*
models
.
IntegrateSetting
,
error
)
{
func
(
model
*
SysSettingModel
)
GetIntegrateSettingsByPagination
(
filter
*
query
.
FilterQuery
,
intergrateTypes
[]
string
)
(
*
query
.
QueryResult
,
[]
*
models
.
IntegrateSetting
,
error
)
{
rst
:=
&
query
.
QueryResult
{
Item
:
[]
*
models
.
IntegrateSetting
{}}
queryCond
:=
orm
.
NewCondition
()
.
AndCond
(
orm
.
NewCondition
()
.
And
(
"deleted"
,
false
))
...
...
@@ -72,6 +72,9 @@ func (model *SysSettingModel) GetIntegrateSettingsByPagination(filter *query.Fil
queryCond
=
queryCond
.
AndCond
(
filterCond
)
}
qs
:=
model
.
ormer
.
QueryTable
(
model
.
IntegrateSettingTableName
)
.
OrderBy
(
"-create_at"
)
.
SetCond
(
queryCond
)
if
len
(
intergrateTypes
)
>
0
{
qs
=
qs
.
Filter
(
"type__in"
,
intergrateTypes
)
}
count
,
err
:=
qs
.
Count
()
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
internal/routers/router.go
浏览文件 @
171a94a2
...
...
@@ -81,6 +81,7 @@ func RegisterRoutes() {
// Integrate Settings
beego
.
NSRouter
(
"/integrate/settings"
,
&
api
.
IntegrateController
{},
"get:GetIntegrateSettings;post:GetIntegrateSettingsByPagination"
),
beego
.
NSRouter
(
"/integrate/settings/create"
,
&
api
.
IntegrateController
{},
"post:CreateIntegrateSetting"
),
beego
.
NSRouter
(
"/integrate/settings/scms"
,
&
api
.
IntegrateController
{},
"post:GetSCMIntegrateSettingsByPagination"
),
beego
.
NSRouter
(
"/integrate/settings/:id"
,
&
api
.
IntegrateController
{},
"put:UpdateIntegrateSetting;delete:DeleteIntegrateSetting"
),
beego
.
NSRouter
(
"/integrate/settings/verify"
,
&
api
.
IntegrateController
{},
"post:VerifyIntegrateSetting"
),
beego
.
NSRouter
(
"/integrate/clusters"
,
&
api
.
IntegrateController
{},
"get:GetClusterIntegrateSettings"
),
...
...
web/src/api/backend.js
浏览文件 @
171a94a2
...
...
@@ -713,8 +713,8 @@ const backendAPI = {
getIntegrateSettings
(
body
,
cb
)
{
Package
.
httpMethods
(
'
post
'
,
'
/atomci/api/v1/integrate/settings
'
,
cb
,
body
);
},
getS
tagesAll
(
cb
)
{
Package
.
httpMethods
(
'
get
'
,
'
/atomci/api/v1/integrate/settings
'
,
cb
);
getS
CMIntegrateSettings
(
body
,
cb
)
{
Package
.
httpMethods
(
'
post
'
,
'
/atomci/api/v1/integrate/settings/scms
'
,
cb
,
body
);
},
AddIntegrateSetting
(
body
,
cb
)
{
Package
.
httpMethods
(
'
post
'
,
'
/atomci/api/v1/integrate/settings/create
'
,
cb
,
body
);
...
...
web/src/router/index.js
浏览文件 @
171a94a2
...
...
@@ -80,6 +80,12 @@ export const asyncRoutes = [
name
:
'
serviceIntegrate
'
,
meta
:
{
title
:
'
服务集成
'
,
noCache
:
true
}
},
{
path
:
'
/settings/smcintegrate
'
,
component
:
()
=>
import
(
'
@/views/setting/ScmIntegrate.vue
'
),
name
:
'
scmIntegrate
'
,
meta
:
{
title
:
'
代码源集成
'
,
noCache
:
true
}
},
{
path
:
'
/settings/task
'
,
component
:
()
=>
import
(
'
@/views/setting/Node.vue
'
),
...
...
web/src/views/project/components/EnvCreate.vue
浏览文件 @
171a94a2
...
...
@@ -125,8 +125,6 @@ export default {
case
'
registry
'
:
this
.
registryList
.
push
(
element
)
break
;
default
:
console
.
log
(
"
this type not support
"
,
element
.
type
)
}
});
}
...
...
web/src/views/setting/ScmIntegrate.vue
0 → 100644
浏览文件 @
171a94a2
<
template
>
<div
class=
"portlet-body"
>
<template>
<div
class=
"table-toolbar"
>
<el-row>
<el-col
:span=
"10"
>
<refresh
v-on:getlist=
"getList"
></refresh>
<el-button
:plain=
"true"
type=
"primary"
@
click=
"$refs.create.doCreate(false)"
>
<i
class=
'icon-plus'
/>
新建
</el-button>
</el-col>
<el-col
:span=
"6"
>
</el-col>
<el-col
:span=
"8"
>
<list-search
ref=
"userSh"
:searchList=
"searchList"
v-on:changeFilterTxt=
"changeFilterTxt"
></list-search>
</el-col>
</el-row>
</div>
<template>
<el-table
stripe
:data=
"dataList"
>
<span
slot=
"empty"
>
{{
loading
?
$t
(
'
bm.add.dataLoading
'
):
noDataTxt
}}
</span>
<el-table-column
prop=
"name"
label=
"名称"
sortable
min-width=
"15%"
:show-overflow-tooltip=
true
/>
<el-table-column
prop=
"type"
label=
"类型"
sortable
min-width=
"20%"
:show-overflow-tooltip=
true
>
<template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.type === 'gitee'"
>
<el-tag
type=
"danger"
>
{{
scope
.
row
.
type
}}
</el-tag>
</div>
<div
v-else-if=
"scope.row.type === 'gitea'"
>
<el-tag
type=
"success"
>
{{
scope
.
row
.
type
}}
</el-tag>
</div>
<div
v-else
>
<el-tag>
{{
scope
.
row
.
type
}}
</el-tag>
</div>
</
template
>
</el-table-column>
<el-table-column
prop=
"description"
label=
"描述信息"
min-width=
"20%"
:show-overflow-tooltip=
true
/>
<el-table-column
prop=
"creator"
:label=
"$t('bm.serviceM.creator')"
sortable
min-width=
"10%"
:show-overflow-tooltip=
true
/>
<el-table-column
prop=
"create_at"
:label=
"$t('bm.serviceM.creationTime')"
sortable
min-width=
"15%"
:show-overflow-tooltip=
true
/>
<el-table-column
:label=
"$t('bm.deployCenter.operation')"
min-width=
"15%"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"text"
size=
"small"
@
click=
"$refs.create.doCreate(true, scope.row)"
>
{{
$t
(
'
bm.infrast.edit
'
)
}}
</el-button>
<el-button
@
click=
"$refs.commonDelete.doDelete('delIntegrateSetting',scope.row.id)"
type=
"text"
size=
"small"
>
{{
$t
(
'
bm.other.delete
'
)
}}
</el-button>
</
template
>
</el-table-column>
</el-table>
</template>
<page-nav
ref=
"pages"
:list=
"curList"
v-on:getlist=
"getList"
></page-nav>
</template>
<common-delete
ref=
"commonDelete"
v-on:getlist=
"getList"
></common-delete>
<scm-integrate-create
ref=
"create"
v-on:getlist=
"getList"
></scm-integrate-create>
</div>
</template>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
;
import
backend
from
'
@/api/backend
'
;
import
ListSearch
from
'
@/components/utils/ListSearch
'
;
import
PageNav
from
'
@/components/utils/PageList
'
;
import
CommonDelete
from
'
@/components/utils/Delete
'
;
import
Refresh
from
'
@/components/utils/Refresh
'
;
import
listTemplate
from
'
@/common/listTemplate
'
;
import
Utils
from
'
@/common/utils
'
;
import
ScmIntegrateCreate
from
'
./components/ScmIntegrateCreate
'
;
export
default
{
mixins
:
[
listTemplate
],
data
()
{
return
{
curList
:
[],
searchList
:
[
{
key
:
'
type
'
,
txt
:
'
配置类型
'
},
{
key
:
'
creator
'
,
txt
:
this
.
$t
(
'
bm.serviceM.creator
'
)
},
],
filterTxt
:
''
,
detailInfo
:
[],
param
:
{},
searchVal
:
''
,
searchType
:
''
,
};
},
components
:
{
ListSearch
,
PageNav
,
Refresh
,
ScmIntegrateCreate
,
CommonDelete
,
},
mounted
()
{
// this.getList();
},
mounted
()
{
this
.
getList
(
true
);
},
computed
:
{
...
mapGetters
({
loading
:
'
getLoading
'
,
}),
dataList
()
{
// 强制替换dataList替代listtemplate中的方法
return
this
.
curList
;
},
},
methods
:
{
goEdit
(
user
)
{
this
.
$refs
.
create
.
doCreate
(
true
,
user
);
},
getList
(
isRefresh
)
{
if
(
isRefresh
)
{
this
.
$refs
.
pages
.
currentPage
=
1
;
}
if
(
isRefresh
===
'
clear
'
)
{
this
.
$refs
.
userSh
.
searchSelectChange
();
this
.
$refs
.
pages
.
currentPage
=
1
;
}
this
.
curList
=
[];
backend
.
getSCMIntegrateSettings
(
JSON
.
stringify
({
page_size
:
this
.
$refs
.
pages
.
pageSize
,
page_index
:
this
.
$refs
.
pages
.
currentPage
,
filter_key
:
this
.
searchType
,
filter_val
:
this
.
searchVal
,
}),
data
=>
{
this
.
$refs
.
pages
.
total
=
data
.
total
;
this
.
curList
=
data
.
item
;
this
.
curList
=
data
.
item
.
map
(
i
=>
{
i
.
create_at
=
Utils
.
format
(
new
Date
(
i
.
create_at
),
'
yyyy-MM-dd hh:mm
'
);
return
i
;
});
}
);
},
changeFilterTxt
(
val
,
type
)
{
this
.
searchVal
=
val
;
this
.
searchType
=
type
;
this
.
getList
(
false
);
},
},
};
</
script
>
web/src/views/setting/components/ScmIntegrateCreate.vue
0 → 100644
浏览文件 @
171a94a2
<
style
>
.createDialog
.el-dialog__body
.el-form-item
.el-form-item__content
{
display
:
flex
;
flex-direction
:
column
;
}
.form-item
{
margin-left
:
22px
;
margin-right
:
22px
;
}
.el-drawer__body
{
overflow-y
:
scroll
;
margin-bottom
:
20px
;
}
</
style
>
<
template
>
<el-drawer
:title=
"title"
:visible.sync=
"dialogFormVisible"
:direction=
"direction"
:before-close=
"handleClose"
>
<div
style=
"overflow-y: scroll"
>
<el-form
:model=
"form"
ref=
"ruleForm"
:rules=
"rules"
>
<el-form-item
label=
"名称"
prop=
"name"
class=
"form-item"
>
<el-input
v-model.trim=
"form.name"
auto-complete=
"off"
maxlength=
"60"
placeholder=
"请输入名称"
></el-input>
</el-form-item>
<el-form-item
label=
"配置类型"
prop=
"type"
class=
"form-item"
>
<el-select
v-model=
"form.type"
placeholder=
"请选择"
filterable
:disabled=
"isEdit"
@
change=
"setDefaultSCMURL()"
>
<el-option
v-for=
"(item, index) in settingTypeList"
:key=
"index"
:label=
"item.name"
:value=
"item.name"
>
</el-option>
</el-select>
</el-form-item>
<div
v-if=
"form.type ==='gitlab'"
>
<el-form-item
label=
"地址"
prop=
"config.url"
class=
"form-item"
>
<el-input
v-model.trim=
"form.config.url"
auto-complete=
"off"
placeholder=
"请输入gitlab地址,eg: https://gitlab.com"
></el-input>
</el-form-item>
<el-form-item
label=
"用户名"
prop=
"config.user"
class=
"form-item"
>
<el-input
v-model.trim=
"form.config.user"
auto-complete=
"off"
placeholder=
"请输入gitlab用户名"
></el-input>
</el-form-item>
<el-form-item
label=
"Token"
prop=
"config.token"
class=
"form-item"
>
<el-input
v-model.trim=
"form.config.token"
placeholder=
"请输入gitlab用户名对应token"
></el-input>
</el-form-item>
</div>
<div
v-else-if=
"form.type ==='github' || form.type ==='gitee' || form.type ==='gitea'"
>
<el-form-item
label=
"地址"
prop=
"config.url"
class=
"form-item"
>
<el-input
v-model.trim=
"form.config.url"
auto-complete=
"off"
:disabled=
"disabledEditURL"
placeholder=
"请输入代码源地址"
></el-input>
</el-form-item>
<el-form-item
label=
"Token"
prop=
"config.token"
class=
"form-item"
>
<el-input
v-model.trim=
"form.config.token"
auto-complete=
"off"
maxlength=
"120"
placeholder=
"请输入代码源Token"
></el-input>
</el-form-item>
</div
>
<el-form-item
label=
"描述"
prop=
"description"
class=
"form-item"
>
<el-input
v-model=
"form.description"
auto-complete=
"off"
maxlength=
"80"
placeholder=
"请输入描述"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"success"
@
click=
"doTestConnection"
:loading=
"loading"
>
测试连接
</el-button>
<el-button
type=
"primary"
@
click=
"doSubmit"
:loading=
"loading"
>
{{
$t
(
'
bm.other.confirm
'
)
}}
</el-button>
</div>
</div>
</el-drawer>
</
template
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
;
import
{
Message
}
from
'
element-ui
'
;
import
backend
from
'
@/api/backend
'
;
import
createTemplate
from
'
@/common/createTemplate
'
;
import
validate
from
'
@/common/validate
'
;
const
formData
=
{
name
:
''
,
type
:
''
,
config
:
{},
description
:
''
,
};
export
default
{
mixins
:
[
createTemplate
,
validate
],
data
()
{
return
{
name
:
''
,
disabledEditURL
:
false
,
groupRoleList
:
[],
settingTypeList
:
[
{
"
name
"
:
"
gitlab
"
},
{
"
name
"
:
"
github
"
},
{
"
name
"
:
"
gitee
"
},
{
"
name
"
:
"
gitea
"
},
],
direction
:
'
rtl
'
,
// 是否属于编辑状态
isEdit
:
false
,
dialogFormVisible
:
false
,
form
:
JSON
.
parse
(
JSON
.
stringify
(
formData
)),
title
:
'
新增
'
,
rules
:
{
name
:
[
{
required
:
true
,
message
:
'
请输入名称
'
,
trigger
:
'
blur
'
},
],
type
:
[
{
required
:
true
,
message
:
'
请选择集成服务的类型
'
,
trigger
:
'
blur
'
},
],
'
config.url
'
:
[
{
required
:
true
,
message
:
'
请输入url信息
'
,
trigger
:
'
blur
'
},
],
'
config.user
'
:
[
{
required
:
true
,
message
:
'
请输入用户名
'
,
trigger
:
'
blur
'
},
],
'
config.conf
'
:
[
{
required
:
true
,
message
:
'
请输入kubernetes conf
'
,
trigger
:
'
blur
'
},
],
'
config.token
'
:
[
{
required
:
true
,
message
:
'
请输入token信息
'
,
trigger
:
'
blur
'
},
],
description
:
[
{
required
:
false
,
message
:
'
描述信息不能为空
'
,
trigger
:
'
blur
'
},
],
},
rowId
:
''
,
};
},
computed
:
{
...
mapGetters
({
loading
:
'
getPopLoading
'
,
}),
},
created
()
{
},
methods
:
{
setDefaultSCMURL
()
{
switch
(
this
.
form
.
type
)
{
case
'
gitee
'
:
this
.
form
.
config
.
url
=
'
https://gitee.com
'
this
.
disabledEditURL
=
true
break
;
case
'
github
'
:
this
.
form
.
config
.
url
=
'
https://gitee.com
'
this
.
disabledEditURL
=
true
break
;
default
:
this
.
disabledEditURL
=
false
}
},
handleClose
(
done
)
{
this
.
$confirm
(
'
确认关闭?
'
)
.
then
(
_
=>
{
done
();
})
.
catch
(
_
=>
{});
},
doCreate
(
flag
,
item
)
{
this
.
isEdit
=
flag
;
if
(
flag
)
{
this
.
title
=
'
编辑配置
'
;
this
.
form
=
{
name
:
item
.
name
||
''
,
type
:
item
.
type
||
''
,
config
:
item
.
config
||
{},
description
:
item
.
description
||
''
,
};
switch
(
item
.
type
)
{
case
'
gitee
'
:
this
.
disabledEditURL
=
true
break
;
case
'
github
'
:
this
.
disabledEditURL
=
true
break
;
default
:
}
this
.
rowId
=
item
.
id
;
}
else
{
this
.
title
=
'
新增配置
'
;
this
.
form
=
{
name
:
''
,
type
:
''
,
config
:
{},
description
:
''
,
};
this
.
rowId
=
''
;
}
this
.
dialogFormVisible
=
true
this
.
isEdit
=
flag
;
},
doTestConnection
()
{
Message
.
info
(
'
comming soon
'
);
},
doSubmit
()
{
this
.
$refs
.
ruleForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
const
successCallBack
=
()
=>
{
this
.
$emit
(
'
getlist
'
);
Message
.
success
(
this
.
$t
(
'
bm.add.optionSuc
'
));
this
.
dialogFormVisible
=
false
;
};
const
cl
=
{
name
:
this
.
form
.
name
,
config
:
this
.
form
.
config
,
type
:
this
.
form
.
type
,
description
:
this
.
form
.
description
,
};
if
(
this
.
isEdit
)
{
backend
.
editIntegrateSetting
(
this
.
rowId
,
cl
,
()
=>
{
successCallBack
();
});
}
else
{
backend
.
AddIntegrateSetting
(
cl
,
()
=>
{
successCallBack
();
});
}
}
});
},
},
};
</
script
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录