Search in sources :

Example 6 with InfoBoxType

use of com.evolveum.midpoint.web.component.box.InfoBoxType in project midpoint by Evolveum.

the class PageDashboard method createTaskInfoBoxPanel.

private Component createTaskInfoBoxPanel(OperationResult result, Task task) {
    InfoBoxType infoBoxType = new InfoBoxType("object-task-bg", GuiStyleConstants.CLASS_OBJECT_TASK_ICON, getString("PageDashboard.infobox.tasks.label"));
    Integer totalCount;
    try {
        totalCount = getModelService().countObjects(TaskType.class, null, null, task, result);
        if (totalCount == null) {
            totalCount = 0;
        }
        ObjectQuery query = QueryBuilder.queryFor(TaskType.class, getPrismContext()).item(TaskType.F_EXECUTION_STATUS).eq(TaskExecutionStatusType.RUNNABLE).build();
        Integer activeCount = getModelService().countObjects(TaskType.class, query, null, task, result);
        if (activeCount == null) {
            activeCount = 0;
        }
        infoBoxType.setNumber(activeCount + " " + getString("PageDashboard.infobox.tasks.number"));
        int progress = 0;
        if (totalCount != 0) {
            progress = activeCount * 100 / totalCount;
        }
        infoBoxType.setProgress(progress);
        infoBoxType.setDescription(totalCount + " " + getString("PageDashboard.infobox.tasks.total"));
    } catch (Exception e) {
        infoBoxType.setNumber("ERROR: " + e.getMessage());
    }
    Model<InfoBoxType> boxModel = new Model<InfoBoxType>(infoBoxType);
    return new InfoBoxPanel(ID_INFO_BOX_TASKS, boxModel, PageTasks.class);
}
Also used : InfoBoxType(com.evolveum.midpoint.web.component.box.InfoBoxType) Model(org.apache.wicket.model.Model) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) InfoBoxPanel(com.evolveum.midpoint.web.component.box.InfoBoxPanel)

Aggregations

InfoBoxPanel (com.evolveum.midpoint.web.component.box.InfoBoxPanel)6 InfoBoxType (com.evolveum.midpoint.web.component.box.InfoBoxType)6 Model (org.apache.wicket.model.Model)6 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)3 IModel (org.apache.wicket.model.IModel)3 ListModel (org.apache.wicket.model.util.ListModel)3 RefinedObjectClassDefinition (com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition)1 RefinedResourceSchema (com.evolveum.midpoint.common.refinery.RefinedResourceSchema)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 AvailabilityStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.AvailabilityStatusType)1 ConnectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)1 OperationalStateType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalStateType)1