Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
Issue #599
  • Loading branch information
rsoika committed Sep 6, 2024
1 parent 8a7fe92 commit 79e2a27
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 73 deletions.
156 changes: 95 additions & 61 deletions imixs-office-workflow-app/src/main/webapp/pages/monitoring_board.xhtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions" xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough" xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
template="/layout/template.xhtml">


Expand All @@ -32,26 +27,26 @@

<script type="text/javascript">
/*<![CDATA[*/

// set json objects with monitoring datasets
imixsOfficeMonitor.groupData = #{monitorController.groupData};
imixsOfficeMonitor.groupData = #{ monitorController.groupData };
imixsOfficeMonitor.processRef = "#{monitorController.processRef}";
$(document).ready(
function() {
// set navigation cookie
document.cookie = "imixs.office.navigation=/pages/monitoring.jsf?processref=#{monitorController.processRef};path=#{facesContext.externalContext.requestContextPath}/";
$("input.search_input").on('keypress',function(e) {
if(e.which == 13) {
e.preventDefault(); //stop event
// simulate click on search_action
$("[data-id='search_action']").click();
}
});

});

function () {
// set navigation cookie
document.cookie = "imixs.office.navigation=/pages/monitoring.jsf?processref=#{monitorController.processRef};path=#{facesContext.externalContext.requestContextPath}/";

$("input.search_input").on('keypress', function (e) {
if (e.which == 13) {
e.preventDefault(); //stop event
// simulate click on search_action
$("[data-id='search_action']").click();
}
});

});


/*]]>*/
</script>
</ui:define>
Expand All @@ -62,8 +57,7 @@

<h:form>

<h:panelGroup styleClass="imixs-board" layout="block"
id="monitor_board">
<h:panelGroup styleClass="imixs-board" layout="block" id="monitor_board">

<div class="imixs-header">
<h1>
Expand All @@ -74,21 +68,28 @@
#{boardController.title}
<!-- Search box -->
<h:panelGroup styleClass="search" id="search_box">
<h:inputText a:data-id="input_phrase" pt:placeholder="#{message.search}..." styleClass="search_input"
value="#{searchController.searchFilter.item['phrase']}" /><h:commandLink a:data-id="search_action"
action="#{boardController.refreshSearch()}"><f:ajax render="@form" execute="@form" /><span class="typcn typcn-zoom" style="margin-left:4px;"></span>
<h:inputText a:data-id="input_phrase" pt:placeholder="#{message.search}..."
styleClass="search_input" value="#{searchController.searchFilter.item['phrase']}" />
<h:commandLink a:data-id="search_action" action="#{boardController.refreshSearch()}">
<f:ajax render="@form" execute="@form" /><span class="typcn typcn-zoom"
style="margin-left:4px;"></span>
</h:commandLink>
<span class="extended-search">
<h:link outcome="/pages/workitems/worklist?processref=#{boardController.processRef}">#{message['nav.search_extended']}<span class="typcn typcn-zoom-in" style="margin-left:4px;"></span></h:link>
<h:link
outcome="/pages/workitems/worklist?processref=#{boardController.processRef}">
#{message['nav.search_extended']}<span class="typcn typcn-zoom-in"
style="margin-left:4px;"></span></h:link>
</span>
<span class="extended-search">
<h:link outcome="/pages/workitems/worklist?processref=#{monitorController.processRef}&amp;archive=true">#{message['nav.search_archive']}<span class="typcn typcn-archive" style="margin-left: 4px;"></span>
<h:link
outcome="/pages/workitems/worklist?processref=#{monitorController.processRef}&amp;archive=true">
#{message['nav.search_archive']}<span class="typcn typcn-archive"
style="margin-left: 4px;"></span>
</h:link>
</span>
</h:panelGroup>
<!-- navigation -->
<h:panelGroup layout="" styleClass="pull-right"
id="portlet_worklist_nav">
<h:panelGroup layout="" styleClass="pull-right" id="portlet_worklist_nav">
</h:panelGroup>
</h1>

Expand All @@ -98,52 +99,84 @@

<div class="imixs-body" style="margin-left: 10px;">


<!-- *** Chart Overview -->

<div class="monitoring-section">
<h2>Monitoring
<a href="javascript:imixsOfficeMonitor.initMainWorkflowCharts();" style="margin-left:16px;" title="Charts Diagrams"><span class="typcn typcn-chart-pie-outline"></span></a>
<a href="javascript:imixsOfficeMonitor.initMainWorkflowTableView();" style="margin-left:16px;" title="Table View"><span class="typcn typcn-th-list-outline"></span></a>
<a href="javascript:imixsOfficeMonitor.initMainWorkflowCharts();"
style="margin-left:16px;" title="Charts Diagrams"><span
class="typcn typcn-chart-pie-outline"></span></a>
<a href="javascript:imixsOfficeMonitor.initMainWorkflowTableView();"
style="margin-left:16px;" title="Table View"><span
class="typcn typcn-th-list-outline"></span></a>


<!-- date range -->
<span class="imixs-form-section-3" style="font-size: 14px;margin-left: 50px;">


<strong>#{message['worklist.date_range']}: </strong>
<h:inputText value="#{monitorController.filter.item['date.from']}"
title="#{message['worklist.date_range_help']}" class="imixs-date">
<f:convertDateTime pattern="#{message.datePatternShort}"
timeZone="#{message.timeZone}" />
</h:inputText>
-
<h:inputText value="#{monitorController.filter.item['date.to']}"
title="#{message['worklist.date_range_help']}" class="imixs-date">
<f:convertDateTime pattern="#{message.datePatternShort}"
timeZone="#{message.timeZone}" />
</h:inputText>

<h:commandLink actionListener="#{monitorController.refresh()}"
styleClass="imixs-portlet-refresh" title="#{message.refresh}"
style="font-size: 24px;margin-left: 5px;"><span
class="typcn typcn-arrow-sync"></span>
</h:commandLink>

</span>


</h2>
<div class="monitoring-container">

<!-- provide a char pane for each active group -->
<ui:repeat var="group"
value="#{monitorController.activeWorkflowGroups}">
<ui:repeat var="group" value="#{monitorController.activeWorkflowGroups}">
<div class="monitoring-pane">
<h3>#{group} (#{monitorController.countTotalWorkitems(group)})</h3>
<canvas class="monitoring-group-chart"
id="#{monitorController.getBase64(group)}"></canvas>
</div>
</ui:repeat>


</div>
</div>




<!-- *** Chart Details -->
<div style="display:none;" class="monitoring-section monitoring-section-details" id="monitoring-details-section-id">
<div style="display:none;" class="monitoring-section monitoring-section-details"
id="monitoring-details-section-id">
<h3 id="monitoring-details-title-id"></h3>
<div class="monitoring-container monitoring-details">
<div class="monitoring-pane">
<h4 id="monitoring-details-owner-title-id">#{message.owner}</h4>
<!-- place holder for the detail chart -->
<canvas class="monitoring-group-chart" id="monitoring-details-owner-pane-id" >
<canvas class="monitoring-group-chart" id="monitoring-details-owner-pane-id">
</canvas>
</div>

<div class="monitoring-pane">
<h4 id="monitoring-details-space-title-id">#{message.space}</h4>
<!-- place holder for the detail chart -->
<canvas class="monitoring-group-chart" id="monitoring-details-space-pane-id" >
<canvas class="monitoring-group-chart" id="monitoring-details-space-pane-id">
</canvas>
</div>


</div>
</div>

Expand All @@ -154,18 +187,19 @@


<!-- *** Custom Reports -->
<h:panelGroup layout="block" rendered="#{! empty monitorController.process.itemList['txtReportList']}" styleClass="monitoring-section">

<h:panelGroup layout="block"
rendered="#{! empty monitorController.process.itemList['txtReportList']}"
styleClass="monitoring-section">

<h2>Custom Reports</h2>
<div class="monitoring-container">

<!-- bulild a portlet for each report -->
<ui:repeat
value="#{monitorController.process.itemList['txtReportList']}"
var="report">
<ui:repeat value="#{monitorController.process.itemList['txtReportList']}" var="report">
<!-- We replace the sufix .imixs-report with -imixs-report so that we an use the report name as an ID -->
<ui:param name="reportid"
value="#{fn:replace(report,'.imixs-report','-imixs-report')}"></ui:param>
value="#{fn:replace(report,'.imixs-report','-imixs-report')}">
</ui:param>
<div class="imixs-reports col-3">
<!-- chart header -->
<div class="imixs-header" id="#{reportid}">
Expand All @@ -185,8 +219,8 @@
<div class="imixs-footer"></div>

</h:panelGroup>



</h:form>
</f:view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,15 @@ public String getVersionByGroup(String group) throws ModelException {
*/
public List<ItemCollection> findAllTasksByGroup(String group) {
List<ItemCollection> result = new ArrayList<>();
if (group == null || group.isEmpty()) {
return result;
}
try {

BPMNModel model = modelService.getModelManager().getModel(group);
String version = modelService.getModelManager().findVersionByGroup(group);
BPMNModel model = modelService.getModelManager().getModel(version);
result = modelService.getModelManager().findTasks(model, group);
} catch (ModelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warning("Failed to call findAllTasksByGroup for '" + group + "'");
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
package org.imixs.workflow.office.views;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -86,8 +89,11 @@ public class MonitorController implements Serializable {
@EJB
DocumentService documentService;

private ItemCollection filter;

public MonitorController() {
super();

}

/**
Expand Down Expand Up @@ -213,6 +219,14 @@ public long countTotalWorkitems(String group) {
*
*/
public void reset() {
filter = new ItemCollection();
refresh();
}

/**
* This method discards the cache.
*/
public void refresh() {
// initalize the task list...
buildBoardCategories();

Expand All @@ -228,11 +242,8 @@ public void reset() {
Collections.sort(activeWorkflowGroups);
}

/**
* This method discards the cache.
*/
public void refresh() {

public ItemCollection getFilter() {
return filter;
}

/**
Expand Down Expand Up @@ -343,15 +354,42 @@ private void buildBoardCategories() {

try {
String query = "(type:\"workitem\" AND $uniqueidref:\"" + getProcessRef() + "\")";
Date datFrom = filter.getItemValueDate("date.from");
Date datTo = filter.getItemValueDate("date.to");

// search date range?
String sDateFrom = "191401070000"; // because * did not work here
String sDateTo = "211401070000";
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmm");

if (datFrom != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(datFrom);
sDateFrom = dateformat.format(cal.getTime());
}
if (datTo != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(datTo);
cal.add(Calendar.DATE, 1);
sDateTo = dateformat.format(cal.getTime());
}

if (datFrom != null || datTo != null) {
// expected format $created:[20020101 TO 20030101]
query += " AND ($created:[" + sDateFrom + " TO " + sDateTo + "]) ";
}

// String query = "(type:\"workitem\" AND $uniqueidref:\"" + getProcessRef() +
// "\")";

for (String group : workflowGroups) {
// find latest version....
Set<String> versions = modelService.getModelManager().findAllVersionsByGroup(group);
if (versions != null && versions.size() > 0) {
// get the latest version
String version = versions.iterator().next();
// String version = versions.iterator().next();
// load the model
BPMNModel model = modelService.getModelManager().getModel(version);
// BPMNModel model = modelService.getModelManager().getModel(version);
// iterate over all tasks....
List<ItemCollection> tasks = modelController.findAllTasksByGroup(group);// model.findTasksByGroup(group);
for (ItemCollection task : tasks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public String getQuery() {
query += " (";
iterator = workflowGroups.iterator();
while (iterator.hasNext()) {
query += "txtworkflowgroup:\"" + iterator.next() + "\"";
query += "$workflowgroup:\"" + iterator.next() + "\"";
if (iterator.hasNext())
query += " OR ";
}
Expand Down

0 comments on commit 79e2a27

Please sign in to comment.