diff --git a/frontend-js/src/main/js/gui/export/ElementExportPanel.js b/frontend-js/src/main/js/gui/export/ElementExportPanel.js index 4c7ddf053896e62bda95aae52d4daf0334cac284..b302c5af02b8fe86e9d9279b225c529b6e44f7c0 100644 --- a/frontend-js/src/main/js/gui/export/ElementExportPanel.js +++ b/frontend-js/src/main/js/gui/export/ElementExportPanel.js @@ -3,8 +3,9 @@ /* exported logger */ var AbstractExportPanel = require('./AbstractExportPanel'); -var GuiMessageError = require('../GuiMessageError'); var Functions = require('../../Functions'); +var GuiMessageError = require('../GuiMessageError'); +var IdentifiedElement = require('../../map/data/IdentifiedElement'); var logger = require('../../logger'); @@ -217,7 +218,30 @@ ElementExportPanel.prototype.getAllColumns = function () { }, { "columnName": "complexId", "method": "getComplexId", - "name": "Complex" + "name": "Complex id" + }, { + /** + * + * @param {Alias} bioEntity + * @param {Project} project + * @returns {Promise<string>} + */ + "method": function (bioEntity, project) { + var modelId = bioEntity.getModelId(); + var complexId = bioEntity.getComplexId(); + if (complexId !== undefined) { + return project.getModelById(modelId).getByIdentifiedElement(new IdentifiedElement({ + id: complexId, + modelId: modelId, + type: "ALIAS" + }), true).then(function(complex){ + return complex.getName(); + }); + } else { + return Promise.resolve(""); + } + }, + "name": "Complex name" }, { "columnName": "compartmentId", "method": "getCompartmentId", diff --git a/frontend-js/src/main/js/map/data/MapModel.js b/frontend-js/src/main/js/map/data/MapModel.js index 0586050a26ec45b08cf8ad0c2ae677cf777a330a..beaa7095556abcd6435849332c19f3290d3ee02e 100644 --- a/frontend-js/src/main/js/map/data/MapModel.js +++ b/frontend-js/src/main/js/map/data/MapModel.js @@ -142,7 +142,7 @@ MapModel.prototype.getAliasById = function (id, complete) { /** * Returns {@link Alias} by identifier. * -* @param {number} id + * @param {number} id * identifier of the {@link Alias} * @returns {Promise<Alias>} by identifier */ @@ -638,7 +638,7 @@ MapModel.prototype.setTileSize = function (tileSize) { * * @param {IdentifiedElement} ie * @param {boolean} complete - * @returns {Promise} + * @returns {Promise<BioEntity|PointData>} */ MapModel.prototype.getByIdentifiedElement = function (ie, complete) { var self = this; diff --git a/frontend-js/src/test/js/gui/export/ElementExportPanel-test.js b/frontend-js/src/test/js/gui/export/ElementExportPanel-test.js index 47d361373c66c9bc5c995a7294bac0b32cba2d82..7a4096995b92c05813df00e3e6d8faa60b07201b 100644 --- a/frontend-js/src/test/js/gui/export/ElementExportPanel-test.js +++ b/frontend-js/src/test/js/gui/export/ElementExportPanel-test.js @@ -284,7 +284,22 @@ describe('ElementExportPanel', function () { var desc = "test\ntest2\n"; alias.setDescription(desc); return exportObject.createResponseRow(alias, exportObject.getAllColumns(), []).then(function (rowString) { - assert.ok(rowString.indexOf("test\ntest2\n") === -1); + assert.ok(rowString.indexOf(desc) === -1); + }); + }); + it('complex name', function () { + var complexName = "Complex name2"; + var exportObject = new ElementExportPanel({ + element: testDiv, + project: helper.createProject(), + configuration: helper.getConfiguration() + }); + var alias = helper.createAlias(exportObject.getProject().getModels()[0]); + var complex = helper.createAlias(exportObject.getProject().getModels()[0]); + complex.setName(complexName); + alias.setComplexId(complex.getId()); + return exportObject.createResponseRow(alias, exportObject.getAllColumns(), []).then(function (rowString) { + assert.ok(rowString.indexOf(complexName) >= 0); }); }); it('column with function manipulating data', function () {