update data views

This commit is contained in:
Ralph Soika 2025-05-12 18:34:58 +02:00
parent 65a1d4f2b7
commit e987a30053
8 changed files with 49 additions and 27 deletions

View file

@ -58,8 +58,8 @@ import jakarta.servlet.http.HttpServletRequest;
/**
* The DataViewController is used to display a data view
* <p>
* The controller uses a cacheId provided together with the uniqueId of the
* dataViewDefinition in the URL. The bean reads optional cached query data form
* The controller uses the uniqueId from the URL to load the definition.
* The bean reads optional cached query data form
* a session scoped cache EJB and reloads the last state. This is useful for
* situations where the user navigates to a new page (e.g. open a workitem) and
* late uses browser history back.
@ -128,7 +128,7 @@ public class DataViewController extends ViewController {
* This method loads the custom form sections
*/
public void onLoad() {
String cacheid = null;
String uniqueid = null;
// Important: start a new conversation beause of the usage of the
// CustomFormController!
@ -140,8 +140,7 @@ public class DataViewController extends ViewController {
FacesContext fc = FacesContext.getCurrentInstance();
Map<String, String> paramMap = fc.getExternalContext().getRequestParameterMap();
// try to extract the uniqueid form the query string...
cacheid = paramMap.get("cacheid");
String uniqueid = paramMap.get("id");
uniqueid = paramMap.get("id");
if (uniqueid == null || uniqueid.isEmpty()) {
// alternative 'workitem=...'
uniqueid = paramMap.get("workitem");
@ -149,9 +148,8 @@ public class DataViewController extends ViewController {
dataDefinition = documentService.load(uniqueid);
}
logger.finest("> cacheid=" + cacheid);
if (cacheid != null && !cacheid.isEmpty()) {
filter = dataViewCache.get(cacheid);
if (uniqueid != null && !uniqueid.isEmpty()) {
filter = dataViewCache.get(uniqueid);
} else {
filter = new ItemCollection();
}
@ -227,6 +225,7 @@ public class DataViewController extends ViewController {
* @throws QueryException
*/
public void run() throws QueryException {
reset();
// build new query from template
@ -257,6 +256,8 @@ public class DataViewController extends ViewController {
// Prefetch data to update total count and page count
viewHandler.getData(this);
// cache filter
dataViewCache.put(dataDefinition.getUniqueID(), filter);
}

View file

@ -131,9 +131,8 @@ public class DataViewDefinitionController extends AbstractDataController {
*
* @return
*/
public String getViewURI() {
return "/pages/dataviews/data.xhtml?id=" + data.getUniqueID() + "&cacheid=" + System.currentTimeMillis()
+ "&faces-redirect=true";
public String getViewURI(ItemCollection dataDef) {
return "/pages/dataviews/data.xhtml?id=" + dataDef.getUniqueID() + "&faces-redirect=true";
}
@Override

View file

@ -8,7 +8,7 @@
background-position: 4px 6px, center !important;
padding-left: 22px !important;
}
.tooltip-link {
.tooltip-link {
position: relative;
display: inline-block;
}
@ -33,4 +33,15 @@
.tooltip-link:hover .tooltip-text {
visibility: visible;
opacity: 1;
}
}
.dataview .align-right {
text-align: right;
}
.dataview .align-center {
text-align: center;
}
.dataview td {
padding: 5px 10px !important;
}

View file

@ -44,7 +44,7 @@
<h1><span class="typcn typcn-edit"></span> Query Definition
<span style="font-size: 1rem;margin-left:20px;">
<h:outputLink
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.viewURI}"
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataViewDefinitionController.data)}"
target="dataview"><span class="typcn typcn-camera-outline"
style="font-size: 1.2rem;"></span> Test View
</h:outputLink>
@ -223,7 +223,7 @@
<h1><span class="typcn typcn-th-list-outline"></span> Form Definition<span
style="font-size: 1rem;margin-left:20px;">
<h:outputLink
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.viewURI}"
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataViewDefinitionController.data)}"
target="dataview"><span class="typcn typcn-camera-outline"
style="font-size: 1.2rem;"></span> Test View
</h:outputLink>
@ -254,7 +254,7 @@
<h1><span class="typcn typcn-news"></span> Template<span
style="font-size: 1rem;margin-left:20px;">
<h:outputLink
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.viewURI}"
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataViewDefinitionController.data)}"
target="dataview"><span class="typcn typcn-camera-outline"
style="font-size: 1.2rem;"></span> Test View
</h:outputLink>
@ -296,7 +296,6 @@
</dd>
</dl>
<dl>
<dt>
Source File :
@ -305,13 +304,8 @@
<i:imixsFileUpload showattachments="true"
workitem="#{dataViewDefinitionController.data}"
context_url="#{facesContext.externalContext.requestContextPath}/api/snapshot/#{dataViewDefinitionController.data.item['$uniqueid']}" />
</dd>
</dl>
</div>
</div>
</div>
@ -319,8 +313,8 @@
<div class="imixs-footer">
<h:commandButton action="/pages/admin/dataViewDefinitions?faces-redirect=true"
actionListener="#{dataViewDefinitionController.save()}" value="#{message.save}" />
<h:commandButton actionListener="#{dataViewDefinitionController.save()}"
value="#{message.save}" />
<h:commandButton value="Open View"
action="#{dataViewDefinitionController.openTestView()}" />

View file

@ -133,7 +133,7 @@
<div class="imixs-form-section">
<h:dataTable id="view_body" styleClass="imixsdatatable" value="#{searchResult}"
<h:dataTable id="view_body" styleClass="imixsdatatable dataview" value="#{searchResult}"
var="record">
@ -156,7 +156,8 @@
<h:outputText value="#{record.item[columnDef.item['item.name']]}" />
</h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:date'}">
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:date'}"
styleClass="align-center">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}">
<f:convertDateTime timeZone="#{message.timeZone}" type="both"
@ -165,6 +166,22 @@
</h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:double'}"
styleClass="align-right">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
</h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:float'}"
styleClass="align-right">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
</h:column>
<h:column rendered="#{columnDef.item['item.type'] eq 'xs:dateTime'}">
<f:facet name="header">#{columnDef.item['item.label']}</f:facet>
<h:outputText value="#{record.item[columnDef.item['item.name']]}">

View file

@ -82,7 +82,7 @@
<ui:param name="dataViewDescription" value="#{dataview.item['description']}" />
<li>
<h:outputLink title=""
value="#{facesContext.externalContext.requestContextPath}/pages/dataviews/data.xhtml?id=#{dataview.item['$uniqueid']}&amp;faces-redirect=true"
value="#{facesContext.externalContext.requestContextPath}#{dataViewDefinitionController.getViewURI(dataview)}"
target="dataview"><span class="typcn typcn-th-menu"
style="font-size: 1.2rem;margin-right:10px;"></span>
<h:outputText value="#{dataview.item['name']}" />

Binary file not shown.