Updated Monitor grid
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-monitor-widget@114399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a4da9b32f9
commit
fc8852874b
4
pom.xml
4
pom.xml
|
@ -72,6 +72,10 @@
|
|||
<version>1.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
|
|
@ -76,7 +76,7 @@ public class MonitorDialog extends Window implements MonitorUpdaterListener {
|
|||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(true);
|
||||
setResizable(false);
|
||||
setModal(true);
|
||||
setClosable(true);
|
||||
setHeadingText("Progress");
|
||||
|
|
|
@ -51,6 +51,9 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
Log.debug("retrieved OperationMonitor: "
|
||||
+ result);
|
||||
|
||||
if(result==null){
|
||||
return;
|
||||
}
|
||||
if(result.isInBackground()){
|
||||
Log.debug("Operation is in background");
|
||||
cancel();
|
||||
|
@ -65,6 +68,10 @@ public class MonitorUpdater extends Timer implements MonitorDialogEventUIListene
|
|||
|
||||
}
|
||||
|
||||
if(result.getTask()==null|| result.getTask().getState()==null){
|
||||
return;
|
||||
}
|
||||
|
||||
switch (result.getTask().getState()) {
|
||||
case INITIALIZING:
|
||||
Log.info("Initializing...");
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MonitorWidgetEntry implements EntryPoint {
|
|||
};
|
||||
|
||||
public void onModuleLoad() {
|
||||
TestShow testShow = TestShow.MONITORBACKGROUNDWIDGET;
|
||||
TestShow testShow = TestShow.MONITORBACKGROUNDINFOWIDGET;
|
||||
Timer elapsedTimer;
|
||||
|
||||
switch (testShow) {
|
||||
|
@ -170,7 +170,9 @@ public class MonitorWidgetEntry implements EntryPoint {
|
|||
}
|
||||
|
||||
private float genProgress() {
|
||||
float fperc;
|
||||
|
||||
float fperc=20;
|
||||
|
||||
int perc = Random.nextInt(100);
|
||||
if (perc == 0) {
|
||||
fperc = 0f;
|
||||
|
|
|
@ -67,10 +67,10 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
private static final String HEIGHT = "420px";
|
||||
private static final String HEIGHTGRID = "290px";
|
||||
|
||||
private static final int CC1WIDTH = 168;
|
||||
private static final int CC1WIDTH = 164;
|
||||
private static final int CC2WIDTH = 100;
|
||||
private static final int CC3WIDTH = 140;
|
||||
private static final int CC4WIDTH = 100;
|
||||
private static final int CC4WIDTH = 104;
|
||||
|
||||
private MonitorBackgroundInfoDialog parent;
|
||||
|
||||
|
@ -89,7 +89,6 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
private TextField startDateField;
|
||||
private FieldLabel startLabel;
|
||||
|
||||
|
||||
class KeyProvider implements ModelKeyProvider<MonitorBaseDto> {
|
||||
@Override
|
||||
public String getKey(MonitorBaseDto item) {
|
||||
|
@ -102,6 +101,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
BackgroundOperationMonitor backgroundOperationMonitor,
|
||||
EventBus eventBus) {
|
||||
super();
|
||||
gen = new MonitorTreeDataGenerator();
|
||||
this.parent = parent;
|
||||
this.backgroundOperationMonitor = backgroundOperationMonitor;
|
||||
this.operationMonitorSession = new OperationMonitorSession(
|
||||
|
@ -134,8 +134,6 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
.getStartTime()));
|
||||
}
|
||||
startLabel = new FieldLabel(startDateField, "Start Date");
|
||||
|
||||
|
||||
|
||||
// Tree
|
||||
store = new TreeStore<MonitorBaseDto>(new KeyProvider());
|
||||
|
@ -178,8 +176,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
public void setValue(MonitorBaseDto object, String value) {
|
||||
if (object instanceof MonitorValidationJobSDto) {
|
||||
WorkerState workerState = WorkerState.get(value);
|
||||
((MonitorValidationJobSDto) object)
|
||||
.setWorkerState(workerState);
|
||||
((MonitorValidationJobSDto) object).setWorkerState(workerState);
|
||||
|
||||
}
|
||||
if (object instanceof MonitorFolderDto) {
|
||||
|
@ -193,6 +190,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
}
|
||||
}, CC2WIDTH, "Status");
|
||||
cc2.setHeader("Status");
|
||||
cc2.setWidth(CC2WIDTH);
|
||||
|
||||
ColumnConfig<MonitorBaseDto, String> cc3 = new ColumnConfig<MonitorBaseDto, String>(
|
||||
new ValueProvider<MonitorBaseDto, String>() {
|
||||
|
@ -229,6 +227,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
}
|
||||
}, CC3WIDTH, "Human Readble");
|
||||
cc3.setHeader("Human Readble");
|
||||
cc3.setWidth(CC3WIDTH);
|
||||
|
||||
ColumnConfig<MonitorBaseDto, Double> cc4 = new ColumnConfig<MonitorBaseDto, Double>(
|
||||
new ValueProvider<MonitorBaseDto, Double>() {
|
||||
|
@ -266,7 +265,8 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
}
|
||||
}, CC4WIDTH, "Progress");
|
||||
cc4.setHeader("Progress");
|
||||
|
||||
cc4.setWidth(CC4WIDTH);
|
||||
|
||||
ProgressBarCell progress = new ProgressBarCell() {
|
||||
@Override
|
||||
public boolean handlesSelection() {
|
||||
|
@ -274,7 +274,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
}
|
||||
};
|
||||
progress.setProgressText("{0}% Complete");
|
||||
progress.setWidth(110);
|
||||
progress.setWidth(100);
|
||||
|
||||
cc4.setCell(progress);
|
||||
|
||||
|
@ -385,7 +385,7 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
|
||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(0, 4, 0, 4)));
|
||||
|
||||
//
|
||||
//
|
||||
con.add(startLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
con.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
@ -417,7 +417,6 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
}
|
||||
|
||||
private void addChildrensToStore() {
|
||||
gen = new MonitorTreeDataGenerator();
|
||||
|
||||
MonitorFolderDto root = gen.getRoot(operationMonitor);
|
||||
if (root != null) {
|
||||
|
@ -446,21 +445,24 @@ public class MonitorBackgroundInfoPanel extends FramedPanel implements
|
|||
public void update(OperationMonitor operationMonitor) {
|
||||
this.operationMonitor = operationMonitor;
|
||||
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
addChildrensToStore();
|
||||
store.commitChanges();
|
||||
tree.expandAll();
|
||||
if (!gen.isCacheValid(operationMonitor)) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
addChildrensToStore();
|
||||
store.commitChanges();
|
||||
tree.expandAll();
|
||||
// StartDate
|
||||
if (backgroundOperationMonitor != null
|
||||
&& backgroundOperationMonitor.getStartTime() != null) {
|
||||
startDateField.setValue(sdf.format(backgroundOperationMonitor
|
||||
.getStartTime()));
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
|
||||
// StartDate
|
||||
if (backgroundOperationMonitor != null
|
||||
&& backgroundOperationMonitor.getStartTime() != null) {
|
||||
startDateField.setValue(sdf.format(backgroundOperationMonitor
|
||||
.getStartTime()));
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -50,26 +50,26 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
private static final String WIDTH = "640px";
|
||||
private static final String HEIGHT = "520px";
|
||||
private static final int CC1WIDTH = 90;
|
||||
private static final int CC2WIDTH = 60;
|
||||
private static final int CC3WIDTH = 110;
|
||||
private static final int PROGRESS_WIDTH = 110;
|
||||
private static final int CC2WIDTH = 66;
|
||||
private static final int CC3WIDTH = 104;
|
||||
private static final int PROGRESS_WIDTH = 100;
|
||||
private MonitorBackgroundDialog parent;
|
||||
|
||||
private ArrayList<MonitorBackgroundEventUIListener> monitorBackgroundEventUIListeners = new ArrayList<MonitorBackgroundEventUIListener>();
|
||||
|
||||
|
||||
private Menu contextMenu;
|
||||
private MenuItem infoItem;
|
||||
private MenuItem abortItem;
|
||||
private MenuItem hideItem;
|
||||
|
||||
//private TRId trId;
|
||||
// private TRId trId;
|
||||
private VerticalLayoutContainer con;
|
||||
//private ValidationsTasksMetadata validationsTasksMetadata;
|
||||
// private ValidationsTasksMetadata validationsTasksMetadata;
|
||||
|
||||
private ListStore<BackgroundOperationMonitor> store;
|
||||
private Grid<BackgroundOperationMonitor> grid;
|
||||
private ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList;
|
||||
private ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorListCache;
|
||||
|
||||
private EventBus eventBus;
|
||||
private MonitorBackgroundUpdater monitorBackgroundUpdater;
|
||||
|
@ -89,6 +89,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
|
||||
public MonitorBackgroundPanel(EventBus eventBus) {
|
||||
super();
|
||||
backgroundOperationMonitorListCache = null;
|
||||
this.eventBus = eventBus;
|
||||
forceLayoutOnResize = true;
|
||||
init();
|
||||
|
@ -98,6 +99,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
public MonitorBackgroundPanel(MonitorBackgroundDialog parent,
|
||||
EventBus eventBus) {
|
||||
super();
|
||||
backgroundOperationMonitorListCache = null;
|
||||
this.eventBus = eventBus;
|
||||
this.parent = parent;
|
||||
forceLayoutOnResize = true;
|
||||
|
@ -142,7 +144,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
props.state());
|
||||
cc2.setHeader("Status");
|
||||
cc2.setWidth(CC2WIDTH);
|
||||
|
||||
|
||||
ColumnConfig<BackgroundOperationMonitor, Double> cc3 = new ColumnConfig<BackgroundOperationMonitor, Double>(
|
||||
new ValueProvider<BackgroundOperationMonitor, Double>() {
|
||||
|
||||
|
@ -193,6 +195,7 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(false);
|
||||
grid.setColumnResize(true);
|
||||
grid.getView().setAutoExpandColumn(cc1);
|
||||
|
||||
createContextMenu();
|
||||
|
||||
|
@ -237,11 +240,10 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
private void addChildrensToStore() {
|
||||
if(backgroundOperationMonitorList!=null){
|
||||
if (backgroundOperationMonitorList != null) {
|
||||
store.addAll(backgroundOperationMonitorList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
|
@ -328,14 +330,56 @@ public class MonitorBackgroundPanel extends FramedPanel implements
|
|||
|
||||
@Override
|
||||
public void operationMonitorListUpdated(
|
||||
ArrayList<BackgroundOperationMonitor> operationMonitorList) {
|
||||
this.backgroundOperationMonitorList = operationMonitorList;
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
addChildrensToStore();
|
||||
store.commitChanges();
|
||||
forceLayout();
|
||||
ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList) {
|
||||
this.backgroundOperationMonitorList = backgroundOperationMonitorList;
|
||||
|
||||
if (!isCacheValid(backgroundOperationMonitorList)) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
addChildrensToStore();
|
||||
store.commitChanges();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected boolean isCacheValid(
|
||||
ArrayList<BackgroundOperationMonitor> backgroundOperationMonitorList) {
|
||||
if (backgroundOperationMonitorList == null
|
||||
|| backgroundOperationMonitorList.size() <= 0) {
|
||||
backgroundOperationMonitorListCache = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backgroundOperationMonitorListCache == null) {
|
||||
backgroundOperationMonitorListCache = backgroundOperationMonitorList;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backgroundOperationMonitorListCache.size() == backgroundOperationMonitorList
|
||||
.size()) {
|
||||
for (int i = 0; i < backgroundOperationMonitorList.size(); i++) {
|
||||
BackgroundOperationMonitor backgroundOperationMonitor = backgroundOperationMonitorList
|
||||
.get(i);
|
||||
BackgroundOperationMonitor backgroundOperationMonitorCache = backgroundOperationMonitorListCache
|
||||
.get(i);
|
||||
if (backgroundOperationMonitor.getTaskId().compareTo(
|
||||
backgroundOperationMonitorCache.getTaskId()) == 0
|
||||
&& backgroundOperationMonitor.getState().compareTo(
|
||||
backgroundOperationMonitorCache.getState()) == 0
|
||||
&& backgroundOperationMonitor.getProgress() == backgroundOperationMonitorCache
|
||||
.getProgress()) {
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,26 +51,26 @@ import com.sencha.gxt.widget.core.client.treegrid.TreeGrid;
|
|||
public class MonitorDetailPanel extends FramedPanel {
|
||||
private static final String WIDTH = "618px";
|
||||
private static final String HEIGHT = "256px";
|
||||
private static final String GRIDHEIGHT = "332px";
|
||||
private static final String GRIDHEIGHT = "208px";
|
||||
|
||||
private static final int CC1WIDTH = 168;
|
||||
private static final int CC1WIDTH = 164;
|
||||
private static final int CC2WIDTH = 100;
|
||||
private static final int CC3WIDTH = 140;
|
||||
private static final int CC4WIDTH = 100;
|
||||
|
||||
private static final int CC4WIDTH = 104;
|
||||
|
||||
interface DtoTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{id} - {value}\">{value}</span>")
|
||||
SafeHtml format(String id, String value);
|
||||
|
||||
/*"<span title='"
|
||||
+ SafeHtmlUtils.htmlEscape(value) + "'>" + SafeHtmlUtils.htmlEscape(value)
|
||||
+ "</span>"*/
|
||||
|
||||
|
||||
/*
|
||||
* "<span title='" + SafeHtmlUtils.htmlEscape(value) + "'>" +
|
||||
* SafeHtmlUtils.htmlEscape(value) + "</span>"
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
private VerticalLayoutContainer con;
|
||||
|
||||
|
||||
private MonitorTreeDataGenerator gen;
|
||||
private TreeStore<MonitorBaseDto> store;
|
||||
private TreeGrid<MonitorBaseDto> tree;
|
||||
|
@ -93,6 +93,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
super();
|
||||
Log.debug("MonitorDetailPanel");
|
||||
forceLayoutOnResize = true;
|
||||
gen = new MonitorTreeDataGenerator();
|
||||
init();
|
||||
create();
|
||||
|
||||
|
@ -134,24 +135,21 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
|
||||
String label = jobSDto.getJobClassfier().getLabel();
|
||||
String response;
|
||||
if (label == null||label.isEmpty()) {
|
||||
if (label == null || label.isEmpty()) {
|
||||
response = "Job";
|
||||
} else {
|
||||
response = "Job "+label;
|
||||
response = "Job " + label;
|
||||
}
|
||||
|
||||
|
||||
sb.append(dtoTemplates.format(response, value));
|
||||
} else {
|
||||
if (d instanceof MonitorValidationJobSDto) {
|
||||
sb.append(dtoTemplates.format("Validation", value));
|
||||
} else{
|
||||
} else {
|
||||
sb.append(dtoTemplates.format("", value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -177,8 +175,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
public void setValue(MonitorBaseDto object, String value) {
|
||||
if (object instanceof MonitorValidationJobSDto) {
|
||||
WorkerState workerState = WorkerState.get(value);
|
||||
((MonitorValidationJobSDto) object)
|
||||
.setWorkerState(workerState);
|
||||
((MonitorValidationJobSDto) object).setWorkerState(workerState);
|
||||
|
||||
}
|
||||
if (object instanceof MonitorFolderDto) {
|
||||
|
@ -192,7 +189,8 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
}
|
||||
}, CC2WIDTH, "Status");
|
||||
cc2.setHeader("Status");
|
||||
|
||||
cc2.setWidth(CC2WIDTH);
|
||||
|
||||
ColumnConfig<MonitorBaseDto, String> cc3 = new ColumnConfig<MonitorBaseDto, String>(
|
||||
new ValueProvider<MonitorBaseDto, String>() {
|
||||
|
||||
|
@ -228,6 +226,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
}
|
||||
}, CC3WIDTH, "Human Readble");
|
||||
cc3.setHeader("Human Readble");
|
||||
cc3.setWidth(CC3WIDTH);
|
||||
|
||||
ColumnConfig<MonitorBaseDto, Double> cc4 = new ColumnConfig<MonitorBaseDto, Double>(
|
||||
new ValueProvider<MonitorBaseDto, Double>() {
|
||||
|
@ -265,7 +264,8 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
}
|
||||
}, CC4WIDTH, "Progress");
|
||||
cc4.setHeader("Progress");
|
||||
|
||||
cc4.setWidth(CC4WIDTH);
|
||||
|
||||
ProgressBarCell progress = new ProgressBarCell() {
|
||||
@Override
|
||||
public boolean handlesSelection() {
|
||||
|
@ -273,7 +273,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
}
|
||||
};
|
||||
progress.setProgressText("{0}% Complete");
|
||||
progress.setWidth(110);
|
||||
progress.setWidth(100);
|
||||
|
||||
cc4.setCell(progress);
|
||||
|
||||
|
@ -283,9 +283,9 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
l.add(cc3);
|
||||
l.add(cc4);
|
||||
ColumnModel<MonitorBaseDto> cm = new ColumnModel<MonitorBaseDto>(l);
|
||||
|
||||
gridView=new ExtendedTreeGridView<MonitorBaseDto>();
|
||||
|
||||
|
||||
gridView = new ExtendedTreeGridView<MonitorBaseDto>();
|
||||
|
||||
tree = new TreeGrid<MonitorBaseDto>(store, cm, cc1);
|
||||
tree.setView(gridView);
|
||||
tree.getView().setAutoFill(true);
|
||||
|
@ -349,8 +349,8 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
img = ResourceBundle.INSTANCE.tableValidation();
|
||||
}
|
||||
}
|
||||
return img;
|
||||
|
||||
return img;
|
||||
|
||||
}
|
||||
};
|
||||
tree.setIconProvider(iconProvider);
|
||||
|
@ -422,22 +422,22 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
|
||||
public void update(OperationMonitor operationMonitor) {
|
||||
this.operationMonitor = operationMonitor;
|
||||
|
||||
if (!gen.isCacheValid(operationMonitor)) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
// con.remove(tree);
|
||||
// con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
addChildrensToStore();
|
||||
store.commitChanges();
|
||||
tree.expandAll();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
//con.remove(tree);
|
||||
//con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
addChildrensToStore();
|
||||
store.commitChanges();
|
||||
tree.expandAll();
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
private void addChildrensToStore() {
|
||||
gen = new MonitorTreeDataGenerator();
|
||||
|
||||
MonitorFolderDto root = gen.getRootNoTask(operationMonitor);
|
||||
if (root != null) {
|
||||
for (MonitorBaseDto base : root.getChildrens()) {
|
||||
|
@ -452,7 +452,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
Log.error("Error generating the task informations");
|
||||
UtilsGXT3.alert("Error", "Error generating task informations");
|
||||
|
@ -461,7 +461,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
|
||||
private void processFolder(TreeStore<MonitorBaseDto> store,
|
||||
MonitorFolderDto folder) {
|
||||
|
||||
|
||||
for (MonitorBaseDto child : folder.getChildrens()) {
|
||||
try {
|
||||
store.add(folder, child);
|
||||
|
@ -474,7 +474,7 @@ public class MonitorDetailPanel extends FramedPanel {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,12 +21,86 @@ public class MonitorTreeDataGenerator {
|
|||
.getFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private MonitorFolderDto root;
|
||||
private TaskS taskSCache;
|
||||
|
||||
|
||||
public MonitorTreeDataGenerator() {
|
||||
Log.debug("MonitorTreeDataGenerator");
|
||||
}
|
||||
|
||||
public boolean isCacheValid(OperationMonitor operationMonitor) {
|
||||
if (operationMonitor == null || operationMonitor.getTask() == null) {
|
||||
taskSCache = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
TaskS taskS = operationMonitor.getTask();
|
||||
if (taskSCache == null) {
|
||||
taskSCache = taskS;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (taskS.getId().compareTo(taskSCache.getId()) == 0) {
|
||||
if (taskS.getProgress() == taskSCache.getProgress()
|
||||
&& taskS.getState().compareTo(taskSCache.getState()) == 0) {
|
||||
ArrayList<JobS> listJobS = taskS.getJobs();
|
||||
ArrayList<JobS> listJobSCache = taskSCache.getJobs();
|
||||
if (listJobS.size() == listJobSCache.size()) {
|
||||
for (int i = 0; i < listJobS.size(); i++) {
|
||||
JobS jobS = listJobS.get(i);
|
||||
JobS jobSCache = listJobSCache.get(i);
|
||||
if (jobS.getId() == jobSCache.getId()
|
||||
&& jobS.getProgress() == jobSCache
|
||||
.getProgress()
|
||||
&& jobS.getWorkerState().compareTo(
|
||||
jobSCache.getWorkerState()) == 0) {
|
||||
ArrayList<ValidationsJobS> listValidationsJobS = jobS
|
||||
.getValidationsJobS();
|
||||
ArrayList<ValidationsJobS> listValidationsJobSCache = jobSCache
|
||||
.getValidationsJobS();
|
||||
if (listValidationsJobS.size() == listValidationsJobSCache
|
||||
.size()) {
|
||||
for (int j = 0; j < listValidationsJobS.size(); j++) {
|
||||
ValidationsJobS validationsJobS = listValidationsJobS
|
||||
.get(j);
|
||||
ValidationsJobS validationsJobSCache = listValidationsJobSCache
|
||||
.get(j);
|
||||
|
||||
if (validationsJobS.getId() == validationsJobSCache
|
||||
.getId()
|
||||
&& validationsJobS.getProgress() == validationsJobSCache
|
||||
.getProgress()
|
||||
&& validationsJobS
|
||||
.getWorkerState()
|
||||
.compareTo(
|
||||
validationsJobSCache
|
||||
.getWorkerState()) == 0) {
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public MonitorFolderDto getRoot(OperationMonitor operationMonitor) {
|
||||
root = null;
|
||||
|
||||
|
@ -51,10 +125,11 @@ public class MonitorTreeDataGenerator {
|
|||
validations.add(validationDto);
|
||||
}
|
||||
MonitorJobSDto foldJob = new MonitorJobSDto("job",
|
||||
task.getId() + "-" + job.getId(),job.getJobClassifier(),
|
||||
job.getDescription(), job.getWorkerState()
|
||||
.toString(), job.getHumaReadableStatus(),
|
||||
job.getProgress(), validations);
|
||||
task.getId() + "-" + job.getId(),
|
||||
job.getJobClassifier(), job.getDescription(), job
|
||||
.getWorkerState().toString(),
|
||||
job.getHumaReadableStatus(), job.getProgress(),
|
||||
validations);
|
||||
jobs.add(foldJob);
|
||||
}
|
||||
MonitorTaskSDto foldTask = new MonitorTaskSDto("task",
|
||||
|
@ -96,6 +171,7 @@ public class MonitorTreeDataGenerator {
|
|||
ArrayList<MonitorBaseDto> jobs = new ArrayList<MonitorBaseDto>();
|
||||
if (operationMonitor != null && operationMonitor.getTask() != null) {
|
||||
TaskS task = operationMonitor.getTask();
|
||||
|
||||
for (JobS job : task.getJobs()) {
|
||||
ArrayList<MonitorBaseDto> validations = new ArrayList<MonitorBaseDto>();
|
||||
for (ValidationsJobS v : job.getValidationsJobS()) {
|
||||
|
@ -109,10 +185,11 @@ public class MonitorTreeDataGenerator {
|
|||
validations.add(validationDto);
|
||||
}
|
||||
MonitorJobSDto foldJob = new MonitorJobSDto("job",
|
||||
task.getId() + "-" + job.getId(),job.getJobClassifier(),
|
||||
job.getDescription(), job.getWorkerState()
|
||||
.toString(), job.getHumaReadableStatus(),
|
||||
job.getProgress(), validations);
|
||||
task.getId() + "-" + job.getId(),
|
||||
job.getJobClassifier(), job.getDescription(), job
|
||||
.getWorkerState().toString(),
|
||||
job.getHumaReadableStatus(), job.getProgress(),
|
||||
validations);
|
||||
jobs.add(foldJob);
|
||||
}
|
||||
|
||||
|
@ -165,8 +242,8 @@ public class MonitorTreeDataGenerator {
|
|||
|
||||
validations.add(validationDto);
|
||||
}
|
||||
MonitorJobSDto foldJob = new MonitorJobSDto(
|
||||
"job", task.getId() + "-" + job.getId(),
|
||||
MonitorJobSDto foldJob = new MonitorJobSDto("job",
|
||||
task.getId() + "-" + job.getId(),
|
||||
job.getJobClassifier(),
|
||||
job.getDescription(), job.getWorkerState()
|
||||
.toString(),
|
||||
|
@ -174,10 +251,10 @@ public class MonitorTreeDataGenerator {
|
|||
job.getProgress(), validations);
|
||||
jobs.add(foldJob);
|
||||
}
|
||||
MonitorTaskSDto foldTask = new MonitorTaskSDto(
|
||||
"task", task.getId(), operationMonitor
|
||||
.getOperationId().toString(), task
|
||||
.getState().toString(), "",
|
||||
MonitorTaskSDto foldTask = new MonitorTaskSDto("task",
|
||||
task.getId(), operationMonitor.getOperationId()
|
||||
.toString(),
|
||||
task.getState().toString(), "",
|
||||
task.getProgress(), jobs);
|
||||
if (task.getStartTime() != null) {
|
||||
foldTask.setStartTime(sdf.format(task
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.portlets.user.td.monitorwidget.client.resources;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.resources.client.ClientBundle.Source;
|
||||
|
||||
public interface ResourceBundle extends ClientBundle {
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.td.monitorwidget.client.MonitorWidgetEntry' /> -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.td.monitorwidget.client.MonitorWidgetEntry' /> -->
|
||||
|
||||
<!-- Logger -->
|
||||
<!-- <set-property name="log_DivLogger" value="ENABLED" />
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<!-- Servlets Mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
<url-pattern>tdgwtservice/TDGWTService</url-pattern>
|
||||
<url-pattern>/MonitorWidgetTD/TDGWTService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
|
|
Loading…
Reference in New Issue