Skip to content
Snippets Groups Projects
Commit f8abbb3a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when data is loaded from server info icon appears in the client app

parent 98c0b6f4
No related branches found
No related tags found
1 merge request!7Resolve "info about loading data from server"
......@@ -59,26 +59,57 @@ Footer.prototype._createFooterGui = function() {
link.href = ServerConnector.getServerBaseUrl() + "/export.xhtml?id=" + projectId;
self.getElement().appendChild(link);
var loadingDiv = Functions.createElement({
type : "div",
style : "display:none; ",
});
loadingDiv.style.height = "100%";
loadingDiv.style.float = "right";
self.getElement().appendChild(loadingDiv);
var loadingImg = Functions.createElement({
type : "img",
style : "display:none; ",
src : 'resources/images/icons/ajax-loader.gif',
});
loadingImg.style.height = "100%";
loadingImg.style.float = "right";
self.getElement().appendChild(loadingImg);
this.setControlElement(PanelControlElementType.FOOTER_LOADING_DIV, loadingImg);
loadingDiv.appendChild(loadingImg);
this.setControlElement(PanelControlElementType.FOOTER_LOADING_DIV, loadingDiv);
};
Footer.prototype.addLoadMessage = function(message) {
var self = this;
self._loadMessages.push(message);
};
Footer.prototype.removeLoadMessage = function(message) {
var self = this;
var index = self._loadMessages.indexOf(message);
if (index > -1) {
self._loadMessages.splice(index, 1);
} else {
logger.warn("Removing message that is not there: " + message);
}
};
Footer.prototype.init = function() {
var self = this;
return new Promise(function(resolve) {
var div = self.getControlElement(PanelControlElementType.FOOTER_LOADING_DIV);
self._loadMessages = [];
self._onDataLoadStart = function(e) {
logger.debug("Loading started: " + e.arg);
self.addLoadMessage(e.arg);
div.style.display = "block";
div.title = e.arg;
}
self._onDataLoadStop = function(e) {
logger.debug("Loading finished: " + e.arg);
self.removeLoadMessage(e.arg);
if (self._loadMessages.length > 0) {
div.title = self._loadMessages[0];
} else {
div.style.display = "none";
}
}
ServerConnector.addListener("onDataLoadStart", self._onDataLoadStart);
ServerConnector.addListener("onDataLoadStop", self._onDataLoadStop);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment