Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
Project overview
Project overview
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
Administrator
apollo
Commits
69c97acd
Commit
69c97acd
authored
May 09, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config页面拆分controller
parent
f60ee3e2
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
214 additions
and
212 deletions
+214
-212
apollo-portal/src/main/resources/static/config.html
apollo-portal/src/main/resources/static/config.html
+92
-94
apollo-portal/src/main/resources/static/scripts/controller/app/ConfigBaseInfoController.js
...static/scripts/controller/app/ConfigBaseInfoController.js
+111
-0
apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js
...tatic/scripts/controller/app/ConfigNamespaceController.js
+11
-118
No files found.
apollo-portal/src/main/resources/static/config.html
View file @
69c97acd
...
...
@@ -15,7 +15,7 @@
<div
ng-include=
"'views/common/nav.html'"
></div>
<div
class=
"container-fluid apollo-container"
>
<div
class=
"app"
ng-controller=
"AppConfigController as appConfig"
>
<div
class=
"app"
>
<!--配置信息-->
<div
id=
"config-info"
>
...
...
@@ -23,7 +23,7 @@
<!--具体配置信息-->
<div
class=
"row config-info-container"
>
<!--tag导航-->
<div
class=
"col-md-3"
>
<div
class=
"col-md-3"
ng-controller=
"ConfigBaseInfoController"
>
<div
id=
"treeview"
></div>
<!--app info-->
<section
class=
"panel"
>
...
...
@@ -92,9 +92,39 @@
</div>
</a>
</section>
<!--create env modal-->
<div
class=
"modal fade"
id=
"createEnvModal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header panel-primary"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
>
添加环境
</h4>
</div>
<div
class=
"modal-body"
>
<div
class=
"form-group"
>
<label>
请选择环境:
</label>
<div
class=
"checkbox"
ng-repeat=
"env in missEnvs"
>
<label>
<input
type=
"checkbox"
name=
"selectedEnvs[]"
value=
"{{env}}"
ng-checked=
"selectedEnvs.indexOf(env) > -1"
ng-click=
"toggleSelection(env)"
>
{{env}}
</label>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
</button>
<button
type=
"button"
class=
"btn btn-primary"
data-dismiss=
"modal"
ng-click=
"createEnvs()"
>
添加
</button>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-md-9 config-item-container"
>
<div
class=
"col-md-9 config-item-container"
ng-controller=
"ConfigNamespaceController"
>
<div
ng-repeat=
"namespace in namespaces"
>
<div
class=
"panel"
>
<header
class=
"panel-heading"
>
...
...
@@ -275,12 +305,6 @@
</div>
</div>
</div>
</div>
</div>
<!-- view old value Modal -->
<div
class=
"modal fade"
id=
"oldValueModal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog"
role=
"document"
>
...
...
@@ -298,7 +322,7 @@
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
Close
</button>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
</button>
</div>
</div>
</div>
...
...
@@ -350,33 +374,6 @@
</div>
</div>
</div>
<!--create env modal-->
<div
class=
"modal fade"
id=
"createEnvModal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header panel-primary"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
>
添加环境
</h4>
</div>
<div
class=
"modal-body"
>
<div
class=
"form-group"
>
<label>
请选择环境:
</label>
<div
class=
"checkbox"
ng-repeat=
"env in missEnvs"
>
<label>
<input
type=
"checkbox"
name=
"selectedEnvs[]"
value=
"{{env}}"
ng-checked=
"selectedEnvs.indexOf(env) > -1"
ng-click=
"toggleSelection(env)"
>
{{env}}
</label>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
</button>
<button
type=
"button"
class=
"btn btn-primary"
data-dismiss=
"modal"
ng-click=
"createEnvs()"
>
添加
</button>
</div>
</div>
</div>
</div>
...
...
@@ -417,7 +414,8 @@
<script
type=
"application/javascript"
src=
"scripts/AppUtils.js"
></script>
<!--controller-->
<script
type=
"application/javascript"
src=
"scripts/controller/app/AppConfigController.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/controller/app/ConfigNamespaceController.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/controller/app/ConfigBaseInfoController.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/PageCommon.js"
></script>
...
...
apollo-portal/src/main/resources/static/scripts/controller/app/ConfigBaseInfoController.js
0 → 100644
View file @
69c97acd
application_module
.
controller
(
"
ConfigBaseInfoController
"
,
[
'
$rootScope
'
,
'
$scope
'
,
'
$location
'
,
'
toastr
'
,
'
AppService
'
,
'
AppUtil
'
,
function
(
$rootScope
,
$scope
,
$location
,
toastr
,
AppService
,
AppUtil
)
{
var
appId
=
AppUtil
.
parseParams
(
$location
.
$$url
).
appid
;
var
pageContext
=
{
appId
:
appId
,
env
:
''
,
clusterName
:
'
default
'
};
$rootScope
.
pageContext
=
pageContext
;
////// load cluster nav tree //////
AppService
.
load_nav_tree
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
var
navTree
=
[];
var
nodes
=
result
.
nodes
;
nodes
.
forEach
(
function
(
item
)
{
var
node
=
{};
//first nav
node
.
text
=
item
.
env
;
var
clusterNodes
=
[];
//如果env下面只有一个default集群则不显示集群列表
if
(
item
.
clusters
&&
item
.
clusters
.
length
==
1
&&
item
.
clusters
[
0
].
name
==
'
default
'
){
node
.
selectable
=
true
;
}
else
{
node
.
selectable
=
false
;
//second nav
item
.
clusters
.
forEach
(
function
(
item
)
{
var
clusterNode
=
{},
parentNode
=
[];
clusterNode
.
text
=
item
.
name
;
parentNode
.
push
(
node
.
text
);
clusterNode
.
tags
=
parentNode
;
clusterNodes
.
push
(
clusterNode
);
});
}
node
.
nodes
=
clusterNodes
;
navTree
.
push
(
node
);
});
$
(
'
#treeview
'
).
treeview
({
color
:
"
#428bca
"
,
showBorder
:
true
,
data
:
navTree
,
levels
:
99
,
onNodeSelected
:
function
(
event
,
data
)
{
if
(
!
data
.
tags
){
//first nav node
$rootScope
.
pageContext
.
env
=
data
.
text
;
$rootScope
.
pageContext
.
clusterName
=
'
default
'
;
}
else
{
//second cluster node
$rootScope
.
pageContext
.
env
=
data
.
tags
[
0
];
$rootScope
.
pageContext
.
clusterName
=
data
.
text
;
}
$rootScope
.
refreshNamespaces
();
}
});
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
加载导航出错
"
);
});
////// app info //////
AppService
.
load
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
appBaseInfo
=
result
.
app
;
$scope
.
missEnvs
=
result
.
missEnvs
;
$scope
.
selectedEnvs
=
angular
.
copy
(
$scope
.
missEnvs
);
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
加载App信息出错
"
);
});
////// 补缺失的环境 //////
$scope
.
toggleSelection
=
function
toggleSelection
(
env
)
{
var
idx
=
$scope
.
selectedEnvs
.
indexOf
(
env
);
// is currently selected
if
(
idx
>
-
1
)
{
$scope
.
selectedEnvs
.
splice
(
idx
,
1
);
}
// is newly selected
else
{
$scope
.
selectedEnvs
.
push
(
env
);
}
};
$scope
.
createEnvs
=
function
()
{
var
count
=
0
;
$scope
.
selectedEnvs
.
forEach
(
function
(
env
)
{
AppService
.
create
(
env
,
$scope
.
appBaseInfo
).
then
(
function
(
result
)
{
toastr
.
success
(
env
,
'
创建成功
'
);
count
++
;
if
(
count
==
$scope
.
selectedEnvs
.
length
){
location
.
reload
(
true
);
}
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
'
创建失败:
'
+
env
);
count
++
;
if
(
count
==
$scope
.
selectedEnvs
){
$route
.
reload
();
}
});
});
};
}]);
apollo-portal/src/main/resources/static/scripts/controller/app/
AppConfig
Controller.js
→
apollo-portal/src/main/resources/static/scripts/controller/app/
ConfigNamespace
Controller.js
View file @
69c97acd
This diff is collapsed.
Click to expand it.
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