Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
2ef6cf95
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,发现更多精彩内容 >>
提交
2ef6cf95
编写于
5月 19, 2016
作者:
L
lepdou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
集群选择做成一个标签
上级
ff8856fc
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
104 addition
and
109 deletion
+104
-109
apollo-portal/src/main/resources/static/config/sync.html
apollo-portal/src/main/resources/static/config/sync.html
+2
-18
apollo-portal/src/main/resources/static/index.html
apollo-portal/src/main/resources/static/index.html
+1
-1
apollo-portal/src/main/resources/static/namespace.html
apollo-portal/src/main/resources/static/namespace.html
+2
-18
apollo-portal/src/main/resources/static/scripts/app.js
apollo-portal/src/main/resources/static/scripts/app.js
+1
-1
apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
...esources/static/scripts/controller/NamespaceController.js
+5
-41
apollo-portal/src/main/resources/static/scripts/controller/app/SyncConfigController.js
...ces/static/scripts/controller/app/SyncConfigController.js
+10
-29
apollo-portal/src/main/resources/static/scripts/directive.js
apollo-portal/src/main/resources/static/scripts/directive.js
+64
-0
apollo-portal/src/main/resources/static/views/component/env-selector.html
...c/main/resources/static/views/component/env-selector.html
+18
-0
application.pid
application.pid
+1
-1
未找到文件。
apollo-portal/src/main/resources/static/config/sync.html
浏览文件 @
2ef6cf95
...
...
@@ -46,24 +46,8 @@
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
同步到那个集群
</label>
<div
class=
"col-sm-6"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<td><input
type=
"checkbox"
ng-click=
"toggleEnvsCheckedStatus()"
></td>
</td>
<td>
环境
</td>
<td>
集群
</td>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"namespaceIdentifer in namespaceIdentifers"
>
<td
width=
"10%"
><input
type=
"checkbox"
ng-checked=
"namespaceIdentifer.checked"
ng-click=
"switchSelect(namespaceIdentifer)"
></td>
<td
width=
"30%"
ng-bind=
"namespaceIdentifer.env"
></td>
<td
width=
"60%"
ng-bind=
"namespaceIdentifer.name"
></td>
</tr>
</tbody>
</table>
<apolloclusterselector
apollo-app-id=
"pageContext.appId"
apollo-default-checked=
"true"
apollo-select=
"collectSelectedClusters"
></apolloclusterselector>
</div>
</div>
</div>
...
...
apollo-portal/src/main/resources/static/index.html
浏览文件 @
2ef6cf95
...
...
@@ -15,7 +15,7 @@
<div
class=
"site-notice"
>
当前站点支持
<a
ng-repeat=
"env in envs"
ng-class=
"{selected:selectedEnv == env}"
ng-click=
"switchEnv(env)"
><em
ng-bind=
"env"
>
</em>
</a>
</em>
</a>
环境点击切换
</div>
...
...
apollo-portal/src/main/resources/static/namespace.html
浏览文件 @
2ef6cf95
...
...
@@ -41,24 +41,8 @@
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
><font
style=
"color: red"
>
*
</font>
选择集群
</label>
<div
class=
"col-sm-6"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<td><input
type=
"checkbox"
ng-click=
"toggleEnvsCheckedStatus()"
></td>
</td>
<td>
环境
</td>
<td>
集群
</td>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"namespaceIdentifer in namespaceIdentifers"
>
<td
width=
"10%"
><input
type=
"checkbox"
ng-checked=
"namespaceIdentifer.checked"
ng-click=
"switchSelect(namespaceIdentifer)"
></td>
<td
width=
"30%"
ng-bind=
"namespaceIdentifer.env"
></td>
<td
width=
"60%"
ng-bind=
"namespaceIdentifer.name"
></td>
</tr>
</tbody>
</table>
<apolloclusterselector
apollo-app-id=
"appId"
apollo-default-checked=
"true"
apollo-select=
"collectSelectedClusters"
></apolloclusterselector>
</div>
</div>
</div>
...
...
apollo-portal/src/main/resources/static/scripts/app.js
浏览文件 @
2ef6cf95
...
...
@@ -5,7 +5,7 @@ var appService = angular.module('app.service', ['ngResource']);
var
appUtil
=
angular
.
module
(
'
app.util
'
,
[
'
toastr
'
]);
/** directive */
var
directive_module
=
angular
.
module
(
'
apollo.directive
'
,
[
'
app.service
'
]);
var
directive_module
=
angular
.
module
(
'
apollo.directive
'
,
[
'
app.service
'
,
'
app.util
'
,
'
toastr
'
]);
/** page module 定义*/
// 首页
...
...
apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
浏览文件 @
2ef6cf95
...
...
@@ -8,22 +8,6 @@ namespace_module.controller("LinkNamespaceController",
$scope
.
step
=
1
;
////// load env //////
AppService
.
load_nav_tree
(
$scope
.
appId
).
then
(
function
(
result
)
{
$scope
.
namespaceIdentifers
=
[];
var
envClusterInfo
=
AppUtil
.
collectData
(
result
);
envClusterInfo
.
forEach
(
function
(
node
)
{
var
env
=
node
.
env
;
node
.
clusters
.
forEach
(
function
(
cluster
)
{
cluster
.
env
=
env
;
cluster
.
checked
=
false
;
$scope
.
namespaceIdentifers
.
push
(
cluster
);
})
});
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
加载环境出错
"
);
});
NamespaceService
.
find_public_namespaces
().
then
(
function
(
result
)
{
var
publicNamespaces
=
[];
result
.
forEach
(
function
(
item
)
{
...
...
@@ -45,9 +29,13 @@ namespace_module.controller("LinkNamespaceController",
name
:
''
,
comment
:
''
};
var
selectedClusters
=
[];
$scope
.
collectSelectedClusters
=
function
(
data
)
{
selectedClusters
=
data
;
};
$scope
.
createNamespace
=
function
()
{
if
(
$scope
.
type
==
'
link
'
){
var
selectedClusters
=
collectSelectedClusters
();
if
(
selectedClusters
.
length
==
0
){
toastr
.
warning
(
"
请选择集群
"
);
return
;
...
...
@@ -85,35 +73,11 @@ namespace_module.controller("LinkNamespaceController",
};
var
envAllSelected
=
false
;
$scope
.
toggleEnvsCheckedStatus
=
function
()
{
envAllSelected
=
!
envAllSelected
;
$scope
.
namespaceIdentifers
.
forEach
(
function
(
namespaceIdentifer
)
{
namespaceIdentifer
.
checked
=
envAllSelected
;
})
};
function
collectSelectedClusters
()
{
var
selectedClusters
=
[];
$scope
.
namespaceIdentifers
.
forEach
(
function
(
namespaceIdentifer
)
{
if
(
namespaceIdentifer
.
checked
){
namespaceIdentifer
.
clusterName
=
namespaceIdentifer
.
name
;
selectedClusters
.
push
(
namespaceIdentifer
);
}
});
return
selectedClusters
;
}
$scope
.
namespaceType
=
1
;
$scope
.
selectNamespaceType
=
function
(
type
)
{
$scope
.
namespaceType
=
type
;
};
$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/SyncConfigController.js
浏览文件 @
2ef6cf95
...
...
@@ -10,31 +10,7 @@ sync_item_module.controller("SyncItemController",
namespaceName
:
params
.
namespaceName
};
////// load env //////
AppService
.
load_nav_tree
(
$scope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
namespaceIdentifers
=
[];
var
envClusterInfo
=
AppUtil
.
collectData
(
result
);
envClusterInfo
.
forEach
(
function
(
node
)
{
var
env
=
node
.
env
;
node
.
clusters
.
forEach
(
function
(
cluster
)
{
cluster
.
env
=
env
;
cluster
.
checked
=
false
;
if
(
env
!=
$scope
.
pageContext
.
env
||
cluster
.
name
!=
$scope
.
pageContext
.
clusterName
){
$scope
.
namespaceIdentifers
.
push
(
cluster
);
}
})
});
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
加载环境出错
"
);
});
var
envAllSelected
=
false
;
$scope
.
toggleEnvsCheckedStatus
=
function
()
{
envAllSelected
=
!
envAllSelected
;
$scope
.
namespaceIdentifers
.
forEach
(
function
(
namespaceIdentifer
)
{
namespaceIdentifer
.
checked
=
envAllSelected
;
})
};
////// load items //////
ConfigService
.
find_items
(
$scope
.
pageContext
.
appId
,
$scope
.
pageContext
.
env
,
...
...
@@ -85,6 +61,11 @@ sync_item_module.controller("SyncItemController",
toastr
.
error
(
AppUtil
.
errorMsg
(
result
));
});
};
var
selectedClusters
=
[];
$scope
.
collectSelectedClusters
=
function
(
data
)
{
selectedClusters
=
data
;
};
function
parseSyncSourceData
()
{
var
sourceData
=
{
...
...
@@ -92,11 +73,11 @@ sync_item_module.controller("SyncItemController",
syncItems
:
[]
};
var
namespaceName
=
$scope
.
pageContext
.
namespaceName
;
$scope
.
namespaceIdentifers
.
forEach
(
function
(
namespaceIdentif
er
)
{
if
(
namespaceIdentif
er
.
checked
){
namespaceIdentifer
.
clusterName
=
namespaceIdentif
er
.
name
;
namespaceIdentif
er
.
namespaceName
=
namespaceName
;
sourceData
.
syncToNamespaces
.
push
(
namespaceIdentif
er
);
selectedClusters
.
forEach
(
function
(
clust
er
)
{
if
(
clust
er
.
checked
){
cluster
.
clusterName
=
clust
er
.
name
;
clust
er
.
namespaceName
=
namespaceName
;
sourceData
.
syncToNamespaces
.
push
(
clust
er
);
}
});
$scope
.
sourceItems
.
forEach
(
function
(
item
)
{
...
...
apollo-portal/src/main/resources/static/scripts/directive.js
浏览文件 @
2ef6cf95
/** navbar */
directive_module
.
directive
(
'
apollonav
'
,
function
(
$compile
,
$window
,
AppService
,
EnvService
)
{
return
{
restrict
:
'
E
'
,
...
...
@@ -113,3 +115,65 @@ directive_module.directive('apollonav', function ($compile, $window, AppService,
}
});
/** env cluster selector*/
directive_module
.
directive
(
'
apolloclusterselector
'
,
function
(
$compile
,
$window
,
AppService
,
AppUtil
,
toastr
)
{
return
{
restrict
:
'
E
'
,
templateUrl
:
'
../views/component/env-selector.html
'
,
transclude
:
true
,
replace
:
true
,
scope
:
{
appId
:
'
=apolloAppId
'
,
defaultChecked
:
'
=apolloDefaultChecked
'
,
select
:
'
=apolloSelect
'
},
link
:
function
(
scope
,
element
,
attrs
)
{
////// load env //////
AppService
.
load_nav_tree
(
scope
.
appId
).
then
(
function
(
result
)
{
scope
.
clusters
=
[];
var
envClusterInfo
=
AppUtil
.
collectData
(
result
);
envClusterInfo
.
forEach
(
function
(
node
)
{
var
env
=
node
.
env
;
node
.
clusters
.
forEach
(
function
(
cluster
)
{
cluster
.
env
=
env
;
cluster
.
checked
=
scope
.
defaultChecked
;
scope
.
clusters
.
push
(
cluster
);
})
});
scope
.
select
(
collectSelectedClusters
());
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
加载环境信息出错
"
);
});
scope
.
envAllSelected
=
scope
.
defaultChecked
;
scope
.
toggleEnvsCheckedStatus
=
function
()
{
scope
.
envAllSelected
=
!
scope
.
envAllSelected
;
scope
.
clusters
.
forEach
(
function
(
cluster
)
{
cluster
.
checked
=
scope
.
envAllSelected
;
});
scope
.
select
(
collectSelectedClusters
());
};
scope
.
switchSelect
=
function
(
o
)
{
o
.
checked
=
!
o
.
checked
;
scope
.
select
(
collectSelectedClusters
());
};
function
collectSelectedClusters
()
{
var
selectedClusters
=
[];
scope
.
clusters
.
forEach
(
function
(
cluster
)
{
if
(
cluster
.
checked
){
cluster
.
clusterName
=
cluster
.
name
;
selectedClusters
.
push
(
cluster
);
}
});
return
selectedClusters
;
}
}
}
});
apollo-portal/src/main/resources/static/views/component/env-selector.html
0 → 100644
浏览文件 @
2ef6cf95
<table
class=
"table table-hover"
>
<thead>
<tr>
<td><input
type=
"checkbox"
ng-checked=
"envAllSelected"
ng-click=
"toggleEnvsCheckedStatus()"
></td>
</td>
<td>
环境
</td>
<td>
集群
</td>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"cluster in clusters"
>
<td
width=
"10%"
><input
type=
"checkbox"
ng-checked=
"cluster.checked"
ng-click=
"switchSelect(cluster)"
></td>
<td
width=
"30%"
ng-bind=
"cluster.env"
></td>
<td
width=
"60%"
ng-bind=
"cluster.name"
></td>
</tr>
</tbody>
</table>
application.pid
浏览文件 @
2ef6cf95
7804
\ No newline at end of file
13303
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录