From 42085912d3b16a9e84dc761a4e0dcdd187512e52 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Fri, 8 Sep 2017 22:21:14 +0200 Subject: [PATCH] formatting --- frontend-js/src/main/js/GuiConnector.js | 55 +- frontend-js/src/main/js/ServerConnector.js | 648 ++++++++++----------- 2 files changed, 352 insertions(+), 351 deletions(-) diff --git a/frontend-js/src/main/js/GuiConnector.js b/frontend-js/src/main/js/GuiConnector.js index 296b0bf84f..99f046913d 100644 --- a/frontend-js/src/main/js/GuiConnector.js +++ b/frontend-js/src/main/js/GuiConnector.js @@ -26,11 +26,11 @@ GuiConnector.yPos = 0; * List of GET params passed via url. */ -GuiConnector.init = function() { +GuiConnector.init = function () { var self = this; if (!String.prototype.endsWith) { - String.prototype.endsWith = function(pattern) { + String.prototype.endsWith = function (pattern) { var d = this.length - pattern.length; return d >= 0 && this.lastIndexOf(pattern) === d; }; @@ -41,7 +41,7 @@ GuiConnector.init = function() { alert("This webpage works well with Chrome, Firefox and Safari."); } // bootstrap tab initialization - $("ul.nav-tabs a").click(function(e) { + $("ul.nav-tabs a").click(function (e) { e.preventDefault(); $(this).tab('show'); }); @@ -49,16 +49,17 @@ GuiConnector.init = function() { self.getParams = []; // find GuiConnector.getParams - window.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function() { + window.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () { function decode(s) { return decodeURIComponent(s.split("+").join(" ")); } + GuiConnector.getParams[decode(arguments[1])] = decode(arguments[2]); }); // forser browser to update mouse coordinates whenever mouse move - jQuery(document).ready(function() { - $(document).mousemove(function(e) { + jQuery(document).ready(function () { + $(document).mousemove(function (e) { GuiConnector.updateMouseCoordinates(e.pageX, e.pageY); }); }); @@ -70,7 +71,7 @@ GuiConnector.init = function() { self.addWindowResizeEvent(window.onresize); } - window.onresize = function() { + window.onresize = function () { for (var i = 0; i < self._windowResizeEvents.length; i++) { self._windowResizeEvents[i](); } @@ -78,18 +79,18 @@ GuiConnector.init = function() { } }; -GuiConnector.addWindowResizeEvent = function(handler) { +GuiConnector.addWindowResizeEvent = function (handler) { this._windowResizeEvents.push(handler); }; /** * Returns name of the file with LCSB logo. - * + * * @param bigLogo * {@link Boolean} value determining if we want to have big logo or * small one */ -GuiConnector.getLcsbLogoImg = function(bigLogo) { +GuiConnector.getLcsbLogoImg = function (bigLogo) { if (bigLogo) { return 'lcsb_logo_mid.png'; } else { @@ -101,26 +102,26 @@ GuiConnector.getLcsbLogoImg = function(bigLogo) { * Returns name of the file with image that should be presented when we are * wainting for data to be loaded. */ -GuiConnector.getLoadingImg = function() { +GuiConnector.getLoadingImg = function () { return "icons/ajax-loader.gif"; }; /** * Returns home directory for images in the application. */ -GuiConnector.getImgPrefix = function() { +GuiConnector.getImgPrefix = function () { return "resources/images/"; }; /** * Updates coordinates of the mouse in the browser. */ -GuiConnector.updateMouseCoordinates = function(x, y) { +GuiConnector.updateMouseCoordinates = function (x, y) { this.xPos = x; this.yPos = y; }; -GuiConnector.showProcessing = function(messageText) { +GuiConnector.showProcessing = function (messageText) { var self = GuiConnector; if (self._processingDialog === undefined) { self._processingDialog = document.createElement("div"); @@ -128,11 +129,11 @@ GuiConnector.showProcessing = function(messageText) { self._processingDialog.appendChild(self._errorDialogContent); document.body.appendChild(self._processingDialog); $(self._processingDialog).dialog({ - modal : true, - title : "PROCESSING", - width : "150px", - closeOnEscape : false, - open : function(event, ui) { + modal: true, + title: "PROCESSING", + width: "150px", + closeOnEscape: false, + open: function (event, ui) { $(".ui-dialog-titlebar-close", ui).hide(); }, }); @@ -141,8 +142,8 @@ GuiConnector.showProcessing = function(messageText) { messageText = "PROCESSING"; } var messageImg = Functions.createElement({ - type : "img", - src : 'resources/images/icons/ajax-loader.gif', + type: "img", + src: 'resources/images/icons/ajax-loader.gif', }); self._errorDialogContent.innerHTML = ""; self._errorDialogContent.style.textAlign = "center"; @@ -153,12 +154,12 @@ GuiConnector.showProcessing = function(messageText) { $(self._processingDialog).dialog("open"); }; -GuiConnector.hideProcessing = function() { +GuiConnector.hideProcessing = function () { var self = GuiConnector; $(self._processingDialog).dialog("close"); }; -GuiConnector.alert = function(error) { +GuiConnector.alert = function (error) { var self = GuiConnector; logger.error(error); if (self._errorDialog === undefined) { @@ -167,11 +168,11 @@ GuiConnector.alert = function(error) { self._errorDialog.appendChild(self._errorDialogContent); document.body.appendChild(self._errorDialog); $(self._errorDialog).dialog({ - classes : { - "ui-dialog" : "ui-state-error" + classes: { + "ui-dialog": "ui-state-error" }, - modal : true, - title : "ERROR" + modal: true, + title: "ERROR" }).siblings('.ui-dialog-titlebar').css("background", "red"); } var message = error; diff --git a/frontend-js/src/main/js/ServerConnector.js b/frontend-js/src/main/js/ServerConnector.js index 0720a22019..ab73b954a2 100644 --- a/frontend-js/src/main/js/ServerConnector.js +++ b/frontend-js/src/main/js/ServerConnector.js @@ -45,13 +45,13 @@ ServerConnector.registerListenerType("onDataLoadStop"); ServerConnector._configurationParam = []; -ServerConnector.getMinOverlayColorInt = function() { +ServerConnector.getMinOverlayColorInt = function () { var self = this; var userColor; - return self.getLoggedUser().then(function(user) { + return self.getLoggedUser().then(function (user) { userColor = user.getMinColor(); return self.getConfigurationParam(ConfigurationType.MIN_COLOR_VAL); - }).then(function(systemMinColor) { + }).then(function (systemMinColor) { var color = userColor; if (userColor === null || userColor === undefined || userColor === "") { color = systemMinColor; @@ -63,13 +63,13 @@ ServerConnector.getMinOverlayColorInt = function() { }); }; -ServerConnector.getSimpleOverlayColorInt = function() { +ServerConnector.getSimpleOverlayColorInt = function () { var self = this; var userColor; - return self.getLoggedUser().then(function(user) { + return self.getLoggedUser().then(function (user) { userColor = user.getSimpleColor(); return self.getConfigurationParam(ConfigurationType.SIMPLE_COLOR_VAL); - }).then(function(systemSimpleColor) { + }).then(function (systemSimpleColor) { var color = userColor; if (userColor === null || userColor === undefined || userColor === "") { color = systemSimpleColor; @@ -81,13 +81,13 @@ ServerConnector.getSimpleOverlayColorInt = function() { }); }; -ServerConnector.getMaxOverlayColorInt = function() { +ServerConnector.getMaxOverlayColorInt = function () { var self = this; var userColor; - return self.getLoggedUser().then(function(user) { + return self.getLoggedUser().then(function (user) { userColor = user.getMaxColor(); return self.getConfigurationParam(ConfigurationType.MAX_COLOR_VAL); - }).then(function(systemMaxColor) { + }).then(function (systemMaxColor) { var color = userColor; if (userColor === null || userColor === undefined || userColor === "") { color = systemMaxColor; @@ -99,7 +99,7 @@ ServerConnector.getMaxOverlayColorInt = function() { }); }; -ServerConnector.readFile = function(url, description) { +ServerConnector.readFile = function (url, description) { var self = this; if (self.getSessionData().getToken() === undefined) { @@ -111,30 +111,30 @@ ServerConnector.readFile = function(url, description) { description = url; } var content; - return self.callListeners("onDataLoadStart", description).then(function() { + return self.callListeners("onDataLoadStart", description).then(function () { return self._readFile(url); - }).then(function(result) { + }).then(function (result) { content = result; return self.callListeners("onDataLoadStop", description); - }, function(error) { - return self.callListeners("onDataLoadStop", description).then(function() { + }, function (error) { + return self.callListeners("onDataLoadStop", description).then(function () { return Promise.reject(error); }); - }).then(function() { + }).then(function () { return content; }); }; -ServerConnector._readFile = function(url) { - return new Promise(function(resolve, reject) { - request.get(url, function(error, response, body) { +ServerConnector._readFile = function (url) { + return new Promise(function (resolve, reject) { + request.get(url, function (error, response, body) { if (error) { reject(error); } else if (response.statusCode !== 200) { reject(new NetworkError(url + " rejected with status code: " + response.statusCode, { - content : body, - url : url, - statusCode : response.statusCode + content: body, + url: url, + statusCode: response.statusCode })); } else { resolve(body); @@ -143,28 +143,28 @@ ServerConnector._readFile = function(url) { }); }; -ServerConnector.sendPostRequest = function(url, params) { +ServerConnector.sendPostRequest = function (url, params) { var self = this; if (self.getSessionData().getToken() === undefined) { self.getSessionData().setLogin(undefined); window.location.reload(false); } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { request.post({ - url : url, - form : params - }, function(error, response, body) { + url: url, + form: params + }, function (error, response, body) { if (error) { reject(new NetworkError(error, { - content : body, - url : url + content: body, + url: url })); } else if (response.statusCode !== 200) { reject(new NetworkError(url + " rejected with status code: " + response.statusCode, { - content : body, - url : url, - statusCode : response.statusCode + content: body, + url: url, + statusCode: response.statusCode })); } else { resolve(body); @@ -173,17 +173,17 @@ ServerConnector.sendPostRequest = function(url, params) { }); }; -ServerConnector.sendPutRequest = function(url, params) { +ServerConnector.sendPutRequest = function (url, params) { var self = this; if (self.getSessionData().getToken() === undefined) { self.getSessionData().setLogin(undefined); window.location.reload(false); } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { request.put({ - url : url, - form : params - }, function(error, response, body) { + url: url, + form: params + }, function (error, response, body) { if (error) { reject(error); } else if (response.statusCode !== 200) { @@ -195,18 +195,18 @@ ServerConnector.sendPutRequest = function(url, params) { }); }; -ServerConnector.sendDeleteRequest = function(url, params) { +ServerConnector.sendDeleteRequest = function (url, params) { var self = this; if (self.getSessionData().getToken() === undefined) { self.getSessionData().setLogin(undefined); window.location.reload(false); } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { request({ - method : "DELETE", - url : url, - json : params, - }, function(error, response, body) { + method: "DELETE", + url: url, + json: params, + }, function (error, response, body) { if (error) { reject(error); } else if (response.statusCode !== 200) { @@ -218,18 +218,18 @@ ServerConnector.sendDeleteRequest = function(url, params) { }); }; -ServerConnector.sendPatchRequest = function(url, params) { +ServerConnector.sendPatchRequest = function (url, params) { var self = this; if (self.getSessionData().getToken() === undefined) { self.getSessionData().setLogin(undefined); window.location.reload(false); } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { request({ - method : "PATCH", - url : url, - json : params, - }, function(error, response, body) { + method: "PATCH", + url: url, + json: params, + }, function (error, response, body) { if (error) { reject(error); } else if (response.statusCode !== 200) { @@ -241,7 +241,7 @@ ServerConnector.sendPatchRequest = function(url, params) { }); }; -ServerConnector.getToken = function(token) { +ServerConnector.getToken = function (token) { if (token !== undefined) { return Promise.resolve(token); } @@ -255,10 +255,10 @@ ServerConnector.getToken = function(token) { // using current token if (self.getSessionData().getProject() === null) { return self.getConfiguration({ - token : token - }).then(function() { + token: token + }).then(function () { return token; - }, function() { + }, function () { return self.login(); }); } else { @@ -267,11 +267,11 @@ ServerConnector.getToken = function(token) { } }; -ServerConnector.getApiBaseUrl = function() { +ServerConnector.getApiBaseUrl = function () { return this.getServerBaseUrl() + "/api/"; }; -ServerConnector.getServerBaseUrl = function() { +ServerConnector.getServerBaseUrl = function () { if (this._serverBaseUrl === undefined) { var url = "" + window.location.href; if (!url.endsWith("/")) { @@ -282,7 +282,7 @@ ServerConnector.getServerBaseUrl = function() { return this._serverBaseUrl; }; -ServerConnector.createGetParams = function(params, prefix) { +ServerConnector.createGetParams = function (params, prefix) { var sorted = [], key; for (key in params) { @@ -318,7 +318,7 @@ ServerConnector.createGetParams = function(params, prefix) { return result; }; -ServerConnector.getApiUrl = function(paramObj) { +ServerConnector.getApiUrl = function (paramObj) { var type = paramObj.type; var method = paramObj.method; var params = this.createGetParams(paramObj.params); @@ -336,85 +336,85 @@ ServerConnector.getApiUrl = function(paramObj) { return result; }; -ServerConnector.getProjectsUrl = function(queryParams, filterParams) { +ServerConnector.getProjectsUrl = function (queryParams, filterParams) { return this.getApiUrl({ - type : "projects/" + queryParams.projectId + "/", - params : filterParams, + type: "projects/" + queryParams.projectId + "/", + params: filterParams, }); }; -ServerConnector.getProjectStatisticsUrl = function(queryParams, filterParams) { +ServerConnector.getProjectStatisticsUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "statistics/", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "statistics/", + params: filterParams, }); }; -ServerConnector.getPublicationsUrl = function(queryParams, filterParams) { +ServerConnector.getPublicationsUrl = function (queryParams, filterParams) { filterParams.start = filterParams.start || 0; filterParams.length = filterParams.length || 10; return this.getApiUrl({ - url : this.getModelsUrl(queryParams) + "publications/", - params : filterParams, + url: this.getModelsUrl(queryParams) + "publications/", + params: filterParams, }); }; -ServerConnector.getReferenceGenomeUrl = function(queryParams, filterParams) { +ServerConnector.getReferenceGenomeUrl = function (queryParams, filterParams) { var version = this.getIdOrAsterisk(queryParams.version); return this.getApiUrl({ - type : "genomics/taxonomies/" + queryParams.organism + "/genomeTypes/" + queryParams.type + "/versions/" + version - + "/", - params : filterParams + type: "genomics/taxonomies/" + queryParams.organism + "/genomeTypes/" + queryParams.type + "/versions/" + version + + "/", + params: filterParams }); }; -ServerConnector.loginUrl = function() { +ServerConnector.loginUrl = function () { return this.getApiUrl({ - type : "/doLogin", + type: "/doLogin", }); }; -ServerConnector.getSuggestedQueryListUrl = function(queryParams, filterParams) { +ServerConnector.getSuggestedQueryListUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getBioEntitiesUrl(queryParams) + "suggestedQueryList/", - params : filterParams, + url: this.getBioEntitiesUrl(queryParams) + "suggestedQueryList/", + params: filterParams, }); }; -ServerConnector.addCommentUrl = function(queryParams) { +ServerConnector.addCommentUrl = function (queryParams) { return this.getApiUrl({ - url : this.getCommentsUrl(queryParams) + url: this.getCommentsUrl(queryParams) }); }; -ServerConnector.addOverlayUrl = function(queryParams) { +ServerConnector.addOverlayUrl = function (queryParams) { return this.getApiUrl({ - url : this.getOverlaysUrl(queryParams) + url: this.getOverlaysUrl(queryParams) }); }; -ServerConnector.updateOverlayUrl = function(queryParams) { +ServerConnector.updateOverlayUrl = function (queryParams) { return this.getApiUrl({ - url : this.getOverlayByIdUrl(queryParams) + url: this.getOverlayByIdUrl(queryParams) }); }; -ServerConnector.deleteOverlayUrl = function(queryParams) { +ServerConnector.deleteOverlayUrl = function (queryParams) { return this.getApiUrl({ - url : this.getOverlayByIdUrl(queryParams), + url: this.getOverlayByIdUrl(queryParams), }); }; -ServerConnector.getOverlaysUrl = function(queryParams, filterParams) { +ServerConnector.getOverlaysUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "overlays/", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "overlays/", + params: filterParams, }); }; -ServerConnector.getCommentsUrl = function(queryParams, filterParams) { +ServerConnector.getCommentsUrl = function (queryParams, filterParams) { var modelId = this.getIdOrAsterisk(queryParams.modelId); var url = this.getProjectsUrl(queryParams) + "comments/models/" + modelId + "/"; if (queryParams.elementType !== undefined) { @@ -429,41 +429,41 @@ ServerConnector.getCommentsUrl = function(queryParams, filterParams) { } } return this.getApiUrl({ - url : url, - params : filterParams, + url: url, + params: filterParams, }); }; -ServerConnector.getOverlayByIdUrl = function(queryParams, filterParams) { +ServerConnector.getOverlayByIdUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getOverlaysUrl(queryParams) + queryParams.overlayId + "/", - params : filterParams, + url: this.getOverlaysUrl(queryParams) + queryParams.overlayId + "/", + params: filterParams, }); }; -ServerConnector.getOverlayElementsUrl = function(queryParams, filterParams) { +ServerConnector.getOverlayElementsUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getModelsUrl(queryParams) + "bioEntities/", - params : filterParams, + url: this.getModelsUrl(queryParams) + "bioEntities/", + params: filterParams, }); }; -ServerConnector.getFullOverlayElementUrl = function(queryParams, filterParams) { +ServerConnector.getFullOverlayElementUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getAliasesUrl(queryParams) + queryParams.id + "/", - params : filterParams, + url: this.getAliasesUrl(queryParams) + queryParams.id + "/", + params: filterParams, }); }; -ServerConnector.idsToString = function(ids) { +ServerConnector.idsToString = function (ids) { var result = ""; if (ids !== undefined) { - ids.sort(function(a, b) { + ids.sort(function (a, b) { return a - b; }); for (var i = 0; i < ids.length; i++) { @@ -479,18 +479,18 @@ ServerConnector.idsToString = function(ids) { return result; }; -ServerConnector.pointToString = function(point) { +ServerConnector.pointToString = function (point) { return point.x.toFixed(2) + "," + point.y.toFixed(2); }; -ServerConnector.columnsToString = function(columns) { +ServerConnector.columnsToString = function (columns) { if (columns === undefined) { return ""; } return columns; }; -ServerConnector.getModelsUrl = function(queryParams) { +ServerConnector.getModelsUrl = function (queryParams) { var modelId = this.getIdOrAsterisk(queryParams.modelId); var overlayId = queryParams.overlayId; var url = this.getProjectsUrl(queryParams); @@ -499,17 +499,17 @@ ServerConnector.getModelsUrl = function(queryParams) { } return this.getApiUrl({ - url : url + "models/" + modelId + "/", + url: url + "models/" + modelId + "/", }); }; -ServerConnector.getBioEntitiesUrl = function(queryParams) { +ServerConnector.getBioEntitiesUrl = function (queryParams) { return this.getApiUrl({ - url : this.getModelsUrl(queryParams) + "bioEntities/", + url: this.getModelsUrl(queryParams) + "bioEntities/", }); }; -ServerConnector.getIdOrAsterisk = function(id) { +ServerConnector.getIdOrAsterisk = function (id) { if (id === undefined || id === "" || id === null) { return "*"; } else { @@ -517,99 +517,99 @@ ServerConnector.getIdOrAsterisk = function(id) { } }; -ServerConnector.getReactionsUrl = function(queryParams, filterParams) { +ServerConnector.getReactionsUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getBioEntitiesUrl(queryParams) + "reactions/", - params : filterParams, + url: this.getBioEntitiesUrl(queryParams) + "reactions/", + params: filterParams, }); }; -ServerConnector.getAliasesUrl = function(queryParams, filterParams) { +ServerConnector.getAliasesUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getBioEntitiesUrl(queryParams) + "elements/", - params : filterParams, + url: this.getBioEntitiesUrl(queryParams) + "elements/", + params: filterParams, }); }; -ServerConnector.getConfigurationUrl = function(queryParams, filterParams) { +ServerConnector.getConfigurationUrl = function (queryParams, filterParams) { var result = this.getApiUrl({ - type : "configuration/", - params : filterParams + type: "configuration/", + params: filterParams }); return result; }; -ServerConnector.getSearchUrl = function(queryParams, filterParams) { +ServerConnector.getSearchUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getModelsUrl(queryParams) + "bioEntities:search", - params : filterParams, + url: this.getModelsUrl(queryParams) + "bioEntities:search", + params: filterParams, }); }; -ServerConnector.getSearchDrugsUrl = function(queryParams, filterParams) { +ServerConnector.getSearchDrugsUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "drugs:search", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "drugs:search", + params: filterParams, }); }; -ServerConnector.getSearchMiRnasUrl = function(queryParams, filterParams) { +ServerConnector.getSearchMiRnasUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "miRnas:search", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "miRnas:search", + params: filterParams, }); }; -ServerConnector.getSearchChemicalsUrl = function(queryParams, filterParams) { +ServerConnector.getSearchChemicalsUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "chemicals:search", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "chemicals:search", + params: filterParams, }); }; -ServerConnector.getOverlaySourceUrl = function(queryParams, filterParams) { +ServerConnector.getOverlaySourceUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getOverlaysUrl(queryParams) + queryParams.overlayId + ":downloadSource", - params : filterParams + url: this.getOverlaysUrl(queryParams) + queryParams.overlayId + ":downloadSource", + params: filterParams }); }; -ServerConnector.getImageUrl = function(queryParams, filterParams) { +ServerConnector.getImageUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "models/" + queryParams.modelId + ":downloadImage", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "models/" + queryParams.modelId + ":downloadImage", + params: filterParams, }); }; -ServerConnector.getModelPartUrl = function(queryParams, filterParams) { +ServerConnector.getModelPartUrl = function (queryParams, filterParams) { return this.getApiUrl({ - url : this.getProjectsUrl(queryParams) + "models/" + queryParams.modelId + ":downloadModel", - params : filterParams, + url: this.getProjectsUrl(queryParams) + "models/" + queryParams.modelId + ":downloadModel", + params: filterParams, }); }; -ServerConnector.getProjectSourceUrl = function(queryParams, filterParams) { +ServerConnector.getProjectSourceUrl = function (queryParams, filterParams) { return this.getApiUrl({ - type : "projects/" + queryParams.projectId + ":downloadSource", - params : filterParams + type: "projects/" + queryParams.projectId + ":downloadSource", + params: filterParams }); }; -ServerConnector.getUserUrl = function(queryParams, filterParams) { +ServerConnector.getUserUrl = function (queryParams, filterParams) { return this.getApiUrl({ - type : "users/", - method : queryParams.login, - params : filterParams, + type: "users/", + method: queryParams.login, + params: filterParams, }); }; -ServerConnector.getConfiguration = function(params) { +ServerConnector.getConfiguration = function (params) { if (params === undefined) { params = {}; } var self = this; if (this._configuration === undefined) { - return self.readFile(self.getConfigurationUrl()).then(function(content) { + return self.readFile(self.getConfigurationUrl()).then(function (content) { self._configuration = new Configuration(JSON.parse(content)); return Promise.resolve(self._configuration); }); @@ -618,22 +618,22 @@ ServerConnector.getConfiguration = function(params) { } }; -ServerConnector.getConfigurationParam = function(paramId) { +ServerConnector.getConfigurationParam = function (paramId) { var self = this; - return self.getConfiguration().then(function(configuration) { + return self.getConfiguration().then(function (configuration) { return configuration.getOption(paramId); }); }; -ServerConnector.getModels = function(projectId) { +ServerConnector.getModels = function (projectId) { var queryParams = {}; var filterParams = {}; var project; var self = this; - return self.getProjectId(projectId).then(function(result) { + return self.getProjectId(projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getModelsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var models = []; var parsedJson = JSON.parse(content); for (var i = 0; i < parsedJson.length; i++) { @@ -642,32 +642,32 @@ ServerConnector.getModels = function(projectId) { return models; }); }; -ServerConnector.getProject = function(projectId) { +ServerConnector.getProject = function (projectId) { var queryParams = {}; var filterParams = {}; var project; var self = this; - return self.getProjectId(projectId).then(function(result) { + return self.getProjectId(projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getProjectsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { project = new Project(content); return self.getModels(projectId); - }).then(function(models) { + }).then(function (models) { project.setModel(models[0]); return self.getOverlays(projectId); - }).then(function(overlays) { + }).then(function (overlays) { project.getModel().addLayouts(overlays); return project; - }).then(null, function(error) { + }).then(null, function (error) { if ((error instanceof NetworkError)) { switch (error.statusCode) { - case HttpStatus.NOT_FOUND: - return null; - case HttpStatus.FORBIDDEN: - return Promise.reject(new SecurityError("Access denied.")); - default: - return Promise.reject(error); + case HttpStatus.NOT_FOUND: + return null; + case HttpStatus.FORBIDDEN: + return Promise.reject(new SecurityError("Access denied.")); + default: + return Promise.reject(error); } } else { return Promise.reject(error); @@ -675,56 +675,56 @@ ServerConnector.getProject = function(projectId) { }); }; -ServerConnector.getProjectStatistics = function(projectId) { +ServerConnector.getProjectStatistics = function (projectId) { var queryParams = {}; var filterParams = {}; var self = this; var content; - return self.getProjectId(projectId).then(function(result) { + return self.getProjectId(projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getProjectStatisticsUrl(queryParams, filterParams)); - }).then(function(result) { + }).then(function (result) { content = JSON.parse(result); return self.getConfiguration(); - }).then(function(configuration) { + }).then(function (configuration) { return new ProjectStatistics(content, configuration); }); }; -ServerConnector.getLoggedUser = function() { +ServerConnector.getLoggedUser = function () { var self = this; if (self._loggedUser !== undefined) { return Promise.resolve(self._loggedUser); } else { - return self.getUser(self.getSessionData().getLogin()).then(function(user) { + return self.getUser(self.getSessionData().getLogin()).then(function (user) { self._loggedUser = user; return self._loggedUser; }); } }; -ServerConnector.getUser = function(login) { +ServerConnector.getUser = function (login) { var self = this; var queryParams = { - login : login, + login: login, }; var filterParams = {}; - return self.readFile(self.getUserUrl(queryParams, filterParams)).then(function(content) { + return self.readFile(self.getUserUrl(queryParams, filterParams)).then(function (content) { var obj = JSON.parse(content); return new User(obj); }); }; -ServerConnector.getOverlays = function(projectId) { +ServerConnector.getOverlays = function (projectId) { var self = this; var queryParams = {}; var filterParams = {}; - return new Promise(function(resolve, reject) { - self.getProjectId(projectId).then(function(result) { + return new Promise(function (resolve, reject) { + self.getProjectId(projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getOverlaysUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var arr = JSON.parse(content); var result = []; for (var i = 0; i < arr.length; i++) { @@ -736,20 +736,20 @@ ServerConnector.getOverlays = function(projectId) { }); }; -ServerConnector.getOverlayElements = function(overlayId, projectId) { +ServerConnector.getOverlayElements = function (overlayId, projectId) { var self = this; if (overlayId === undefined) { throw new Error("Layout id must be defined"); } var queryParams = { - overlayId : overlayId, - modelId : "*", + overlayId: overlayId, + modelId: "*", }; var filterParams = {}; - return self.getProjectId(projectId).then(function(result) { + return self.getProjectId(projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getOverlayElementsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var arr = JSON.parse(content); var result = []; for (var i = 0; i < arr.length; i++) { @@ -766,20 +766,20 @@ ServerConnector.getOverlayElements = function(overlayId, projectId) { }); }; -ServerConnector.getFullOverlayElement = function(params) { +ServerConnector.getFullOverlayElement = function (params) { var self = this; var queryParams = { - overlayId : params.overlay.getId(), - modelId : params.element.getModelId(), - id : params.element.getId(), + overlayId: params.overlay.getId(), + modelId: params.element.getModelId(), + id: params.element.getId(), }; var filterParams = {}; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getFullOverlayElementUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var element = JSON.parse(content); var result = null; if (element.type === "REACTION") { @@ -793,7 +793,7 @@ ServerConnector.getFullOverlayElement = function(params) { }); }; -ServerConnector.getProjectId = function(projectId) { +ServerConnector.getProjectId = function (projectId) { var self = this; if (projectId !== undefined && projectId !== null && projectId !== "") { return Promise.resolve(projectId); @@ -804,33 +804,33 @@ ServerConnector.getProjectId = function(projectId) { } }; -ServerConnector.getLogoImg = function() { +ServerConnector.getLogoImg = function () { return this.getConfigurationParam(ConfigurationType.LOGO_IMG); }; -ServerConnector.getLogoLink = function() { +ServerConnector.getLogoLink = function () { return this.getConfigurationParam(ConfigurationType.LOGO_LINK); }; -ServerConnector.getMaxSearchDistance = function() { +ServerConnector.getMaxSearchDistance = function () { return this.getConfigurationParam(ConfigurationType.SEARCH_DISTANCE); }; -ServerConnector.getOverlayById = function(overlayId, projectId) { +ServerConnector.getOverlayById = function (overlayId, projectId) { var self = this; var queryParams = { - overlayId : overlayId + overlayId: overlayId }; var filterParams = {}; - return self.getProjectId(projectId).then(function(data) { + return self.getProjectId(projectId).then(function (data) { queryParams.projectId = data; return self.readFile(self.getOverlayByIdUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { return new LayoutData(JSON.parse(content)); }); }; -ServerConnector.getReactions = function(params) { +ServerConnector.getReactions = function (params) { var self = this; var queryParams = {}; if (params.ids === undefined) { @@ -840,11 +840,11 @@ ServerConnector.getReactions = function(params) { params.participantId = []; } var filterParams = { - id : params.ids, - columns : params.columns, - participantId : params.participantId, + id: params.ids, + columns: params.columns, + participantId: params.participantId, }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; if (filterParams.id.length > 100 || filterParams.participantId.length > 100) { return self.sendPostRequest(self.getReactionsUrl(queryParams), filterParams); @@ -852,7 +852,7 @@ ServerConnector.getReactions = function(params) { return self.readFile(self.getReactionsUrl(queryParams, filterParams)); } - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -862,10 +862,10 @@ ServerConnector.getReactions = function(params) { }); }; -ServerConnector.getAliases = function(params) { +ServerConnector.getAliases = function (params) { var self = this; var queryParams = { - modelId : params.modelId, + modelId: params.modelId, }; if (params.ids === undefined) { params.ids = []; @@ -877,21 +877,21 @@ ServerConnector.getAliases = function(params) { params.excludedCompartmentIds = []; } var filterParams = { - id : params.ids, - columns : params.columns, - type : params.type, - excludedCompartmentIds : params.excludedCompartmentIds, - includedCompartmentIds : params.includedCompartmentIds, + id: params.ids, + columns: params.columns, + type: params.type, + excludedCompartmentIds: params.excludedCompartmentIds, + includedCompartmentIds: params.includedCompartmentIds, }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; if (filterParams.id.length > 100) { return self.sendPostRequest(self.getAliasesUrl(queryParams), filterParams); } else { return self.readFile(self.getAliasesUrl(queryParams, filterParams)); } - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -901,25 +901,25 @@ ServerConnector.getAliases = function(params) { }); }; -ServerConnector.getLightComments = function(params) { - params.columns = [ "id", "elementId", "modelId", "type", "icon", "removed", "pinned" ]; +ServerConnector.getLightComments = function (params) { + params.columns = ["id", "elementId", "modelId", "type", "icon", "removed", "pinned"]; return this.getComments(params); }; -ServerConnector.getComments = function(params) { +ServerConnector.getComments = function (params) { var self = this; var queryParams = { - elementId : params.elementId, - elementType : params.elementType, - coordinates : params.coordinates, + elementId: params.elementId, + elementType: params.elementType, + coordinates: params.coordinates, }; var filterParams = { - columns : params.columns + columns: params.columns }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getCommentsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -929,7 +929,7 @@ ServerConnector.getComments = function(params) { }); }; -ServerConnector.getSessionData = function(project) { +ServerConnector.getSessionData = function (project) { if (this._sessionData === undefined) { this._sessionData = new SessionData(project); } @@ -939,19 +939,19 @@ ServerConnector.getSessionData = function(project) { return this._sessionData; }; -ServerConnector.getClosestElementsByCoordinates = function(params) { +ServerConnector.getClosestElementsByCoordinates = function (params) { var self = this; var queryParams = { - modelId : params.modelId + modelId: params.modelId }; var filterParams = { - coordinates : params.coordinates, - count : params.count, + coordinates: params.coordinates, + count: params.count, }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -961,7 +961,7 @@ ServerConnector.getClosestElementsByCoordinates = function(params) { }); }; -ServerConnector.login = function(login, password) { +ServerConnector.login = function (login, password) { var self = this; var params = {}; if (login !== undefined) { @@ -971,10 +971,10 @@ ServerConnector.login = function(login, password) { params.login = "anonymous"; } self.getSessionData().setToken(""); - return self.sendPostRequest(self.loginUrl(), params).then(function() { + return self.sendPostRequest(self.loginUrl(), params).then(function () { self.getSessionData().setLogin(params.login); return Promise.resolve(self.getSessionData().getToken()); - }, function(error) { + }, function (error) { if (error instanceof NetworkError && error.statusCode === HttpStatus.FORBIDDEN) { throw new InvalidCredentialsError("Invalid credentials"); } else { @@ -983,27 +983,27 @@ ServerConnector.login = function(login, password) { }); }; -ServerConnector.logout = function() { +ServerConnector.logout = function () { var self = this; self.getSessionData().setToken(undefined); self.getSessionData().setLogin(undefined); return Promise.resolve(); }; -ServerConnector.getElementsByQuery = function(params) { +ServerConnector.getElementsByQuery = function (params) { var self = this; var queryParams = { - modelId : params.modelId + modelId: params.modelId }; var filterParams = { - query : params.query, - perfectMatch : params.perfectMatch, + query: params.query, + perfectMatch: params.perfectMatch, }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -1013,16 +1013,16 @@ ServerConnector.getElementsByQuery = function(params) { }); }; -ServerConnector.getDrugsByQuery = function(params) { +ServerConnector.getDrugsByQuery = function (params) { var self = this; var queryParams = {}; var filterParams = { - query : params.query + query: params.query }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchDrugsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -1032,16 +1032,16 @@ ServerConnector.getDrugsByQuery = function(params) { }); }; -ServerConnector.getMiRnasByQuery = function(params) { +ServerConnector.getMiRnasByQuery = function (params) { var self = this; var queryParams = {}; var filterParams = { - query : params.query + query: params.query }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchMiRnasUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -1051,16 +1051,16 @@ ServerConnector.getMiRnasByQuery = function(params) { }); }; -ServerConnector.getChemicalsByQuery = function(params) { +ServerConnector.getChemicalsByQuery = function (params) { var self = this; var queryParams = {}; var filterParams = { - query : params.query + query: params.query }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchChemicalsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var array = JSON.parse(content); var result = []; for (var i = 0; i < array.length; i++) { @@ -1070,96 +1070,96 @@ ServerConnector.getChemicalsByQuery = function(params) { }); }; -ServerConnector.getOverlaySourceDownloadUrl = function(params) { +ServerConnector.getOverlaySourceDownloadUrl = function (params) { var self = this; var queryParams = { - overlayId : params.overlayId + overlayId: params.overlayId }; var filterParams = {}; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.getOverlaySourceUrl(queryParams, filterParams); }); }; -ServerConnector.getImageDownloadUrl = function(params) { +ServerConnector.getImageDownloadUrl = function (params) { var self = this; var queryParams = { - projectId : params.projectId, - modelId : params.modelId, + projectId: params.projectId, + modelId: params.modelId, }; var filterParams = { - token : params.token, - polygonString : params.polygonString, - handlerClass : params.handlerClass, - backgroundOverlayId : params.backgroundOverlayId, - zoomLevel : params.zoomLevel, - overlayIds : this.idsToString(params.overlayIds), + token: params.token, + polygonString: params.polygonString, + handlerClass: params.handlerClass, + backgroundOverlayId: params.backgroundOverlayId, + zoomLevel: params.zoomLevel, + overlayIds: this.idsToString(params.overlayIds), }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.getImageUrl(queryParams, filterParams); }); }; -ServerConnector.getModelDownloadUrl = function(params) { +ServerConnector.getModelDownloadUrl = function (params) { var self = this; var queryParams = { - projectId : params.projectId, - modelId : params.modelId, + projectId: params.projectId, + modelId: params.modelId, }; var filterParams = { - token : params.token, - polygonString : params.polygonString, - handlerClass : params.handlerClass, - backgroundOverlayId : params.backgroundOverlayId, - zoomLevel : params.zoomLevel, - overlayIds : this.idsToString(params.overlayIds), + token: params.token, + polygonString: params.polygonString, + handlerClass: params.handlerClass, + backgroundOverlayId: params.backgroundOverlayId, + zoomLevel: params.zoomLevel, + overlayIds: this.idsToString(params.overlayIds), }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.getModelPartUrl(queryParams, filterParams); }); }; -ServerConnector.getImageConverters = function() { +ServerConnector.getImageConverters = function () { var self = this; - return self.getConfiguration().then(function(configuration) { + return self.getConfiguration().then(function (configuration) { return configuration.getImageConverters(); }); }; -ServerConnector.getModelConverters = function() { +ServerConnector.getModelConverters = function () { var self = this; - return self.getConfiguration().then(function(configuration) { + return self.getConfiguration().then(function (configuration) { return configuration.getModelConverters(); }); }; -ServerConnector.getProjectSourceDownloadUrl = function(params) { +ServerConnector.getProjectSourceDownloadUrl = function (params) { if (params === undefined) { params = {}; } var queryParams = {}; var filterParams = {}; var self = this; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.getProjectSourceUrl(queryParams, filterParams); }); }; -ServerConnector.getDrugNamesByTarget = function(params) { +ServerConnector.getDrugNamesByTarget = function (params) { var self = this; var queryParams = {}; var filterParams = { - columns : [ "name" ], - target : params.target.getType() + ":" + params.target.getId() + columns: ["name"], + target: params.target.getType() + ":" + params.target.getId() }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchDrugsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var result = []; var object = JSON.parse(content); for (var i = 0; i < object.length; i++) { @@ -1169,17 +1169,17 @@ ServerConnector.getDrugNamesByTarget = function(params) { }); }; -ServerConnector.getMiRnaNamesByTarget = function(params) { +ServerConnector.getMiRnaNamesByTarget = function (params) { var self = this; var queryParams = {}; var filterParams = { - columns : [ "name" ], - target : params.target.getType() + ":" + params.target.getId() + columns: ["name"], + target: params.target.getType() + ":" + params.target.getId() }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchMiRnasUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var result = []; var object = JSON.parse(content); for (var i = 0; i < object.length; i++) { @@ -1189,17 +1189,17 @@ ServerConnector.getMiRnaNamesByTarget = function(params) { }); }; -ServerConnector.getChemicalNamesByTarget = function(params) { +ServerConnector.getChemicalNamesByTarget = function (params) { var self = this; var queryParams = {}; var filterParams = { - columns : [ "name" ], - target : params.target.getType() + ":" + params.target.getId() + columns: ["name"], + target: params.target.getType() + ":" + params.target.getId() }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getSearchChemicalsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { var result = []; var object = JSON.parse(content); for (var i = 0; i < object.length; i++) { @@ -1209,13 +1209,13 @@ ServerConnector.getChemicalNamesByTarget = function(params) { }); }; -ServerConnector.addComment = function(params) { +ServerConnector.addComment = function (params) { var self = this; var queryParams = { - elementId : params.elementId, - elementType : params.elementType, - coordinates : self.pointToString(params.coordinates), - modelId : params.modelId, + elementId: params.elementId, + elementType: params.elementType, + coordinates: self.pointToString(params.coordinates), + modelId: params.modelId, }; var filterParams = params; delete filterParams.elementId; @@ -1226,33 +1226,33 @@ ServerConnector.addComment = function(params) { filterParams.coordinates = self.pointToString(params.coordinates); } delete filterParams.modelId; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.sendPostRequest(self.addCommentUrl(queryParams), filterParams); - }).then(function(content) { + }).then(function (content) { var response = JSON.parse(content); return new Comment(response); }); }; -ServerConnector.addOverlay = function(params) { +ServerConnector.addOverlay = function (params) { var self = this; var queryParams = {}; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.sendPostRequest(self.addOverlayUrl(queryParams), params); - }).then(function(content) { + }).then(function (content) { return new LayoutData(JSON.parse(content)); }); }; -ServerConnector.updateOverlay = function(params) { +ServerConnector.updateOverlay = function (params) { var self = this; var queryParams = { - overlayId : params.overlayId + overlayId: params.overlayId }; var filterParams = { - overlay : {} + overlay: {} }; if (params.name !== undefined) { filterParams.overlay.name = params.name; @@ -1260,44 +1260,44 @@ ServerConnector.updateOverlay = function(params) { if (params.description !== undefined) { filterParams.overlay.description = params.description; } - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.sendPatchRequest(self.updateOverlayUrl(queryParams), filterParams); }); }; -ServerConnector.removeOverlay = function(params) { +ServerConnector.removeOverlay = function (params) { var self = this; var queryParams = { - overlayId : params.overlayId + overlayId: params.overlayId }; var filterParams = {}; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.sendDeleteRequest(self.deleteOverlayUrl(queryParams), filterParams); }); }; -ServerConnector.getSuggestedQueryList = function(projectId) { +ServerConnector.getSuggestedQueryList = function (projectId) { var self = this; - return self.getProjectId(projectId).then(function(result) { + return self.getProjectId(projectId).then(function (result) { projectId = result; return self.readFile(self.getSuggestedQueryListUrl({ - projectId : projectId + projectId: projectId })); - }).then(function(content) { + }).then(function (content) { return JSON.parse(content); }); }; -ServerConnector.getOverlayTypes = function() { +ServerConnector.getOverlayTypes = function () { var self = this; - return self.getConfiguration().then(function(configuration) { + return self.getConfiguration().then(function (configuration) { return configuration.getOverlayTypes(); }); }; -ServerConnector.getPublications = function(params) { +ServerConnector.getPublications = function (params) { var self = this; if (params === undefined) { params = {}; @@ -1305,24 +1305,24 @@ ServerConnector.getPublications = function(params) { var queryParams = {}; var filterParams = { - start : params.start, - length : params.length, - sortColumn : params.sortColumn, - sortOrder : params.sortOrder, - search : params.search, + start: params.start, + length: params.length, + sortColumn: params.sortColumn, + sortOrder: params.sortOrder, + search: params.search, }; - return self.getProjectId(params.projectId).then(function(result) { + return self.getProjectId(params.projectId).then(function (result) { queryParams.projectId = result; return self.readFile(self.getPublicationsUrl(queryParams, filterParams)); - }).then(function(content) { + }).then(function (content) { return JSON.parse(content); }); }; -ServerConnector.getReferenceGenome = function(params) { +ServerConnector.getReferenceGenome = function (params) { var self = this; var filterParams = {}; - return self.readFile(self.getReferenceGenomeUrl(params, filterParams)).then(function(content) { + return self.readFile(self.getReferenceGenomeUrl(params, filterParams)).then(function (content) { return new ReferenceGenome(JSON.parse(content)); }); }; -- GitLab