Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
openSource
apollo
Commits
d47273cf
Commit
d47273cf
authored
Sep 06, 2016
by
zhangle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default cluster tips
parent
9c0fe442
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
25 deletions
+108
-25
config.html
apollo-portal/src/main/resources/static/config.html
+39
-6
ConfigBaseInfoController.js
...tic/scripts/controller/config/ConfigBaseInfoController.js
+32
-9
ConfigNamespaceController.js
...ic/scripts/controller/config/ConfigNamespaceController.js
+37
-10
No files found.
apollo-portal/src/main/resources/static/config.html
View file @
d47273cf
...
@@ -86,8 +86,37 @@
...
@@ -86,8 +86,37 @@
</div>
</div>
<!--namespaces-->
<!--namespaces-->
<div
class=
"col-md-9 col-xs-9 col-sm-9 config-item-container hide"
ng-controller=
"ConfigNamespaceController"
>
<div
class=
"col-md-9 col-xs-9 col-sm-9 config-item-container hide"
ng-controller=
"ConfigNamespaceController"
>
<div
class=
"alert alert-warning alert-dismissible"
role=
"alert"
ng-show=
"(!hideTip || !hideTip[pageContext.appId][pageContext.clusterName]) && envMapClusters[pageContext.env]"
>
<button
class=
"btn btn-sm btn-default pull-right"
style=
"margin-top: -7px;margin-right:-15px;"
ng-click=
"closeTip(pageContext.clusterName)"
>
不再提示
</button>
<!--default cluster tip -->
<div
ng-show=
"pageContext.clusterName == 'default'"
>
<strong>
注意:
</strong>
所有不属于
<span
ng-bind=
"envMapClusters[pageContext.env]"
></span>
集群的实例会使用default集群(当前页面)的配置,属于
<span
ng-bind=
"envMapClusters[pageContext.env]"
></span>
的实例会使用对应集群的配置!
</div>
<!--custom cluster tip-->
<div
ng-show=
"pageContext.clusterName != 'default'"
>
<strong>
注意:
</strong>
属于
<span
ng-bind=
"pageContext.clusterName"
></span>
集群的实例只会使用
<span
ng-bind=
"pageContext.clusterName"
></span>
集群(当前页面)的配置,只有当对应namespace在当前集群没有发布过配置时,才会使用default集群的配置!
</div>
</div>
<div
ng-repeat=
"namespace in namespaces"
>
<div
ng-repeat=
"namespace in namespaces"
>
<apollonspanel
namespace=
"namespace"
app-id=
"pageContext.appId"
<apollonspanel
namespace=
"namespace"
app-id=
"pageContext.appId"
env=
"pageContext.env"
cluster=
"pageContext.clusterName"
env=
"pageContext.env"
cluster=
"pageContext.clusterName"
...
@@ -134,10 +163,12 @@
...
@@ -134,10 +163,12 @@
<div
class=
"col-sm-2 control-label"
ng-if=
"!toReleaseNamespace.isPropertiesFormat"
>
<div
class=
"col-sm-2 control-label"
ng-if=
"!toReleaseNamespace.isPropertiesFormat"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"btn-group btn-group-xs"
style=
"padding-right: 10px"
role=
"group"
>
<div
class=
"btn-group btn-group-xs"
style=
"padding-right: 10px"
role=
"group"
>
<button
type=
"button"
class=
"btn btn-default"
ng-class=
"{active:releaseChangeViewType=='change'}"
<button
type=
"button"
class=
"btn btn-default"
ng-class=
"{active:releaseChangeViewType=='change'}"
ng-click=
"switchReleaseChangeViewType('change')"
>
查看变更
ng-click=
"switchReleaseChangeViewType('change')"
>
查看变更
</button>
</button>
<button
type=
"button"
class=
"btn btn-default"
ng-class=
"{active:releaseChangeViewType=='release'}"
<button
type=
"button"
class=
"btn btn-default"
ng-class=
"{active:releaseChangeViewType=='release'}"
ng-click=
"switchReleaseChangeViewType('release')"
>
发布的值
ng-click=
"switchReleaseChangeViewType('release')"
>
发布的值
</button>
</button>
</div>
</div>
...
@@ -198,14 +229,16 @@
...
@@ -198,14 +229,16 @@
<!--file format -->
<!--file format -->
<div
ng-repeat=
"item in toReleaseNamespace.items"
<div
ng-repeat=
"item in toReleaseNamespace.items"
ng-if=
"!toReleaseNamespace.isPropertiesFormat"
ng-show=
"releaseChangeViewType=='change'"
>
ng-if=
"!toReleaseNamespace.isPropertiesFormat"
ng-show=
"releaseChangeViewType=='change'"
>
<apollodiff
old-str=
"item.oldValue"
new-str=
"item.newValue"
<apollodiff
old-str=
"item.oldValue"
new-str=
"item.newValue"
apollo-id=
"'releaseStrDiff'"
></apollodiff>
apollo-id=
"'releaseStrDiff'"
></apollodiff>
</div>
</div>
<div
ng-repeat=
"item in toReleaseNamespace.items"
<div
ng-repeat=
"item in toReleaseNamespace.items"
ng-if=
"!toReleaseNamespace.isPropertiesFormat"
ng-show=
"releaseChangeViewType=='release'"
>
ng-if=
"!toReleaseNamespace.isPropertiesFormat"
ng-show=
"releaseChangeViewType=='release'"
>
<textarea
class=
"form-control"
rows=
"20"
style=
"border-radius: 0px"
<textarea
class=
"form-control"
rows=
"20"
style=
"border-radius: 0px"
ng-disabled=
"true"
ng-show=
"item.newValue"
ng-bind=
"item.newValue"
>
ng-disabled=
"true"
ng-show=
"item.newValue"
ng-bind=
"item.newValue"
>
</textarea>
</textarea>
</div>
</div>
...
@@ -309,7 +342,7 @@
...
@@ -309,7 +342,7 @@
</div>
</div>
<div
class=
"modal-footer"
>
<div
class=
"modal-footer"
>
</button>
</button>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
关闭
关闭
</button>
</button>
<button
type=
"submit"
class=
"btn btn-primary"
<button
type=
"submit"
class=
"btn btn-primary"
...
...
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
View file @
d47273cf
...
@@ -6,23 +6,25 @@ application_module.controller("ConfigBaseInfoController",
...
@@ -6,23 +6,25 @@ application_module.controller("ConfigBaseInfoController",
var
appId
=
AppUtil
.
parseParams
(
$location
.
$$url
).
appid
;
var
appId
=
AppUtil
.
parseParams
(
$location
.
$$url
).
appid
;
$rootScope
.
hideTip
=
JSON
.
parse
(
localStorage
.
getItem
(
"hideTip"
));
//save user recent visited apps
//save user recent visited apps
var
VISITED_APPS_STORAGE_KEY
=
"VisitedApps"
;
var
VISITED_APPS_STORAGE_KEY
=
"VisitedApps"
;
var
visitedApps
=
JSON
.
parse
(
localStorage
.
getItem
(
VISITED_APPS_STORAGE_KEY
));
var
visitedApps
=
JSON
.
parse
(
localStorage
.
getItem
(
VISITED_APPS_STORAGE_KEY
));
var
hasSaved
=
false
;
var
hasSaved
=
false
;
if
(
visitedApps
){
if
(
visitedApps
)
{
visitedApps
.
forEach
(
function
(
app
)
{
visitedApps
.
forEach
(
function
(
app
)
{
if
(
app
==
appId
){
if
(
app
==
appId
)
{
hasSaved
=
true
;
hasSaved
=
true
;
return
;
return
;
}
}
});
});
}
else
{
}
else
{
visitedApps
=
[];
visitedApps
=
[];
}
}
if
(
!
hasSaved
){
if
(
!
hasSaved
)
{
visitedApps
.
push
(
appId
);
visitedApps
.
push
(
appId
);
localStorage
.
setItem
(
VISITED_APPS_STORAGE_KEY
,
localStorage
.
setItem
(
VISITED_APPS_STORAGE_KEY
,
JSON
.
stringify
(
visitedApps
));
JSON
.
stringify
(
visitedApps
));
}
}
...
@@ -78,7 +80,8 @@ application_module.controller("ConfigBaseInfoController",
...
@@ -78,7 +80,8 @@ application_module.controller("ConfigBaseInfoController",
parentNode
=
[];
parentNode
=
[];
//default selection from session storage or first env & first cluster
//default selection from session storage or first env & first cluster
if
(
pageContext
.
env
==
env
.
env
&&
pageContext
.
clusterName
==
cluster
.
name
)
{
if
(
pageContext
.
env
==
env
.
env
&&
pageContext
.
clusterName
==
cluster
.
name
)
{
clusterNode
.
state
=
{};
clusterNode
.
state
=
{};
clusterNode
.
state
.
selected
=
true
;
clusterNode
.
state
.
selected
=
true
;
}
}
...
@@ -94,6 +97,7 @@ application_module.controller("ConfigBaseInfoController",
...
@@ -94,6 +97,7 @@ application_module.controller("ConfigBaseInfoController",
navTree
.
push
(
node
);
navTree
.
push
(
node
);
});
});
//init treeview
$
(
'#treeview'
).
treeview
({
$
(
'#treeview'
).
treeview
({
color
:
"#797979"
,
color
:
"#797979"
,
showBorder
:
true
,
showBorder
:
true
,
...
@@ -117,14 +121,33 @@ application_module.controller("ConfigBaseInfoController",
...
@@ -117,14 +121,33 @@ application_module.controller("ConfigBaseInfoController",
sessionStorage
.
setItem
(
sessionStorage
.
setItem
(
$rootScope
.
pageContext
.
appId
,
$rootScope
.
pageContext
.
appId
,
JSON
.
stringify
({
JSON
.
stringify
({
env
:
$rootScope
.
pageContext
.
env
,
env
:
$rootScope
.
pageContext
.
env
,
cluster
:
$rootScope
.
pageContext
.
clusterName
cluster
:
$rootScope
.
pageContext
.
clusterName
}));
}));
$rootScope
.
refreshNamespaces
();
$rootScope
.
refreshNamespaces
();
}
}
});
});
var
envMapClusters
=
{};
navTree
.
forEach
(
function
(
node
)
{
if
(
node
.
nodes
&&
node
.
nodes
.
length
>
0
)
{
var
clusterNames
=
[];
node
.
nodes
.
forEach
(
function
(
cluster
)
{
if
(
cluster
.
text
!=
'default'
)
{
clusterNames
.
push
(
cluster
.
text
);
}
});
envMapClusters
[
node
.
text
]
=
clusterNames
.
join
(
","
);
}
});
$rootScope
.
envMapClusters
=
envMapClusters
;
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载导航出错"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载导航出错"
);
});
});
...
...
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigNamespaceController.js
View file @
d47273cf
...
@@ -42,26 +42,35 @@ application_module.controller("ConfigNamespaceController",
...
@@ -42,26 +42,35 @@ application_module.controller("ConfigNamespaceController",
$scope
.
createItem
=
createItem
;
$scope
.
createItem
=
createItem
;
$scope
.
doItem
=
doItem
;
$scope
.
doItem
=
doItem
;
$scope
.
closeTip
=
closeTip
;
$scope
.
releaseBtnDisabled
=
false
;
$scope
.
releaseBtnDisabled
=
false
;
$scope
.
rollbackBtnDisabled
=
false
;
$scope
.
rollbackBtnDisabled
=
false
;
$scope
.
addItemBtnDisabled
=
false
;
$scope
.
addItemBtnDisabled
=
false
;
$scope
.
commitChangeBtnDisabled
=
false
;
$scope
.
commitChangeBtnDisabled
=
false
;
init
();
function
init
()
{
PermissionService
.
get_app_role_users
(
$rootScope
.
pageContext
.
appId
)
.
then
(
function
(
result
)
{
var
masterUsers
=
''
;
result
.
masterUsers
.
forEach
(
function
(
user
)
{
masterUsers
+=
user
.
userId
+
','
;
});
$scope
.
masterUsers
=
masterUsers
.
substring
(
0
,
masterUsers
.
length
-
1
);
},
function
(
result
)
{
PermissionService
.
get_app_role_users
(
$rootScope
.
pageContext
.
appId
)
.
then
(
function
(
result
)
{
var
masterUsers
=
''
;
result
.
masterUsers
.
forEach
(
function
(
user
)
{
masterUsers
+=
user
.
userId
+
','
;
});
});
$scope
.
masterUsers
=
masterUsers
.
substring
(
0
,
masterUsers
.
length
-
1
);
},
function
(
result
)
{
UserService
.
load_user
().
then
(
function
(
result
)
{
$scope
.
currentUser
=
result
.
userId
;
});
});
}
UserService
.
load_user
().
then
(
function
(
result
)
{
$scope
.
currentUser
=
result
.
userId
;
});
function
refreshNamespaces
(
viewType
)
{
function
refreshNamespaces
(
viewType
)
{
if
(
$rootScope
.
pageContext
.
env
==
''
)
{
if
(
$rootScope
.
pageContext
.
env
==
''
)
{
...
@@ -349,6 +358,24 @@ application_module.controller("ConfigNamespaceController",
...
@@ -349,6 +358,24 @@ application_module.controller("ConfigNamespaceController",
return
true
;
return
true
;
}
}
function
closeTip
(
clusterName
)
{
var
hideTip
=
JSON
.
parse
(
localStorage
.
getItem
(
"hideTip"
));
if
(
!
hideTip
){
hideTip
=
{};
hideTip
[
$rootScope
.
pageContext
.
appId
]
=
{};
}
if
(
!
hideTip
[
$rootScope
.
pageContext
.
appId
]){
hideTip
[
$rootScope
.
pageContext
.
appId
]
=
{};
}
hideTip
[
$rootScope
.
pageContext
.
appId
][
clusterName
]
=
true
;
$rootScope
.
hideTip
=
hideTip
;
localStorage
.
setItem
(
"hideTip"
,
JSON
.
stringify
(
hideTip
));
}
$
(
'.config-item-container'
).
removeClass
(
'hide'
);
$
(
'.config-item-container'
).
removeClass
(
'hide'
);
}]);
}]);
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