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

data is filled in on refresh method

parent 24da914a
No related branches found
No related tags found
1 merge request!5Frontend refactor
......@@ -38,7 +38,7 @@ ProjectInfoPanel.prototype._createSubmapGui = function() {
type : "div",
style : "width:100%;display: table;border-spacing: 10px;"
});
infoDiv.appendChild(infoTitle);
infoDiv.appendChild(dataTab);
var projectNameLabel = Functions.createElement({
type : "div",
......@@ -114,4 +114,21 @@ ProjectInfoPanel.prototype._createSubmapGui = function() {
dataTab.appendChild(self.createTableRow([ projectOriginalFileLabel, projectOriginalFileButton ]));
};
ProjectInfoPanel.prototype.refresh = function() {
var self = this;
var projectNameText = this.getControlElement(PanelControlElementType.INFO_PROJECT_NAME_TEXT);
var projectVersionText = this.getControlElement(PanelControlElementType.INFO_PROJECT_VERSION_TEXT);
var projectDescriptionText = this.getControlElement(PanelControlElementType.INFO_PROJECT_DESCRIOPTION_TEXT);
var projectPublicationsText = this.getControlElement(PanelControlElementType.INFO_PROJECT_PUBLICATIONS_TEXT);
return ServerConnector.getProject().then(function(project) {
projectNameText.innerHTML = project.getName();
projectVersionText.innerHTML = project.getVersion();
projectDescriptionText.innerHTML = project.getDescription();
projectPublicationsText.innerHTML = project.getPublicationCount();
return null;
});
};
module.exports = ProjectInfoPanel;
......@@ -33,6 +33,7 @@ Project.prototype.loadFromData = function(data) {
this.setTopOverviewImage(data.topOverviewImage);
this.setDisease(data.disease);
this.setOrganism(data.organism);
this.setPublicationCount(data.publicationCount);
this.setModel(new Model(data.map));
......@@ -46,6 +47,7 @@ Project.prototype.getId = function() {
Project.prototype.setId = function(id) {
this._id = parseInt(id);
};
Project.prototype.getProjectId = function() {
return this._projectId;
};
......@@ -110,4 +112,12 @@ Project.prototype.setOrganism = function(organism) {
this._organism = organism;
};
Project.prototype.getPublicationCount = function() {
return this._publicationCount;
};
Project.prototype.setPublicationCount = function(publicationCount) {
this._publicationCount = parseInt(publicationCount);
};
module.exports = Project;
......@@ -28,5 +28,16 @@ describe('ProjectInfoPanel', function() {
});
assert.equal(logger.getWarnings().length, 0);
});
it('refresh', function() {
var div = document.createElement("div");
var panel = new ProjectInfoPanel({
element : div,
customMap : helper.createCustomMap(),
});
return panel.refresh().then(function(result) {
assert.ok(div.innerHTML.indexOf("UNKNOWN DISEASE MAP") >= 0);
});
});
});
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