Add table with summary of the status of tasks
This commit is contained in:
parent
4dc7cb48e8
commit
3d8b044b17
4 changed files with 68 additions and 4 deletions
|
|
@ -23,9 +23,7 @@ import static org.libreplan.web.I18nHelper._;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -33,6 +31,7 @@ import java.util.TreeSet;
|
|||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.planner.entities.TaskStatusEnum;
|
||||
import org.libreplan.web.common.Util;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
|
@ -40,6 +39,8 @@ import org.springframework.stereotype.Component;
|
|||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Grid;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
|
||||
|
|
@ -57,6 +58,8 @@ public class DashboardController extends GenericForwardComposer {
|
|||
|
||||
private Window dashboardWindow;
|
||||
|
||||
private Grid gridTasksSummary;
|
||||
|
||||
private Div projectDashboardChartsDiv;
|
||||
private Div projectDashboardNoTasksWarningDiv;
|
||||
|
||||
|
|
@ -81,10 +84,26 @@ public class DashboardController extends GenericForwardComposer {
|
|||
if (this.dashboardWindow != null) {
|
||||
renderGlobalProgress();
|
||||
renderTaskStatus();
|
||||
}
|
||||
|
||||
renderTasksSummary();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTasksSummary() {
|
||||
Map<TaskStatusEnum, Integer> taskStatus = dashboardModel.calculateTaskStatus();
|
||||
|
||||
taskStatus("lblTasksFinished", taskStatus.get(TaskStatusEnum.FINISHED));
|
||||
taskStatus("lblTasksBlocked", taskStatus.get(TaskStatusEnum.BLOCKED));
|
||||
taskStatus("lblTasksInProgress", taskStatus.get(TaskStatusEnum.IN_PROGRESS));
|
||||
taskStatus("lblTasksReadyToStart", taskStatus.get(TaskStatusEnum.READY_TO_START));
|
||||
}
|
||||
|
||||
private void taskStatus(String key, Integer value) {
|
||||
Label label = (Label) gridTasksSummary.getFellowIfAny(key);
|
||||
if (label != null) {
|
||||
label.setValue(String.format(_("%d tasks"), value));
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTaskStatus() {
|
||||
TaskStatus taskStatus = TaskStatus.create();
|
||||
taskStatus.data(_("Finished"),
|
||||
|
|
|
|||
|
|
@ -291,6 +291,17 @@ public class DashboardModel implements IDashboardModel {
|
|||
}
|
||||
return histogram;
|
||||
}
|
||||
|
||||
public Map<TaskStatusEnum, Integer> calculateTaskStatus() {
|
||||
AccumulateTasksStatusVisitor visitor = new AccumulateTasksStatusVisitor();
|
||||
TaskElement rootTask = getRootTask();
|
||||
if (this.getRootTask() == null) {
|
||||
throw new RuntimeException("Root task is null");
|
||||
}
|
||||
resetTasksStatusInGraph();
|
||||
rootTask.acceptVisitor(visitor);
|
||||
return visitor.getTaskStatusData();
|
||||
}
|
||||
|
||||
private void calculateTaskStatusStatistics() {
|
||||
AccumulateTasksStatusVisitor visitor = new AccumulateTasksStatusVisitor();
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ package org.libreplan.web.dashboard;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.planner.entities.TaskStatusEnum;
|
||||
|
||||
interface IDashboardModel {
|
||||
|
||||
|
|
@ -67,4 +69,7 @@ interface IDashboardModel {
|
|||
|
||||
/* Time KPI: "Lead/Lag in task completion" */
|
||||
List<Double> getLagInTaskCompletionHistogram();
|
||||
|
||||
Map<TaskStatusEnum, Integer> calculateTaskStatus();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,35 @@
|
|||
<hbox>
|
||||
<n:div id="global-progress" style="height:200px; width:500px;"></n:div>
|
||||
<n:div id="task-status" style="height:200px; width:400px; margin-left: 100px;"></n:div>
|
||||
|
||||
<!-- Tasks summary -->
|
||||
<grid id="gridTasksSummary" style="margin-top: 50px" visible="false">
|
||||
<auxhead>
|
||||
<auxheader label="${i18n:_('Tasks summary')}" colspan="2"/>
|
||||
</auxhead>
|
||||
<columns sizable="false">
|
||||
<column width="100px"/>
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Finished')}:"/>
|
||||
<label id="lblTasksFinished" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Blocked')}:"/>
|
||||
<label id="lblTasksBlocked" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('In Progress')}:"/>
|
||||
<label id="lblTasksInProgress" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Ready to start')}:"/>
|
||||
<label id="lblTasksReadyToStart" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue