Commit cac111a4 authored by Jason Song's avatar Jason Song Committed by GitHub

Merge pull request #528 from lepdou/url

append page context info to url
parents 64a609af 71c05229
...@@ -10,7 +10,8 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr ...@@ -10,7 +10,8 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
PermissionService, PermissionService,
AppUtil) { AppUtil) {
var appId = AppUtil.parseParams($location.$$url).appid; var urlParams = AppUtil.parseParams($location.$$url);
var appId = urlParams.appid;
if (!appId) { if (!appId) {
$window.location.href = '/index.html'; $window.location.href = '/index.html';
...@@ -23,12 +24,21 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr ...@@ -23,12 +24,21 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
//load session storage to recovery scene //load session storage to recovery scene
var scene = JSON.parse(sessionStorage.getItem(appId)); var scene = JSON.parse(sessionStorage.getItem(appId));
$rootScope.pageContext = { $rootScope.pageContext = {
appId: appId, appId: appId,
env: scene ? scene.env : '', env: urlParams.env ? urlParams.env : (scene ? scene.env : ''),
clusterName: scene ? scene.cluster : 'default' 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) { UserService.load_user().then(function (result) {
$rootScope.pageContext.userId = result.userId; $rootScope.pageContext.userId = result.userId;
loadAppInfo(); loadAppInfo();
...@@ -211,6 +221,11 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr ...@@ -211,6 +221,11 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
cluster: $rootScope.pageContext.clusterName 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); EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE);
$rootScope.showSideBar = false; $rootScope.showSideBar = false;
} }
...@@ -311,7 +326,6 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr ...@@ -311,7 +326,6 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
$rootScope.viewMode = 1; $rootScope.viewMode = 1;
} }
$rootScope.adaptScreenSize = function () { $rootScope.adaptScreenSize = function () {
if (window.innerWidth <= VIEW_MODE_SWITCH_WIDTH) { if (window.innerWidth <= VIEW_MODE_SWITCH_WIDTH) {
$rootScope.viewMode = 2; $rootScope.viewMode = 2;
...@@ -322,8 +336,8 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr ...@@ -322,8 +336,8 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
}; };
$(window).resize(function(){ $(window).resize(function () {
$scope.$apply(function(){ $scope.$apply(function () {
$rootScope.adaptScreenSize(); $rootScope.adaptScreenSize();
}); });
}); });
......
...@@ -385,7 +385,7 @@ ...@@ -385,7 +385,7 @@
<div class="row"> <div class="row">
<div class="padding-top-5 col-md-4 col-sm-4"> <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> <small>
(AppId:{{namespace.publicNamespace.baseInfo.appId}}, (AppId:{{namespace.publicNamespace.baseInfo.appId}},
Cluster:{{namespace.publicNamespace.baseInfo.clusterName}}) Cluster:{{namespace.publicNamespace.baseInfo.clusterName}})
......
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