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

_createResponseCell extracted into abstract class

parent b6967400
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!490Resolve "common functionality of NetworkExportPanel and GraphicsExportPanel should be extracted to abstract class"
...@@ -644,4 +644,27 @@ AbstractExportPanel.prototype.getBioEntityAllColumns = function () { ...@@ -644,4 +644,27 @@ AbstractExportPanel.prototype.getBioEntityAllColumns = function () {
}]; }];
}; };
/**
*
* @param {BioEntity} bioEntity
* @param {ExportColumn} column
* @returns {Promise<string>}
* @protected
*/
AbstractExportPanel.prototype._createResponseCell = function (bioEntity, column) {
var valuePromise;
if (Functions.isString(column.method)) {
valuePromise = Promise.resolve(bioEntity[column.method]());
} else {
valuePromise = Promise.resolve(column.method(bioEntity, this.getProject()));
}
return valuePromise.then(function (value) {
if (Functions.isString(value)) {
value = value.replace(/[\n\r]/g, ' ');
}
return value;
});
};
module.exports = AbstractExportPanel; module.exports = AbstractExportPanel;
...@@ -125,27 +125,6 @@ ElementExportPanel.prototype.createResponseString = function () { ...@@ -125,27 +125,6 @@ ElementExportPanel.prototype.createResponseString = function () {
}); });
}; };
/**
*
* @param {BioEntity} alias
* @param column
* @returns {Promise<string>}
* @private
*/
ElementExportPanel.prototype._createResponseCell = function (alias, column) {
var valuePromise;
if (Functions.isString(column.method)) {
valuePromise = Promise.resolve(alias[column.method]());
} else {
valuePromise = Promise.resolve(column.method(alias, this.getProject()));
}
return valuePromise.then(function (value) {
if (Functions.isString(value)) {
value = value.replace(/[\n\r]/g, ' ');
}
return value;
});
};
/** /**
* *
* @param {Alias} alias * @param {Alias} alias
......
...@@ -249,27 +249,4 @@ NetworkExportPanel.prototype.createResponseRow = function (reaction, columns, mi ...@@ -249,27 +249,4 @@ NetworkExportPanel.prototype.createResponseRow = function (reaction, columns, mi
}); });
}; };
/**
*
* @param {Reaction} reaction
* @param {ExportColumn} column
* @returns {Promise<string>}
* @private
*/
NetworkExportPanel.prototype._createResponseCell = function (reaction, column) {
var valuePromise;
if (Functions.isString(column.method)) {
valuePromise = Promise.resolve(reaction[column.method]());
} else {
valuePromise = Promise.resolve(column.method(reaction, this.getProject()));
}
return valuePromise.then(function (value) {
if (Functions.isString(value)) {
value = value.replace(/[\n\r]/g, ' ');
}
return value;
});
};
module.exports = NetworkExportPanel; module.exports = NetworkExportPanel;
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