提交 cac111a4 编写于 作者: J Jason Song 提交者: GitHub

Merge pull request #528 from lepdou/url

append page context info to url
......@@ -10,7 +10,8 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
PermissionService,
AppUtil) {
var appId = AppUtil.parseParams($location.$$url).appid;
var urlParams = AppUtil.parseParams($location.$$url);
var appId = urlParams.appid;
if (!appId) {
$window.location.href = '/index.html';
......@@ -23,12 +24,21 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
//load session storage to recovery scene
var scene = JSON.parse(sessionStorage.getItem(appId));
$rootScope.pageContext = {
appId: appId,
env: scene ? scene.env : '',
clusterName: scene ? scene.cluster : 'default'
env: urlParams.env ? urlParams.env : (scene ? scene.env : ''),
clusterName: urlParams.cluster ? urlParams.cluster : (scene ? scene.cluster : 'default')
};
//storage page context to session storage
sessionStorage.setItem(
$rootScope.pageContext.appId,
JSON.stringify({
env: $rootScope.pageContext.env,
cluster: $rootScope.pageContext.clusterName
}));
UserService.load_user().then(function (result) {
$rootScope.pageContext.userId = result.userId;
loadAppInfo();
......@@ -211,6 +221,11 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
cluster: $rootScope.pageContext.clusterName
}));
$window.location.href = "/config.html#/appid="
+ $rootScope.pageContext.appId
+ "&env=" + $rootScope.pageContext.env
+ "&cluster=" + $rootScope.pageContext.clusterName;
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE);
$rootScope.showSideBar = false;
}
......@@ -311,7 +326,6 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
$rootScope.viewMode = 1;
}
$rootScope.adaptScreenSize = function () {
if (window.innerWidth <= VIEW_MODE_SWITCH_WIDTH) {
$rootScope.viewMode = 2;
......@@ -322,8 +336,8 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
};
$(window).resize(function(){
$scope.$apply(function(){
$(window).resize(function () {
$scope.$apply(function () {
$rootScope.adaptScreenSize();
});
});
......
......@@ -385,7 +385,7 @@
<div class="row">
<div class="padding-top-5 col-md-4 col-sm-4">
公共的配置
<a href="/config.html?#/appid={{namespace.publicNamespace.baseInfo.appId}}" target="_blank">
<a href="/config.html?#/appid={{namespace.publicNamespace.baseInfo.appId}}&env={{env}}&cluster={{namespace.publicNamespace.baseInfo.clusterName}}" target="_blank">
<small>
(AppId:{{namespace.publicNamespace.baseInfo.appId}},
Cluster:{{namespace.publicNamespace.baseInfo.clusterName}})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册