Add history api and modify js for tests
All JS Files now call 'requirejs' instead of 'require', also the holder.js reference is removed and the history api added. Tests are following in the next commit refs #4303 refs #4315
This commit is contained in:
parent
ef505ed949
commit
fc4b42e3e0
|
@ -34,14 +34,14 @@
|
||||||
}
|
}
|
||||||
target.focus();
|
target.focus();
|
||||||
this.initializeContainers(target);
|
this.initializeContainers(target);
|
||||||
holder.run();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateControlTargets = function(ctrl, req) {
|
this.updateControlTargets = function(ctrl, req) {
|
||||||
$('a',ctrl).each(function() {
|
$('a',ctrl).each(function() {
|
||||||
$(this).attr("href",req.url);
|
$(this).attr("href",req.url);
|
||||||
});
|
});
|
||||||
holder.run();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.initControlBehaviour = function(root) {
|
this.initControlBehaviour = function(root) {
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
this.initExpandables(root);
|
this.initExpandables(root);
|
||||||
this.drawImplicitWidgets(root);
|
this.drawImplicitWidgets(root);
|
||||||
this.loadAsyncContainers(root);
|
this.loadAsyncContainers(root);
|
||||||
holder.run();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createPopupContainer = function(content,req) {
|
this.createPopupContainer = function(content,req) {
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
.append($("<div>").addClass('modal-body').html(content)).appendTo(document.body);
|
.append($("<div>").addClass('modal-body').html(content)).appendTo(document.body);
|
||||||
|
|
||||||
closeButton.on("click",function() {container.remove();});
|
closeButton.on("click",function() {container.remove();});
|
||||||
holder.run();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getContainer = function(id) {
|
this.getContainer = function(id) {
|
||||||
|
@ -104,11 +104,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
define(['jquery','logging','icinga/widgets/checkIcons','icinga/widgets/subTable','Holder'],function($,log,widgets,subTable,holder) {
|
define(['jquery','logging','icinga/widgets/checkIcons','icinga/widgets/subTable'], function($,log,widgets,subTable) {
|
||||||
if (containerMgrInstance === null) {
|
if (containerMgrInstance === null) {
|
||||||
containerMgrInstance = new ContainerMgr($,log,widgets,subTable,holder);
|
containerMgrInstance = new ContainerMgr($,log,widgets,subTable);
|
||||||
}
|
}
|
||||||
return containerMgrInstance;
|
return containerMgrInstance;
|
||||||
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -67,7 +67,13 @@ define([
|
||||||
loadIntoContainer: function(ctr) {
|
loadIntoContainer: function(ctr) {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
loadUrl: function(url, target, params) {
|
||||||
|
target = target || "icinga-main";
|
||||||
|
async.loadToTarget(target, url, params);
|
||||||
|
History.pushState(params, document.title, url);
|
||||||
|
},
|
||||||
|
|
||||||
getFailedModules: function() {
|
getFailedModules: function() {
|
||||||
return failedModules;
|
return failedModules;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var asyncMgrInstance = null;
|
var asyncMgrInstance = null;
|
||||||
|
|
||||||
define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) {
|
define(['icinga/container','logging','jquery'],function(containerMgr,log,$) {
|
||||||
|
|
||||||
|
|
||||||
var pending = {
|
var pending = {
|
||||||
|
@ -21,7 +21,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleResponse = function(html) {
|
var handleResponse = function(html) {
|
||||||
|
|
||||||
if(this.destination) {
|
if(this.destination) {
|
||||||
containerMgr.updateContainer(this.destination,html,this);
|
containerMgr.updateContainer(this.destination,html,this);
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +93,13 @@
|
||||||
});
|
});
|
||||||
req.destination = destination;
|
req.destination = destination;
|
||||||
}
|
}
|
||||||
|
if (destination == "icinga-main") {
|
||||||
|
History.pushState(data, document.title, url);
|
||||||
|
} else {
|
||||||
|
data = data || {};
|
||||||
|
data[destination] = url;
|
||||||
|
History.pushState(data, document.title, document.location.href);
|
||||||
|
}
|
||||||
return req;
|
return req;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -106,4 +111,4 @@
|
||||||
return new CallInterface();
|
return new CallInterface();
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue