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

Merge branch '921-progress-bar-during-adding-removing-project' into 'master'

Resolve "progress bar during adding/removing project"

Closes #921

See merge request !1432
parents 6c0696b2 300bf561
No related branches found
No related tags found
1 merge request!1432Resolve "progress bar during adding/removing project"
Pipeline #51993 passed
minerva (16.1.0~alpha.0) stable; urgency=medium
* Improvement: possibility to register map in minerva-net (#1595)
* Small improvement: export to image allows to define size of the image (#955)
* Small improvement: export to image allows to define size of the image
(#955)
* Small improvement: progress bar on project upload changed into more verbose
statements (#921)
* Small improvement: AVOGADRO unit type from SBML is parsed properly (#1612)
* Small improvement: data overlays have automatically generated legend (#205,
#1061)
......
......@@ -38,6 +38,7 @@ import lcsb.mapviewer.model.user.annotator.AnnotatorConfigParameter;
import lcsb.mapviewer.model.user.annotator.AnnotatorData;
import lcsb.mapviewer.modelutils.map.ClassTreeNode;
import lcsb.mapviewer.modelutils.map.ElementUtils;
import lcsb.mapviewer.persist.dao.user.UserAnnotationSchemaDao;
/**
* This class annotates all elements in the model.
......@@ -77,13 +78,17 @@ public class ModelAnnotator {
*/
private List<IElementAnnotator> defaultAnnotators;
private UserAnnotationSchemaDao userAnnotationSchemaDao;
/**
* Constructor
*/
@Autowired
public ModelAnnotator(final MiriamConnector miriamConnector, final List<IElementAnnotator> availableAnnotators) {
public ModelAnnotator(final MiriamConnector miriamConnector, final List<IElementAnnotator> availableAnnotators,
final UserAnnotationSchemaDao userAnnotationSchemaDao) {
this.miriamConnector = miriamConnector;
this.availableAnnotators = availableAnnotators;
this.userAnnotationSchemaDao = userAnnotationSchemaDao;
defaultAnnotators = new ArrayList<>();
for (final IElementAnnotator annotator : availableAnnotators) {
if (annotator.isDefault()) {
......@@ -107,7 +112,7 @@ public class ModelAnnotator {
/**
* Performs all possible and automatic annotations on the model.
*
* @param annotationSchema
* @param inputAnnotationSchema
* information about {@link ElementAnnotator} objects that should be
* used for a given classes
* @param model
......@@ -115,8 +120,12 @@ public class ModelAnnotator {
* @param progressUpdater
* callback function used for updating progress of the function
*/
public void performAnnotations(final Model model, final IProgressUpdater progressUpdater,
final UserAnnotationSchema annotationSchema) {
public void performAnnotations(final Model model, final IProgressUpdater progressUpdater, final UserAnnotationSchema inputAnnotationSchema) {
UserAnnotationSchema annotationSchema = inputAnnotationSchema;
if (annotationSchema != null && annotationSchema.getId() > 0) {
annotationSchema = userAnnotationSchemaDao.getById(annotationSchema.getId());
}
progressUpdater.setProgress(0);
List<Model> models = new ArrayList<>();
......
......@@ -264,7 +264,7 @@ MapsAdminPanel.prototype._createProjectTableRow = function () {
} else {
promise = self.getServerConnector().unregisterProjectInMinervaNet(projectId);
}
return Promise.resolve(promise).catch(GuiConnector.alert).finally(function(){
return Promise.resolve(promise).catch(GuiConnector.alert).finally(function () {
GuiConnector.hideProcessing();
return self.getServerConnector().getProject(projectId);
})
......@@ -357,7 +357,35 @@ MapsAdminPanel.prototype.projectToTableRow = function (project, row, user) {
}
var status = project.getStatus();
if (project.getStatus().toLowerCase() !== "ok" && project.getStatus().toLowerCase() !== "failure") {
status += ' (' + project.getProgress().toFixed(2) + ' %)';
var step;
if (status === "Parsing data") {
step = 1;
} else if (status === "Uploading to db") {
step = 2;
} else if (status === "Annotating") {
step = 3;
} else if (status === "Generating images") {
step = 4;
} else if (status === "Validating miriam data") {
step = 5;
} else if (status === "Caching pubmed data") {
step = 6;
} else if (status === "Caching miriam data") {
step = 7;
} else if (status === "Caching chemical data") {
step = 8;
} else if (status === "Caching drug data") {
step = 9;
} else if (status === "Caching miRNA data") {
step = 10;
} else if (status === "Project removing") {
status = "Removing project, please wait";
} else {
status += ' (' + project.getProgress().toFixed(2) + ' %)';
}
if (step !== undefined) {
status += " step " + step + " ( of 10)";
}
}
var isAdmin = user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN)) ||
......
......@@ -58,7 +58,7 @@ public class UserAnnotationSchema implements Serializable {
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private int id;
/**
* {@link User} for which annotation schema is defined.
......@@ -187,8 +187,8 @@ public class UserAnnotationSchema implements Serializable {
}
/**
* Adds (or updates) {@link UserClassAnnotators class annotator} information to
* {@link #classAnnotators}.
* Adds (or updates) {@link UserClassAnnotators class annotator} information
* to {@link #classAnnotators}.
*
* @param ca
* object to add/update
......
package lcsb.mapviewer.persist.dao.user;
import org.springframework.stereotype.Repository;
import lcsb.mapviewer.model.user.UserAnnotationSchema;
import lcsb.mapviewer.persist.dao.BaseDao;
@Repository
public class UserAnnotationSchemaDao extends BaseDao<UserAnnotationSchema> {
public UserAnnotationSchemaDao() {
super(UserAnnotationSchema.class);
}
}
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