Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
2c20c9d8
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2c20c9d8
编写于
6月 24, 2016
作者:
L
lepdou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cluster unique check
上级
22ac5b5c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
39 addition
and
15 deletion
+39
-15
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
...om/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
+18
-5
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
...ctrip/framework/apollo/portal/service/ClusterService.java
+4
-0
apollo-portal/src/main/resources/static/scripts/controller/ClusterController.js
.../resources/static/scripts/controller/ClusterController.js
+17
-10
未找到文件。
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
浏览文件 @
2c20c9d8
...
...
@@ -127,7 +127,19 @@ public class AdminServiceAPI {
return
Arrays
.
asList
(
clusterDTOs
);
}
public
ClusterDTO
createOrUpdate
(
Env
env
,
ClusterDTO
cluster
){
public
ClusterDTO
loadCluster
(
String
appId
,
Env
env
,
String
clusterName
)
{
return
restTemplate
.
getForObject
(
"{host}/apps/{appId}/clusters/{clusterName}"
,
ClusterDTO
.
class
,
getAdminServiceHost
(
env
),
appId
,
clusterName
);
}
public
boolean
isClusterUnique
(
String
appId
,
Env
env
,
String
clusterName
)
{
return
restTemplate
.
getForObject
(
"{host}/apps/{appId}/cluster/{clusterName}/unique"
,
Boolean
.
class
,
getAdminServiceHost
(
env
),
appId
,
clusterName
);
}
public
ClusterDTO
createOrUpdate
(
Env
env
,
ClusterDTO
cluster
)
{
return
restTemplate
.
postForObject
(
"{host}/apps/{appId}/clusters"
,
cluster
,
ClusterDTO
.
class
,
getAdminServiceHost
(
env
),
cluster
.
getAppId
());
}
...
...
@@ -172,7 +184,8 @@ public class AdminServiceAPI {
CommitDTO
[]
commitDTOs
=
restTemplate
.
getForObject
(
"{host}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/commit?page={page}&size={size}"
,
restTemplate
.
getForObject
(
"{host}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/commit?page={page}&size={size}"
,
CommitDTO
[].
class
,
getAdminServiceHost
(
env
),
appId
,
clusterName
,
namespaceName
,
page
,
size
);
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
浏览文件 @
2c20c9d8
...
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.portal.service;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -20,6 +21,9 @@ public class ClusterService {
}
public
ClusterDTO
createCluster
(
Env
env
,
ClusterDTO
cluster
){
if
(!
clusterAPI
.
isClusterUnique
(
cluster
.
getAppId
(),
env
,
cluster
.
getName
())){
throw
new
BadRequestException
(
String
.
format
(
"cluster %s already exist."
,
cluster
.
getName
()));
}
return
clusterAPI
.
createOrUpdate
(
env
,
cluster
);
}
...
...
apollo-portal/src/main/resources/static/scripts/controller/ClusterController.js
浏览文件 @
2c20c9d8
...
...
@@ -24,7 +24,10 @@ cluster_module.controller('ClusterController',
};
$scope
.
create
=
function
()
{
var
noEnvChecked
=
true
;
$scope
.
envs
.
forEach
(
function
(
env
)
{
if
(
env
.
checked
)
{
noEnvChecked
=
false
;
ClusterService
.
create_cluster
(
$scope
.
appId
,
env
.
name
,
{
name
:
$scope
.
clusterName
,
...
...
@@ -34,9 +37,13 @@ cluster_module.controller('ClusterController',
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
集群创建失败
"
);
})
}
})
if
(
noEnvChecked
){
toastr
.
warning
(
"
请选择环境
"
);
}
};
}]);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录