From 32c3f552ece41491536a0642910439bdd69a9847 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 24 Sep 2018 13:27:18 +0200 Subject: [PATCH] jsdoc updated --- frontend-js/src/main/js/NetworkError.js | 6 +- frontend-js/src/main/js/ServerConnector.js | 4 +- .../src/main/js/map/data/LayoutAlias.js | 6 +- .../main/js/map/overlay/AbstractDbOverlay.js | 4 +- frontend-js/src/test/js/helper.js | 100 ++++++++++++++++-- 5 files changed, 101 insertions(+), 19 deletions(-) diff --git a/frontend-js/src/main/js/NetworkError.js b/frontend-js/src/main/js/NetworkError.js index 75cbb6f19b..9b44472357 100644 --- a/frontend-js/src/main/js/NetworkError.js +++ b/frontend-js/src/main/js/NetworkError.js @@ -9,9 +9,9 @@ var logger = require('./logger'); * * @param {string} message * @param {Object} [connectionParams] - * @param {number} connectionParams.statusCode - * @param {string} connectionParams.url - * @param {string} connectionParams.content + * @param {number} [connectionParams.statusCode] + * @param {string} [connectionParams.url] + * @param {string} [connectionParams.content] * * @constructor * @extends Error diff --git a/frontend-js/src/main/js/ServerConnector.js b/frontend-js/src/main/js/ServerConnector.js index 8dfe29d3a5..8370ffc24f 100644 --- a/frontend-js/src/main/js/ServerConnector.js +++ b/frontend-js/src/main/js/ServerConnector.js @@ -2026,9 +2026,9 @@ ServerConnector.addComment = function (params) { /** * * @param {DataOverlay} params.overlay - * @param {string|number} params.fileId + * @param {string|number} [params.fileId] * @param {string} [params.projectId] - * @returns {PromiseLike<DataOverlay>} + * @returns {Promise<DataOverlay>} */ ServerConnector.addOverlay = function (params) { var overlay = params.overlay; diff --git a/frontend-js/src/main/js/map/data/LayoutAlias.js b/frontend-js/src/main/js/map/data/LayoutAlias.js index a8dc512347..43352d25a9 100644 --- a/frontend-js/src/main/js/map/data/LayoutAlias.js +++ b/frontend-js/src/main/js/map/data/LayoutAlias.js @@ -7,7 +7,7 @@ var GeneVariant = require('./GeneVariant'); * * @param {number} javaObject.idObject * @param {number} [javaObject.value] - * @param {string} [javaObject.color] + * @param {{rgb:number}} [javaObject.color] * @param {number} javaObject.modelId * @param {string} [javaObject.description] * @param {string} [javaObject.type=LayoutAlias.LIGHT] @@ -83,7 +83,7 @@ LayoutAlias.prototype.getValue = function () { /** * - * @returns {string} + * @returns {{rgb:number}} */ LayoutAlias.prototype.getColor = function () { return this.color; @@ -115,7 +115,7 @@ LayoutAlias.prototype.setValue = function (newValue) { /** * - * @param {string} newColor + * @param {{rgb:number}} newColor */ LayoutAlias.prototype.setColor = function (newColor) { this.color = newColor; diff --git a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js index b5002b82b2..828dde5883 100644 --- a/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js +++ b/frontend-js/src/main/js/map/overlay/AbstractDbOverlay.js @@ -18,8 +18,8 @@ var ServerConnector = require('../../ServerConnector'); * @param {Object} params * @param {CustomMap} params.map * @param {string} params.name - * @param {boolean} params.allowGeneralSearch - * @param {boolean} params.allowSearchById + * @param {boolean} [params.allowGeneralSearch=false] + * @param {boolean} [params.allowSearchById=false] * @param {string} params.iconType * @param {number} params.iconColorStart * @constructor diff --git a/frontend-js/src/test/js/helper.js b/frontend-js/src/test/js/helper.js index a3ee154868..6b7d301c39 100644 --- a/frontend-js/src/test/js/helper.js +++ b/frontend-js/src/test/js/helper.js @@ -39,6 +39,11 @@ var Promise = require('bluebird'); var GuiConnector = require('../../main/js/GuiConnector'); +/** + * + * @param {Configuration} configuration + * @constructor + */ function Helper(configuration) { if (configuration === undefined) { throw new Error("Configuration must be defined"); @@ -64,6 +69,11 @@ Helper.prototype.getConfiguration = function () { return this._configuration; }; +/** + * + * @param {CustomMap} map + * @returns {CommentDbOverlay} + */ Helper.prototype.createCommentDbOverlay = function (map) { var result = new CommentDbOverlay({ map: map, @@ -88,8 +98,15 @@ Helper.prototype.createSearchDbOverlay = function (map) { return result; }; +/** + * + * @param {CustomMap} map + * @returns {AbstractDbOverlay} + */ Helper.prototype.createDbOverlay = function (map) { var result = new AbstractDbOverlay({ + iconType: "target", + iconColorStart: 0, map: map, name: "search" }); @@ -100,6 +117,11 @@ Helper.prototype.createDbOverlay = function (map) { return result; }; +/** + * + * @param {CustomMap} map + * @returns {DrugDbOverlay} + */ Helper.prototype.createDrugDbOverlay = function (map) { var result = new DrugDbOverlay({ map: map, @@ -111,6 +133,11 @@ Helper.prototype.createDrugDbOverlay = function (map) { return result; }; +/** + * + * @param {CustomMap} map + * @returns {ChemicalDbOverlay} + */ Helper.prototype.createChemicalDbOverlay = function (map) { var result = new ChemicalDbOverlay({ map: map, @@ -122,6 +149,11 @@ Helper.prototype.createChemicalDbOverlay = function (map) { return result; }; +/** + * + * @param {CustomMap} map + * @returns {MiRnaDbOverlay} + */ Helper.prototype.createMiRnaDbOverlay = function (map) { var result = new MiRnaDbOverlay({ map: map, @@ -133,6 +165,11 @@ Helper.prototype.createMiRnaDbOverlay = function (map) { return result; }; +/** + * + * @param {Alias} [element] + * @returns {Comment} + */ Helper.prototype.createComment = function (element) { var elementType = "ALIAS"; var elementId = this.idCounter++; @@ -189,6 +226,10 @@ Helper.prototype.createProject = function (params) { return result; }; +/** + * + * @returns {User} + */ Helper.prototype.createUser = function () { return new User({ login: "test_login", @@ -250,7 +291,7 @@ Helper.prototype.createLayoutAlias = function (alias, type) { idObject: id, value: 0.2, color: { - a: 23 + rgb: 23 }, modelId: modelId, geneVariations: [], @@ -285,6 +326,11 @@ Helper.prototype.createLayoutReaction = function (reaction) { }); }; +/** + * + * @param {BioEntity} [element] + * @returns {IdentifiedElement} + */ Helper.prototype.createIdentifiedElement = function (element) { if (element === undefined) { return new IdentifiedElement({ @@ -390,14 +436,18 @@ Helper.prototype.createCustomMapOptions = function (project) { return new CustomMapOptions({ project: project, + projectId: project.getProjectId(), element: testDiv, - mapDiv: testDiv, configuration: this.getConfiguration(), serverConnector: ServerConnector }); }; +/** + * + * @returns {AbstractCustomMap} + */ Helper.prototype.createAbstractCustomMap = function () { var options = this.createCustomMapOptions(); var result = new AbstractCustomMap(options.getProject().getModels()[0], options); @@ -445,6 +495,11 @@ Helper.prototype.setUrl = function (url) { GuiConnector.init(); }; +/** + * + * @param {String} filename + * @returns {Promise} + */ Helper.prototype.readFile = function (filename) { return new Promise(function (resolve, reject) { fs.readFile(filename, 'utf8', function (err, content) { @@ -457,20 +512,28 @@ Helper.prototype.readFile = function (filename) { }); }; +/** + * + * @returns {SbmlFunction} + */ Helper.prototype.createSbmlFunction = function () { return new SbmlFunction({ "functionId": "fun", "name": "fun name", "definition": "<lambda>" + - "<bvar><ci> x </ci></bvar>" + - "<bvar><ci> y </ci></bvar>" + - "<apply><plus/><ci> x </ci><ci> y </ci><cn type=\"integer\"> 2 </cn></apply>" + - "</lambda>\n\n", + "<bvar><ci> x </ci></bvar>" + + "<bvar><ci> y </ci></bvar>" + + "<apply><plus/><ci> x </ci><ci> y </ci><cn type=\"integer\"> 2 </cn></apply>" + + "</lambda>\n\n", "arguments": ["x", "y"], "id": this.idCounter++ }); }; +/** + * + * @returns {SbmlParameter} + */ Helper.prototype.createSbmlParameter = function () { return new SbmlParameter({ "parameterId": "local_param", @@ -482,22 +545,32 @@ Helper.prototype.createSbmlParameter = function () { }); }; +/** + * + * @returns {KineticLaw} + */ Helper.prototype.createKineticLaw = function () { return new KineticLaw({ "parameterIds": [], "definition": '<math xmlns="http://www.w3.org/1998/Math/MathML">' + - '<apply xmlns="http://www.w3.org/1998/Math/MathML">' + - '<divide/><apply><times/><ci>ca1</ci><apply><plus/><ci>sa1</ci><ci>sa2</ci></apply></apply><cn type=\"integer\"> 2 </cn>' + - '</apply></math>', + '<apply xmlns="http://www.w3.org/1998/Math/MathML">' + + '<divide/><apply><times/><ci>ca1</ci><apply><plus/><ci>sa1</ci><ci>sa2</ci></apply></apply><cn type=\"integer\"> 2 </cn>' + + '</apply></math>', "functionIds": [] }); }; +/** + * + */ Helper.prototype.loginAsAdmin = function () { ServerConnector.getSessionData().setLogin("admin"); ServerConnector.getSessionData().setToken("ADMIN_TOKEN_ID"); }; +/** + * + */ Helper.prototype.loginWithoutAccess = function () { // noinspection SpellCheckingInspection ServerConnector.getSessionData().setLogin("noaccessuser"); @@ -533,7 +606,12 @@ Helper.prototype.triggerJqueryEvent = function (element, eventType) { return Promise.all(promises); }; +/** + * + * @returns {Annotation} + */ Helper.prototype.createAnnotation = function () { + // noinspection SpellCheckingInspection return new Annotation({ resource: "10.1038%2Fnpjsba.2016.20", link: "http://doi.org/10.1038%2Fnpjsba.2016.20", @@ -560,6 +638,10 @@ Helper.prototype.createGoogleCanvas = function () { }); }; +/** + * + * @type {number} + */ Helper.EPSILON = 1e-6; module.exports = Helper; -- GitLab