提交 d47273cf 编写于 作者: Z zhangle

default cluster tips

上级 9c0fe442
......@@ -86,8 +86,37 @@
</div>
<!--namespaces-->
<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">
<apollonspanel namespace="namespace" app-id="pageContext.appId"
env="pageContext.env" cluster="pageContext.clusterName"
......@@ -134,10 +163,12 @@
<div class="col-sm-2 control-label" ng-if="!toReleaseNamespace.isPropertiesFormat">
<div class="row">
<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')">查看变更
</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')">发布的值
</button>
</div>
......@@ -198,14 +229,16 @@
<!--file format -->
<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"
apollo-id="'releaseStrDiff'"></apollodiff>
</div>
<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"
ng-disabled="true" ng-show="item.newValue" ng-bind="item.newValue">
ng-disabled="true" ng-show="item.newValue" ng-bind="item.newValue">
</textarea>
</div>
......@@ -309,7 +342,7 @@
</div>
<div class="modal-footer">
</button>
<button type="button" class="btn btn-default" data-dismiss="modal" >
<button type="button" class="btn btn-default" data-dismiss="modal">
关闭
</button>
<button type="submit" class="btn btn-primary"
......
......@@ -6,23 +6,25 @@ application_module.controller("ConfigBaseInfoController",
var appId = AppUtil.parseParams($location.$$url).appid;
$rootScope.hideTip = JSON.parse(localStorage.getItem("hideTip"));
//save user recent visited apps
var VISITED_APPS_STORAGE_KEY = "VisitedApps";
var visitedApps = JSON.parse(localStorage.getItem(VISITED_APPS_STORAGE_KEY));
var hasSaved = false;
if (visitedApps){
if (visitedApps) {
visitedApps.forEach(function (app) {
if (app == appId){
if (app == appId) {
hasSaved = true;
return;
}
});
}else {
} else {
visitedApps = [];
}
if (!hasSaved){
if (!hasSaved) {
visitedApps.push(appId);
localStorage.setItem(VISITED_APPS_STORAGE_KEY,
JSON.stringify(visitedApps));
}
......@@ -78,7 +80,8 @@ application_module.controller("ConfigBaseInfoController",
parentNode = [];
//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.selected = true;
}
......@@ -94,6 +97,7 @@ application_module.controller("ConfigBaseInfoController",
navTree.push(node);
});
//init treeview
$('#treeview').treeview({
color: "#797979",
showBorder: true,
......@@ -117,14 +121,33 @@ application_module.controller("ConfigBaseInfoController",
sessionStorage.setItem(
$rootScope.pageContext.appId,
JSON.stringify({
env: $rootScope.pageContext.env,
cluster: $rootScope.pageContext.clusterName
}));
env: $rootScope.pageContext.env,
cluster: $rootScope.pageContext.clusterName
}));
$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) {
toastr.error(AppUtil.errorMsg(result), "加载导航出错");
});
......
......@@ -42,26 +42,35 @@ application_module.controller("ConfigNamespaceController",
$scope.createItem = createItem;
$scope.doItem = doItem;
$scope.closeTip = closeTip;
$scope.releaseBtnDisabled = false;
$scope.rollbackBtnDisabled = false;
$scope.addItemBtnDisabled = 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) {
if ($rootScope.pageContext.env == '') {
......@@ -349,6 +358,24 @@ application_module.controller("ConfigNamespaceController",
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');
}]);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册