Commit 9934dfd9 by Jason Song Committed by GitHub

Merge pull request #403 from lepdou/0905

portal bugfix:nav search app & add cluster tips
parents 5935296f d47273cf
......@@ -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');
}]);
......@@ -43,14 +43,11 @@ directive_module.directive('apollonav', function ($compile, $window, toastr, App
scope.jumpToConfigPage = function () {
if (selectedApp.appId) {
var needReloadPage = false;
if ($window.location.href.indexOf("config.html") > -1) {
needReloadPage = true;
}
$window.location.href = '/config.html?#appid=' + selectedApp.appId;
if (needReloadPage) {
$window.location.hash = "appid=" + selectedApp.appId;
$window.location.reload();
}else {
$window.location.href = '/config.html?#appid=' + selectedApp.appId;
}
}
};
......
......@@ -4,15 +4,12 @@
<a class="navbar-brand logo" href="/"></a>
</div>
<style>
</style>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="http://conf.ctripcorp.com/display/FRAM/Apollo" target="_blank">
<span class="glyphicon glyphicon-question-sign"></span> Help
<span class="glyphicon glyphicon-question-sign"></span>帮助
</a>
</li>
......
......@@ -31,7 +31,7 @@
</button>
<button type="button" class="btn btn-default btn-sm J_tableview_btn"
data-tooltip="tooltip" data-placement="bottom" title="回滚配置"
data-tooltip="tooltip" data-placement="bottom" title="回滚已发布配置"
ng-show="namespace.hasReleasePermission"
ng-click="preRollback(namespace)">
<img src="img/rollback.png">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment