1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #5038: fix route new browser tab (#162)

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
(cherry picked from commit cf68d2f2f0c9ace10b4a4f9a76ebeadf41f714d0)
This commit is contained in:
Jorge Miguel Lobo Escalona 2020-08-22 03:56:52 +02:00 committed by Tino Vazquez
parent 5b25744ca3
commit 1dfa4d5ab7
4 changed files with 36 additions and 22 deletions

View File

@ -117,8 +117,8 @@ require.config({
/* Tabs */
"app": {
deps: [
"foundation",
"jquery",
"foundation",
"tabs/provision-tab",
"tabs/dashboard-tab",
"tabs/system-top-tab",
@ -170,7 +170,7 @@ require.config({
/* Foundation */
"foundation": {
deps: ["jquery"]
deps: ["jquery"]
},
//'foundation.core': {
// deps: ['jquery', 'modernizr'],
@ -243,6 +243,12 @@ require.config({
"flot": {
deps: ["jquery"]
},
"flot.navigate": {
deps: ["flot"]
},
"flot.canvas": {
deps: ["flot"]
},
"flot.stack": {
deps: ["flot"]
},

View File

@ -1301,27 +1301,34 @@ define(function(require) {
var _setupNavigoRoutes = function() {
router = new Navigo(null, true);
var routeForm = function(){
if(_getTab() == undefined){
window.sunstoneNoMultipleRedirects = true;
// This will happen if the user opens sunstone directly in a /form url
_showTab(this);
}
};
var routeWithID = function(id){
window.sunstoneNoMultipleRedirects = true;
_routerShowElement(this, id);
};
var routeNormal = function(){
window.sunstoneNoMultipleRedirects = true;
_routerShowTab(this);
};
for (var tabName in SunstoneCfg["tabs"]) {
router.on(new RegExp("(?:#|/)"+tabName+"/form"), function(){
if(_getTab() == undefined){
window.sunstoneNoMultipleRedirects = true;
// This will happen if the user opens sunstone directly in a /form url
_showTab(this);
}
}.bind(tabName));
router.on(new RegExp("(?:#|/)"+tabName+"/form"), routeForm.bind(tabName));
router.on(new RegExp("^"+tabName+"/form"), routeForm.bind(tabName));
router.on(new RegExp("(?:#|/)"+tabName+"/(\\w+)"), function(id){
window.sunstoneNoMultipleRedirects = true;
_routerShowElement(this, id);
}.bind(tabName));
router.on(new RegExp("(?:#|/)"+tabName+"/(\\w+)"), routeWithID.bind(tabName));
router.on(new RegExp("^"+tabName+"/(\\w+)"), routeWithID.bind(tabName));
router.on(new RegExp("(?:#|/)"+tabName), function(){
window.sunstoneNoMultipleRedirects = true;
_routerShowTab(this);
}.bind(tabName));
router.on(new RegExp("(?:#|/)"+tabName), routeNormal.bind(tabName));
router.on(new RegExp("^"+tabName), routeNormal.bind(tabName));
}
router.on(function(){
router.on(function(params){
_routerShowTab(DASHBOARD_TAB_ID);
});

View File

@ -184,10 +184,10 @@ define(function(require) {
element.NAME,
element.CLUSTER_ID.length ? element.CLUSTER_ID : "-",
element.HOST_SHARE.RUNNING_VMS, //rvm
cpuBars.real,
cpuBars.allocated,
memoryBars.real,
memoryBars.allocated,
cpuBars.real||"",
cpuBars.allocated||"",
memoryBars.real||"",
memoryBars.allocated||"",
state,
element.IM_MAD,
element.VM_MAD,

View File

@ -15,6 +15,7 @@
/* -------------------------------------------------------------------------- */
define(function(require) {
require("jquery");
var TemplateHTML = require('hbs!./range-slider/html');
var sliderId = 0;