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

B #3715 stop multiple click to back button (#3779)

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Lobo 2019-09-27 13:07:18 +02:00 committed by Ruben S. Montero
parent af24ab2b23
commit 141b203178
3 changed files with 12 additions and 5 deletions

View File

@ -44,7 +44,7 @@ define(function(require) {
} else {
action = OpenNebulaHelper.action(method);
request = OpenNebulaHelper.request(resource, method, id);
};
}
var reqPath = path ? path : resource.toLowerCase();
var cache_name = params.cache_name ? params.cache_name : resource;

View File

@ -608,7 +608,10 @@ define(function(require) {
// Button to return to the list view from the detailed view
$(document).on("click", "button[href='back']", function(e) {
window.history.back();
if(window.sunstoneNoMultipleRedirects){
window.history.back();
window.sunstoneNoMultipleRedirects = false;
}
e.preventDefault();
});
};
@ -1263,20 +1266,22 @@ define(function(require) {
var _setupNavigoRoutes = function() {
router = new Navigo(null, true);
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+"/(\\w+)"), function(id){
window.sunstoneNoMultipleRedirects = true;
_routerShowElement(this, id);
}.bind(tabName));
router.on(new RegExp("(?:#|/)"+tabName), function(){
window.sunstoneNoMultipleRedirects = true;
_routerShowTab(this);
}.bind(tabName));
}

View File

@ -158,9 +158,11 @@ define(function(require) {
Sunstone.hideFormPanel();
OpenNebulaAction.clear_cache("VM");
Notifier.notifyCustom(Locale.tr("VM created"),
Notifier.notifyCustom(
Locale.tr("VM created"),
Navigation.link(" ID: " + response, "vms-tab", response),
false);
false
);
},
elements: function(opts) {
return Sunstone.getDataTable(TAB_ID).elements(opts);