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
9c84dccb
Commit
9c84dccb
authored
May 09, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #180 from lepdou/namespace
config页面拆分angular controller
parents
f60ee3e2
69c97acd
Changes
3
Expand all
Hide 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 @
9c84dccb
This diff is collapsed.
Click to expand it.
apollo-portal/src/main/resources/static/scripts/controller/app/ConfigBaseInfoController.js
0 → 100644
View file @
9c84dccb
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 @
9c84dccb
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