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

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

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
This commit is contained in:
Jorge Miguel Lobo Escalona 2020-08-22 03:56:52 +02:00 committed by GitHub
parent a91b0a72ca
commit cf68d2f2f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 22 deletions

View File

@ -120,8 +120,8 @@ require.config({
/* Tabs */
"app": {
deps: [
"foundation",
"jquery",
"foundation",
"tabs/provision-tab",
"tabs/dashboard-tab",
"tabs/system-top-tab",
@ -173,7 +173,7 @@ require.config({
/* Foundation */
"foundation": {
deps: ["jquery"]
deps: ["jquery"]
},
//'foundation.core': {
// deps: ['jquery', 'modernizr'],
@ -246,6 +246,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;