Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
1ea8697c
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,发现更多精彩内容 >>
提交
1ea8697c
编写于
5月 09, 2016
作者:
L
lepdou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
create app namespace
上级
5b7bcc20
变更
19
展开全部
显示空白变更内容
内联
并排
Showing
19 changed file
with
127 addition
and
80 deletion
+127
-80
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
...ain/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
+3
-3
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/AppController.java
...ava/com/ctrip/apollo/portal/controller/AppController.java
+2
-2
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
.../com/ctrip/apollo/portal/controller/ConfigController.java
+0
-1
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/NamespaceController.java
...m/ctrip/apollo/portal/controller/NamespaceController.java
+4
-4
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/AppService.java
...main/java/com/ctrip/apollo/portal/service/AppService.java
+4
-5
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/NamespaceService.java
...ava/com/ctrip/apollo/portal/service/NamespaceService.java
+4
-4
apollo-portal/src/main/resources/static/config.html
apollo-portal/src/main/resources/static/config.html
+2
-2
apollo-portal/src/main/resources/static/config/sync.html
apollo-portal/src/main/resources/static/config/sync.html
+1
-1
apollo-portal/src/main/resources/static/namespace.html
apollo-portal/src/main/resources/static/namespace.html
+29
-22
apollo-portal/src/main/resources/static/scripts/AppUtils.js
apollo-portal/src/main/resources/static/scripts/AppUtils.js
+0
-7
apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
...esources/static/scripts/controller/NamespaceController.js
+50
-20
apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js
...rces/static/scripts/controller/app/AppConfigController.js
+2
-2
apollo-portal/src/main/resources/static/scripts/services/NamespaceService.js
...ain/resources/static/scripts/services/NamespaceService.js
+19
-3
apollo-portal/src/main/resources/static/styles/common-style.css
...-portal/src/main/resources/static/styles/common-style.css
+0
-1
apollo-portal/src/main/resources/static/vendor/select2/select2.min.css
.../src/main/resources/static/vendor/select2/select2.min.css
+1
-0
apollo-portal/src/main/resources/static/vendor/select2/select2.min.js
...l/src/main/resources/static/vendor/select2/select2.min.js
+2
-0
apollo-portal/src/main/resources/static/views/common/footer.html
...portal/src/main/resources/static/views/common/footer.html
+1
-0
apollo-portal/src/test/java/com/ctrip/apollo/portal/AppServiceTest.java
...src/test/java/com/ctrip/apollo/portal/AppServiceTest.java
+2
-2
apollo-portal/src/test/java/com/ctrip/apollo/portal/ServiceExceptionTest.java
...st/java/com/ctrip/apollo/portal/ServiceExceptionTest.java
+1
-1
未找到文件。
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
浏览文件 @
1ea8697c
...
...
@@ -38,7 +38,7 @@ public class AdminServiceAPI {
return
restTemplate
.
getForObject
(
getAdminServiceHost
(
env
)
+
APP_API
+
"/"
+
appId
,
AppDTO
.
class
);
}
public
AppDTO
save
(
Env
env
,
AppDTO
app
)
{
public
AppDTO
createApp
(
Env
env
,
AppDTO
app
)
{
return
restTemplate
.
postForEntity
(
getAdminServiceHost
(
env
)
+
APP_API
,
app
,
AppDTO
.
class
)
.
getBody
();
}
...
...
@@ -70,14 +70,14 @@ public class AdminServiceAPI {
return
Arrays
.
asList
(
appNamespaceDTOs
);
}
public
NamespaceDTO
sav
eNamespace
(
Env
env
,
NamespaceDTO
namespace
)
{
public
NamespaceDTO
creat
eNamespace
(
Env
env
,
NamespaceDTO
namespace
)
{
return
restTemplate
.
postForEntity
(
getAdminServiceHost
(
env
)
+
String
.
format
(
"/apps/%s/clusters/%s/namespaces"
,
namespace
.
getAppId
(),
namespace
.
getClusterName
()),
namespace
,
NamespaceDTO
.
class
)
.
getBody
();
}
public
AppNamespaceDTO
sav
eAppNamespace
(
Env
env
,
AppNamespaceDTO
appNamespace
)
{
public
AppNamespaceDTO
creat
eAppNamespace
(
Env
env
,
AppNamespaceDTO
appNamespace
)
{
return
restTemplate
.
postForEntity
(
getAdminServiceHost
(
env
)
+
String
.
format
(
"/apps/%s/appnamespaces"
,
appNamespace
.
getAppId
()),
appNamespace
,
AppNamespaceDTO
.
class
)
.
getBody
();
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/AppController.java
浏览文件 @
1ea8697c
...
...
@@ -49,9 +49,9 @@ public class AppController {
throw
new
BadRequestException
(
"request payload contains empty"
);
}
if
(
"ALL"
.
equals
(
env
)){
appService
.
save
(
app
);
appService
.
createAppInAllEnvs
(
app
);
}
else
{
appService
.
save
(
Env
.
valueOf
(
env
),
app
);
appService
.
createApp
(
Env
.
valueOf
(
env
),
app
);
}
return
ResponseEntity
.
ok
().
build
();
}
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
浏览文件 @
1ea8697c
...
...
@@ -9,7 +9,6 @@ import com.ctrip.apollo.core.utils.StringUtils;
import
com.ctrip.apollo.portal.entity.ItemDiffs
;
import
com.ctrip.apollo.portal.entity.form.NamespaceSyncModel
;
import
com.ctrip.apollo.portal.entity.form.NamespaceTextModel
;
import
com.ctrip.apollo.portal.entity.NamespaceVO
;
import
com.ctrip.apollo.portal.entity.form.NamespaceReleaseModel
;
import
com.ctrip.apollo.portal.service.ConfigService
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/NamespaceController.java
浏览文件 @
1ea8697c
...
...
@@ -29,20 +29,20 @@ public class NamespaceController {
}
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces"
,
method
=
RequestMethod
.
POST
)
public
NamespaceDTO
sav
eNamespace
(
@PathVariable
String
env
,
@RequestBody
NamespaceDTO
namespace
){
public
NamespaceDTO
creat
eNamespace
(
@PathVariable
String
env
,
@RequestBody
NamespaceDTO
namespace
){
if
(
StringUtils
.
isContainEmpty
(
env
,
namespace
.
getAppId
(),
namespace
.
getClusterName
(),
namespace
.
getNamespaceName
())){
throw
new
BadRequestException
(
"request payload contains empty"
);
}
return
namespaceService
.
sav
eNamespace
(
Env
.
valueOf
(
env
),
namespace
);
return
namespaceService
.
creat
eNamespace
(
Env
.
valueOf
(
env
),
namespace
);
}
@RequestMapping
(
value
=
"/apps/{appId}/appnamespaces"
,
method
=
RequestMethod
.
POST
)
public
void
sav
eAppNamespace
(
@PathVariable
String
appId
,
@RequestBody
AppNamespaceDTO
appNamespace
){
public
void
creat
eAppNamespace
(
@PathVariable
String
appId
,
@RequestBody
AppNamespaceDTO
appNamespace
){
if
(
StringUtils
.
isContainEmpty
(
appId
,
appNamespace
.
getAppId
(),
appNamespace
.
getName
())){
throw
new
BadRequestException
(
"request payload contains empty"
);
}
namespaceService
.
sav
eAppNamespace
(
appNamespace
);
namespaceService
.
creat
eAppNamespace
(
appNamespace
);
}
@RequestMapping
(
"/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces"
)
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/AppService.java
浏览文件 @
1ea8697c
package
com.ctrip.apollo.portal.service
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -84,11 +83,11 @@ public class AppService {
return
tree
;
}
public
void
save
(
AppDTO
app
)
{
public
void
createAppInAllEnvs
(
AppDTO
app
)
{
List
<
Env
>
envs
=
portalSettings
.
getEnvs
();
for
(
Env
env
:
envs
)
{
try
{
appAPI
.
save
(
env
,
app
);
appAPI
.
createApp
(
env
,
app
);
}
catch
(
HttpStatusCodeException
e
)
{
logger
.
error
(
ExceptionUtils
.
toString
(
e
));
throw
e
;
...
...
@@ -96,9 +95,9 @@ public class AppService {
}
}
public
void
save
(
Env
env
,
AppDTO
app
)
{
public
void
createApp
(
Env
env
,
AppDTO
app
)
{
try
{
appAPI
.
save
(
env
,
app
);
appAPI
.
createApp
(
env
,
app
);
}
catch
(
HttpStatusCodeException
e
)
{
logger
.
error
(
ExceptionUtils
.
toString
(
e
));
throw
e
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/NamespaceService.java
浏览文件 @
1ea8697c
...
...
@@ -51,14 +51,14 @@ public class NamespaceService {
return
namespaceAPI
.
findPublicAppNamespaces
(
portalSettings
.
getFirstEnv
());
}
public
NamespaceDTO
sav
eNamespace
(
Env
env
,
NamespaceDTO
namespace
){
return
namespaceAPI
.
sav
eNamespace
(
env
,
namespace
);
public
NamespaceDTO
creat
eNamespace
(
Env
env
,
NamespaceDTO
namespace
){
return
namespaceAPI
.
creat
eNamespace
(
env
,
namespace
);
}
public
void
sav
eAppNamespace
(
AppNamespaceDTO
appNamespace
)
{
public
void
creat
eAppNamespace
(
AppNamespaceDTO
appNamespace
)
{
for
(
Env
env
:
portalSettings
.
getEnvs
())
{
try
{
namespaceAPI
.
sav
eAppNamespace
(
env
,
appNamespace
);
namespaceAPI
.
creat
eAppNamespace
(
env
,
appNamespace
);
}
catch
(
HttpStatusCodeException
e
)
{
logger
.
error
(
ExceptionUtils
.
toString
(
e
));
throw
e
;
...
...
apollo-portal/src/main/resources/static/config.html
浏览文件 @
1ea8697c
...
...
@@ -83,7 +83,7 @@
<!--</div>-->
<!--</a>-->
<a
class=
"list-group-item"
target=
"_blank"
href=
"namespace.html?#/appid={{pageContext.appId}}
"
>
<a
class=
"list-group-item"
href=
"namespace.html?#/appid={{pageContext.appId}}&type=link
"
>
<div
class=
"row"
>
<div
class=
"col-md-2"
><img
src=
"img/plus.png"
class=
"i-20"
></div>
<div
class=
"col-md-7 hidden-xs"
>
...
...
@@ -294,7 +294,7 @@
{{watch.value}}
<div
ng-show=
"watch.oldValue"
>
<hr>
老的值:
{{watch.oldValue}}
<b>
已发布的值:
</b>
{{watch.oldValue}}
</div>
</div>
<div
class=
"modal-footer"
>
...
...
apollo-portal/src/main/resources/static/config/sync.html
浏览文件 @
1ea8697c
...
...
@@ -33,7 +33,7 @@
</button>
<button
type=
"button"
class=
"btn btn-success"
ng-show=
"syncItemStep == 2 && hasDiff"
ng-click=
"syncItems()"
>
同步
</button>
<button
type=
"button"
class=
"btn btn-
primary
"
data-dismiss=
"modal"
ng-show=
"syncItemStep == 3"
<button
type=
"button"
class=
"btn btn-
success
"
data-dismiss=
"modal"
ng-show=
"syncItemStep == 3"
ng-click=
"backToAppHomePage()"
>
返回
</button>
</div>
...
...
apollo-portal/src/main/resources/static/namespace.html
浏览文件 @
1ea8697c
...
...
@@ -5,8 +5,8 @@
<!-- styles -->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"vendor/bootstrap/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"vendor/angular/angular-toastr-1.4.1.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"vendor/select2/select2.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
'all'
href=
"vendor/angular/loading-bar.min.css"
>
<link
href=
"http://cdn.bootcss.com/select2/4.0.2-rc.1/css/select2.css"
rel=
"stylesheet"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styles/common-style.css"
>
<title>
新建Namespace
</title>
</head>
...
...
@@ -15,26 +15,32 @@
<div
ng-include=
"'views/common/nav.html'"
></div>
<div
class=
"container-fluid apollo-container"
>
<div
class=
"container-fluid apollo-container"
ng-controller=
"LinkNamespaceController"
>
<div
class=
"row"
>
<div
class=
"col-md-8 col-md-offset-2"
>
<div
class=
"panel"
>
<header
class=
"panel-heading"
>
新建Namespace
<div
class=
"row"
>
<div
class=
"col-md-6"
>
新建Namespace
</div>
<div
class=
"col-md-6 text-right"
>
<button
type=
"button"
class=
"btn btn-success"
ng-show=
"step == 2"
ng-click=
"back()"
>
返回
</button>
</div>
</div>
</header>
<div
class=
"panel-body"
>
<form
class=
"form-horizontal"
ng-controller=
"LinkNamespaceController"
ng-submit=
"sav
eNamespace()"
>
<form
class=
"form-horizontal"
ng-show=
"step == 1"
ng-submit=
"creat
eNamespace()"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
应用ID
</label>
<div
class=
"col-sm-6"
>
{{appId}}
</div>
</div>
<div
class=
"form-horizontal"
>
<div
class=
"form-horizontal"
ng-show=
"type == 'link'"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
选择集群
</label>
<label
class=
"col-sm-3 control-label"
>
<font
style=
"color: red"
>
*
</font>
选择集群
</label>
<div
class=
"col-sm-6"
>
<table
class=
"table table-hover"
>
<thead>
...
...
@@ -57,24 +63,19 @@
</div>
</div>
</div>
<div
class=
"form-group"
ng-show=
"
isRootUser
"
>
<label
class=
"col-sm-3 control-label"
><font
style=
"color: red"
>
*
</font>
namespace类型
</label>
<div
class=
"form-group"
ng-show=
"
type == 'create'
"
>
<label
class=
"col-sm-3 control-label"
><font
style=
"color: red"
>
*
</font>
名称
</label>
<div
class=
"col-sm-4"
>
<label
class=
"radio-inline"
>
<input
type=
"radio"
name=
"x"
ng-checked=
"namespaceType == 1"
ng-click=
"selectNamespaceType(1)"
>
关联
</label>
<label
class=
"radio-inline"
>
<input
type=
"radio"
name=
"x"
ng-checked=
"namespaceType == 2"
ng-click=
"selectNamespaceType(2)"
>
新建
</label>
<input
type=
"text"
class=
"form-control"
ng-model=
"appNamespace.name"
ng-required=
"type == 'create'"
>
</div>
</div>
<div
class=
"form-group"
ng-show=
"
namespaceType == 2
"
>
<label
class=
"col-sm-3 control-label"
>
<font
style=
"color: red"
>
*
</font>
namespace
</label>
<div
class=
"col-sm-
4
"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"输入namespace名称"
>
<div
class=
"form-group"
ng-show=
"
type == 'create'
"
>
<label
class=
"col-sm-3 control-label"
>
备注
</label>
<div
class=
"col-sm-
7
"
>
<textarea
class=
"form-control"
rows=
"3"
ng-model=
"appNamespace.comment"
></textarea
>
</div>
</div>
<div
class=
"form-group"
ng-show=
"
namespaceType == 1
"
>
<div
class=
"form-group"
ng-show=
"
type == 'link'
"
>
<label
class=
"col-sm-3 control-label"
><font
style=
"color: red"
>
*
</font>
namespace
</label>
<div
class=
"col-sm-4"
>
<select
id=
"namespaces"
>
...
...
@@ -84,11 +85,16 @@
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-
2
col-sm-10"
>
<div
class=
"col-sm-offset-
3
col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-default"
>
提交
</button>
</div>
</div>
</form>
<div
class=
"row text-center"
ng-show=
"step == 2"
>
<img
src=
"img/sync-succ.png"
style=
"height: 100px; width: 100px"
>
<h3>
创建成功!
</h3>
</div>
</div>
</div>
</div>
...
...
@@ -107,7 +113,8 @@
<!-- jquery.js -->
<script
src=
"vendor/jquery.js"
type=
"text/javascript"
></script>
<script
src=
"http://cdn.bootcss.com/select2/4.0.2-rc.1/js/select2.min.js"
></script>
<script
src=
"vendor/select2/select2.min.js"
type=
"text/javascript"
></script>
<!-- bootstrap.js -->
<script
src=
"vendor/bootstrap/js/bootstrap.min.js"
type=
"text/javascript"
></script>
...
...
@@ -117,7 +124,7 @@
<script
type=
"application/javascript"
src=
"scripts/services/NamespaceService.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/AppUtils.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/controller/
Link
NamespaceController.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/controller/NamespaceController.js"
></script>
</body>
...
...
apollo-portal/src/main/resources/static/scripts/AppUtils.js
浏览文件 @
1ea8697c
...
...
@@ -22,13 +22,6 @@ appUtil.service('AppUtil', [function () {
result
[
kv
[
0
]]
=
kv
[
1
];
});
return
result
;
},
cutOffString
:
function
(
str
,
maxLength
)
{
if
(
!
str
||
maxLength
<=
0
)
{
return
''
;
}
return
str
.
length
>
maxLength
?
str
.
substr
(
0
,
maxLength
)
:
str
;
}
}
}]);
apollo-portal/src/main/resources/static/scripts/controller/
Link
NamespaceController.js
→
apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
浏览文件 @
1ea8697c
...
...
@@ -4,7 +4,9 @@ application_module.controller("LinkNamespaceController",
var
params
=
AppUtil
.
parseParams
(
$location
.
$$url
);
$scope
.
appId
=
params
.
appid
;
$scope
.
isRootUser
=
params
.
root
?
true
:
false
;
$scope
.
type
=
params
.
type
;
$scope
.
step
=
1
;
////// load env //////
AppService
.
load_nav_tree
(
$scope
.
appId
).
then
(
function
(
result
)
{
...
...
@@ -37,25 +39,49 @@ application_module.controller("LinkNamespaceController",
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
load public namespace error
"
);
});
$scope
.
saveNamespace
=
function
()
{
$scope
.
appNamespace
=
{
appId
:
$scope
.
appId
,
name
:
''
,
comment
:
''
};
$scope
.
createNamespace
=
function
()
{
if
(
$scope
.
type
==
'
link
'
){
var
selectedClusters
=
collectSelectedClusters
();
if
(
selectedClusters
.
length
==
0
){
toastr
.
warning
(
"
请选择集群
"
);
return
;
}
var
namespaceName
=
$
(
'
#namespaces
'
).
select2
(
'
data
'
)[
0
].
id
;
var
selectedClustersSize
=
selectedClusters
.
length
;
if
(
$scope
.
namespaceType
==
1
){
$scope
.
namespaceName
=
$
(
'
#namespaces
'
).
select2
(
'
data
'
)[
0
].
id
;
}
var
hasCreatedClusterCnt
=
0
;
selectedClusters
.
forEach
(
function
(
cluster
)
{
NamespaceService
.
sav
e
(
$scope
.
appId
,
cluster
.
env
,
cluster
.
clusterName
,
namespaceName
).
then
(
function
(
result
)
{
NamespaceService
.
createNamespac
e
(
$scope
.
appId
,
cluster
.
env
,
cluster
.
clusterName
,
$scope
.
namespaceName
).
then
(
function
(
result
)
{
toastr
.
success
(
cluster
.
env
+
"
_
"
+
result
.
clusterName
+
"
_
"
+
result
.
namespaceName
+
"
创建成功
"
);
hasCreatedClusterCnt
++
;
if
(
hasCreatedClusterCnt
==
selectedClustersSize
){
$scope
.
step
=
2
;
}
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
cluster
.
env
+
"
_
"
+
cluster
.
clusterName
+
"
_
"
+
namespaceName
+
"
创建失败
"
);
+
$scope
.
namespaceName
+
"
创建失败
"
);
});
})
});
}
else
{
NamespaceService
.
createAppNamespace
(
$scope
.
appId
,
$scope
.
appNamespace
).
then
(
function
(
result
)
{
$scope
.
step
=
2
;
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
创建失败
"
);
});
}
};
var
envAllSelected
=
false
;
...
...
@@ -85,6 +111,10 @@ application_module.controller("LinkNamespaceController",
$scope
.
switchSelect
=
function
(
o
)
{
o
.
checked
=
!
o
.
checked
;
}
};
$scope
.
back
=
function
()
{
$window
.
location
.
href
=
'
/config.html?#appid=
'
+
$scope
.
appId
;
};
}]);
apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js
浏览文件 @
1ea8697c
...
...
@@ -121,6 +121,7 @@ application_module.controller("AppConfigController",
namespace
.
viewType
=
viewType
;
};
var
MAX_ROW_SIZE
=
30
;
//把表格内容解析成文本
function
parseModel2Text
(
namespace
)
{
...
...
@@ -139,8 +140,7 @@ application_module.controller("AppConfigController",
itemCnt
++
;
});
itemCnt
=
itemCnt
>
30
?
30
:
itemCnt
;
namespace
.
itemCnt
=
itemCnt
+
3
;
namespace
.
itemCnt
=
itemCnt
>
MAX_ROW_SIZE
?
MAX_ROW_SIZE
:
itemCnt
+
3
;
return
result
;
}
...
...
apollo-portal/src/main/resources/static/scripts/services/NamespaceService.js
浏览文件 @
1ea8697c
...
...
@@ -5,10 +5,15 @@ appService.service("NamespaceService", ['$resource', '$q', function ($resource,
isArray
:
true
,
url
:
'
/appnamespaces/public
'
},
sav
e
:
{
createNamespac
e
:
{
method
:
'
POST
'
,
url
:
'
/apps/:appId/envs/:env/clusters/:clusterName/namespaces
'
,
isArray
:
false
},
createAppNamespace
:
{
method
:
'
POST
'
,
url
:
'
/apps/:appId/appnamespaces
'
,
isArray
:
false
}
});
...
...
@@ -22,9 +27,9 @@ appService.service("NamespaceService", ['$resource', '$q', function ($resource,
});
return
d
.
promise
;
},
sav
e
:
function
(
appId
,
env
,
clusterName
,
namespaceName
)
{
createNamespac
e
:
function
(
appId
,
env
,
clusterName
,
namespaceName
)
{
var
d
=
$q
.
defer
();
namespace_source
.
sav
e
({
namespace_source
.
createNamespac
e
({
appId
:
appId
,
env
:
env
,
clusterName
:
clusterName
...
...
@@ -38,6 +43,17 @@ appService.service("NamespaceService", ['$resource', '$q', function ($resource,
d
.
reject
(
result
);
});
return
d
.
promise
;
},
createAppNamespace
:
function
(
appId
,
appnamespace
)
{
var
d
=
$q
.
defer
();
namespace_source
.
createAppNamespace
({
appId
:
appId
},
appnamespace
,
function
(
result
)
{
d
.
resolve
(
result
);
},
function
(
result
)
{
d
.
reject
(
result
);
});
return
d
.
promise
;
}
}
...
...
apollo-portal/src/main/resources/static/styles/common-style.css
浏览文件 @
1ea8697c
...
...
@@ -7,7 +7,6 @@ body {
padding
:
0px
!important
;
margin
:
0px
!important
;
font-size
:
13px
;
/*min-height: 650px;*/
background
:
#f1f2f7
;
font-family
:
'Open Sans'
,
sans-serif
;
}
...
...
apollo-portal/src/main/resources/static/vendor/select2/select2.min.css
0 → 100644
浏览文件 @
1ea8697c
.select2-container
{
box-sizing
:
border-box
;
display
:
inline-block
;
margin
:
0
;
position
:
relative
;
vertical-align
:
middle
}
.select2-container
.select2-selection--single
{
box-sizing
:
border-box
;
cursor
:
pointer
;
display
:
block
;
height
:
28px
;
user-select
:
none
;
-webkit-user-select
:
none
}
.select2-container
.select2-selection--single
.select2-selection__rendered
{
display
:
block
;
padding-left
:
8px
;
padding-right
:
20px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
}
.select2-container
.select2-selection--single
.select2-selection__clear
{
position
:
relative
}
.select2-container
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__rendered
{
padding-right
:
8px
;
padding-left
:
20px
}
.select2-container
.select2-selection--multiple
{
box-sizing
:
border-box
;
cursor
:
pointer
;
display
:
block
;
min-height
:
32px
;
user-select
:
none
;
-webkit-user-select
:
none
}
.select2-container
.select2-selection--multiple
.select2-selection__rendered
{
display
:
inline-block
;
overflow
:
hidden
;
padding-left
:
8px
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
}
.select2-container
.select2-search--inline
{
float
:
left
}
.select2-container
.select2-search--inline
.select2-search__field
{
box-sizing
:
border-box
;
border
:
none
;
font-size
:
100%
;
margin-top
:
5px
;
padding
:
0
}
.select2-container
.select2-search--inline
.select2-search__field
::-webkit-search-cancel-button
{
-webkit-appearance
:
none
}
.select2-dropdown
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
box-sizing
:
border-box
;
display
:
block
;
position
:
absolute
;
left
:
-100000px
;
width
:
100%
;
z-index
:
1051
}
.select2-results
{
display
:
block
}
.select2-results__options
{
list-style
:
none
;
margin
:
0
;
padding
:
0
}
.select2-results__option
{
padding
:
6px
;
user-select
:
none
;
-webkit-user-select
:
none
}
.select2-results__option
[
aria-selected
]
{
cursor
:
pointer
}
.select2-container--open
.select2-dropdown
{
left
:
0
}
.select2-container--open
.select2-dropdown--above
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
}
.select2-container--open
.select2-dropdown--below
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
}
.select2-search--dropdown
{
display
:
block
;
padding
:
4px
}
.select2-search--dropdown
.select2-search__field
{
padding
:
4px
;
width
:
100%
;
box-sizing
:
border-box
}
.select2-search--dropdown
.select2-search__field
::-webkit-search-cancel-button
{
-webkit-appearance
:
none
}
.select2-search--dropdown.select2-search--hide
{
display
:
none
}
.select2-close-mask
{
border
:
0
;
margin
:
0
;
padding
:
0
;
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
min-height
:
100%
;
min-width
:
100%
;
height
:
auto
;
width
:
auto
;
opacity
:
0
;
z-index
:
99
;
background-color
:
#fff
;
filter
:
alpha
(
opacity
=
0
)}
.select2-hidden-accessible
{
border
:
0
!important
;
clip
:
rect
(
0
0
0
0
)
!important
;
height
:
1px
!important
;
margin
:
-1px
!important
;
overflow
:
hidden
!important
;
padding
:
0
!important
;
position
:
absolute
!important
;
width
:
1px
!important
}
.select2-container--default
.select2-selection--single
{
background-color
:
#fff
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
}
.select2-container--default
.select2-selection--single
.select2-selection__rendered
{
color
:
#444
;
line-height
:
28px
}
.select2-container--default
.select2-selection--single
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
}
.select2-container--default
.select2-selection--single
.select2-selection__placeholder
{
color
:
#999
}
.select2-container--default
.select2-selection--single
.select2-selection__arrow
{
height
:
26px
;
position
:
absolute
;
top
:
1px
;
right
:
1px
;
width
:
20px
}
.select2-container--default
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
#888
transparent
transparent
transparent
;
border-style
:
solid
;
border-width
:
5px
4px
0
4px
;
height
:
0
;
left
:
50%
;
margin-left
:
-4px
;
margin-top
:
-2px
;
position
:
absolute
;
top
:
50%
;
width
:
0
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__clear
{
float
:
left
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__arrow
{
left
:
1px
;
right
:
auto
}
.select2-container--default.select2-container--disabled
.select2-selection--single
{
background-color
:
#eee
;
cursor
:
default
}
.select2-container--default.select2-container--disabled
.select2-selection--single
.select2-selection__clear
{
display
:
none
}
.select2-container--default.select2-container--open
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
transparent
transparent
#888
transparent
;
border-width
:
0
4px
5px
4px
}
.select2-container--default
.select2-selection--multiple
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
text
}
.select2-container--default
.select2-selection--multiple
.select2-selection__rendered
{
box-sizing
:
border-box
;
list-style
:
none
;
margin
:
0
;
padding
:
0
5px
;
width
:
100%
}
.select2-container--default
.select2-selection--multiple
.select2-selection__placeholder
{
color
:
#999
;
margin-top
:
5px
;
float
:
left
}
.select2-container--default
.select2-selection--multiple
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;
margin-top
:
5px
;
margin-right
:
10px
}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice
{
background-color
:
#e4e4e4
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
default
;
float
:
left
;
margin-right
:
5px
;
margin-top
:
5px
;
padding
:
0
5px
}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove
{
color
:
#999
;
cursor
:
pointer
;
display
:
inline-block
;
font-weight
:
bold
;
margin-right
:
2px
}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove
:hover
{
color
:
#333
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
,
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__placeholder
,
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-search--inline
{
float
:
right
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
margin-left
:
5px
;
margin-right
:
auto
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice__remove
{
margin-left
:
2px
;
margin-right
:
auto
}
.select2-container--default.select2-container--focus
.select2-selection--multiple
{
border
:
solid
black
1px
;
outline
:
0
}
.select2-container--default.select2-container--disabled
.select2-selection--multiple
{
background-color
:
#eee
;
cursor
:
default
}
.select2-container--default.select2-container--disabled
.select2-selection__choice__remove
{
display
:
none
}
.select2-container--default.select2-container--open.select2-container--above
.select2-selection--single
,
.select2-container--default.select2-container--open.select2-container--above
.select2-selection--multiple
{
border-top-left-radius
:
0
;
border-top-right-radius
:
0
}
.select2-container--default.select2-container--open.select2-container--below
.select2-selection--single
,
.select2-container--default.select2-container--open.select2-container--below
.select2-selection--multiple
{
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
}
.select2-container--default
.select2-search--dropdown
.select2-search__field
{
border
:
1px
solid
#aaa
}
.select2-container--default
.select2-search--inline
.select2-search__field
{
background
:
transparent
;
border
:
none
;
outline
:
0
;
box-shadow
:
none
;
-webkit-appearance
:
textfield
}
.select2-container--default
.select2-results
>
.select2-results__options
{
max-height
:
200px
;
overflow-y
:
auto
}
.select2-container--default
.select2-results__option
[
role
=
group
]
{
padding
:
0
}
.select2-container--default
.select2-results__option
[
aria-disabled
=
true
]
{
color
:
#999
}
.select2-container--default
.select2-results__option
[
aria-selected
=
true
]
{
background-color
:
#ddd
}
.select2-container--default
.select2-results__option
.select2-results__option
{
padding-left
:
1em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__group
{
padding-left
:
0
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-1em
;
padding-left
:
2em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-2em
;
padding-left
:
3em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-3em
;
padding-left
:
4em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-4em
;
padding-left
:
5em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-5em
;
padding-left
:
6em
}
.select2-container--default
.select2-results__option--highlighted
[
aria-selected
]
{
background-color
:
#5897fb
;
color
:
white
}
.select2-container--default
.select2-results__group
{
cursor
:
default
;
display
:
block
;
padding
:
6px
}
.select2-container--classic
.select2-selection--single
{
background-color
:
#f7f7f7
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
outline
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#fff
50%
,
#eee
100%
);
background-image
:
-o-linear-gradient
(
top
,
#fff
50%
,
#eee
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#fff
50%
,
#eee
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFFFFFFF'
,
endColorstr
=
'#FFEEEEEE'
,
GradientType
=
0
)}
.select2-container--classic
.select2-selection--single
:focus
{
border
:
1px
solid
#5897fb
}
.select2-container--classic
.select2-selection--single
.select2-selection__rendered
{
color
:
#444
;
line-height
:
28px
}
.select2-container--classic
.select2-selection--single
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;
margin-right
:
10px
}
.select2-container--classic
.select2-selection--single
.select2-selection__placeholder
{
color
:
#999
}
.select2-container--classic
.select2-selection--single
.select2-selection__arrow
{
background-color
:
#ddd
;
border
:
none
;
border-left
:
1px
solid
#aaa
;
border-top-right-radius
:
4px
;
border-bottom-right-radius
:
4px
;
height
:
26px
;
position
:
absolute
;
top
:
1px
;
right
:
1px
;
width
:
20px
;
background-image
:
-webkit-linear-gradient
(
top
,
#eee
50%
,
#ccc
100%
);
background-image
:
-o-linear-gradient
(
top
,
#eee
50%
,
#ccc
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#eee
50%
,
#ccc
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFEEEEEE'
,
endColorstr
=
'#FFCCCCCC'
,
GradientType
=
0
)}
.select2-container--classic
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
#888
transparent
transparent
transparent
;
border-style
:
solid
;
border-width
:
5px
4px
0
4px
;
height
:
0
;
left
:
50%
;
margin-left
:
-4px
;
margin-top
:
-2px
;
position
:
absolute
;
top
:
50%
;
width
:
0
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__clear
{
float
:
left
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__arrow
{
border
:
none
;
border-right
:
1px
solid
#aaa
;
border-radius
:
0
;
border-top-left-radius
:
4px
;
border-bottom-left-radius
:
4px
;
left
:
1px
;
right
:
auto
}
.select2-container--classic.select2-container--open
.select2-selection--single
{
border
:
1px
solid
#5897fb
}
.select2-container--classic.select2-container--open
.select2-selection--single
.select2-selection__arrow
{
background
:
transparent
;
border
:
none
}
.select2-container--classic.select2-container--open
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
transparent
transparent
#888
transparent
;
border-width
:
0
4px
5px
4px
}
.select2-container--classic.select2-container--open.select2-container--above
.select2-selection--single
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#fff
0%
,
#eee
50%
);
background-image
:
-o-linear-gradient
(
top
,
#fff
0%
,
#eee
50%
);
background-image
:
linear-gradient
(
to
bottom
,
#fff
0%
,
#eee
50%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFFFFFFF'
,
endColorstr
=
'#FFEEEEEE'
,
GradientType
=
0
)}
.select2-container--classic.select2-container--open.select2-container--below
.select2-selection--single
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#eee
50%
,
#fff
100%
);
background-image
:
-o-linear-gradient
(
top
,
#eee
50%
,
#fff
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#eee
50%
,
#fff
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFEEEEEE'
,
endColorstr
=
'#FFFFFFFF'
,
GradientType
=
0
)}
.select2-container--classic
.select2-selection--multiple
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
text
;
outline
:
0
}
.select2-container--classic
.select2-selection--multiple
:focus
{
border
:
1px
solid
#5897fb
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__rendered
{
list-style
:
none
;
margin
:
0
;
padding
:
0
5px
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__clear
{
display
:
none
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice
{
background-color
:
#e4e4e4
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
default
;
float
:
left
;
margin-right
:
5px
;
margin-top
:
5px
;
padding
:
0
5px
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice__remove
{
color
:
#888
;
cursor
:
pointer
;
display
:
inline-block
;
font-weight
:
bold
;
margin-right
:
2px
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice__remove
:hover
{
color
:
#555
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
float
:
right
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
margin-left
:
5px
;
margin-right
:
auto
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice__remove
{
margin-left
:
2px
;
margin-right
:
auto
}
.select2-container--classic.select2-container--open
.select2-selection--multiple
{
border
:
1px
solid
#5897fb
}
.select2-container--classic.select2-container--open.select2-container--above
.select2-selection--multiple
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
}
.select2-container--classic.select2-container--open.select2-container--below
.select2-selection--multiple
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
}
.select2-container--classic
.select2-search--dropdown
.select2-search__field
{
border
:
1px
solid
#aaa
;
outline
:
0
}
.select2-container--classic
.select2-search--inline
.select2-search__field
{
outline
:
0
;
box-shadow
:
none
}
.select2-container--classic
.select2-dropdown
{
background-color
:
#fff
;
border
:
1px
solid
transparent
}
.select2-container--classic
.select2-dropdown--above
{
border-bottom
:
none
}
.select2-container--classic
.select2-dropdown--below
{
border-top
:
none
}
.select2-container--classic
.select2-results
>
.select2-results__options
{
max-height
:
200px
;
overflow-y
:
auto
}
.select2-container--classic
.select2-results__option
[
role
=
group
]
{
padding
:
0
}
.select2-container--classic
.select2-results__option
[
aria-disabled
=
true
]
{
color
:
grey
}
.select2-container--classic
.select2-results__option--highlighted
[
aria-selected
]
{
background-color
:
#3875d7
;
color
:
#fff
}
.select2-container--classic
.select2-results__group
{
cursor
:
default
;
display
:
block
;
padding
:
6px
}
.select2-container--classic.select2-container--open
.select2-dropdown
{
border-color
:
#5897fb
}
apollo-portal/src/main/resources/static/vendor/select2/select2.min.js
0 → 100644
浏览文件 @
1ea8697c
此差异已折叠。
点击以展开。
apollo-portal/src/main/resources/static/views/common/footer.html
浏览文件 @
1ea8697c
...
...
@@ -2,6 +2,7 @@
<hr>
<p
class=
"text-center"
>
<span
class=
"glyphicon glyphicon-copyright-mark"
aria-hidden=
"true"
></span>
携程 框架研发部
<br>
<a
href=
"http://conf.ctripcorp.com/display/FRAM/Apollo"
target=
"_blank"
>
wiki
</a>
</p>
</div>
...
...
apollo-portal/src/test/java/com/ctrip/apollo/portal/AppServiceTest.java
浏览文件 @
1ea8697c
...
...
@@ -71,9 +71,9 @@ public class AppServiceTest {
// appDTO.setOwnerEmail("qq@qq.com");
// appDTO.setOwnerName("zz");
//
// when(appService.
save
(appDTO)).thenReturn(appDTO);
// when(appService.
createApp
(appDTO)).thenReturn(appDTO);
//
// AppDTO createApp = appService.
save
(appDTO);
// AppDTO createApp = appService.
createApp
(appDTO);
//
// assertEquals(appId, createApp.getAppId());
// assertEquals(appName, createApp.getName());
...
...
apollo-portal/src/test/java/com/ctrip/apollo/portal/ServiceExceptionTest.java
浏览文件 @
1ea8697c
...
...
@@ -60,7 +60,7 @@ public class ServiceExceptionTest extends AbstractPortalTest {
HttpStatusCodeException
adminException
=
new
HttpServerErrorException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
"admin server error"
,
new
Gson
().
toJson
(
errorAttributes
).
getBytes
(),
Charset
.
defaultCharset
());
when
(
appAPI
.
save
(
any
(
Env
.
class
),
any
(
AppDTO
.
class
))).
thenThrow
(
adminException
);
when
(
appAPI
.
createApp
(
any
(
Env
.
class
),
any
(
AppDTO
.
class
))).
thenThrow
(
adminException
);
AppDTO
dto
=
generateSampleDTOData
();
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录