This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 3_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/3_0_X by this push:
new 03cbeda635 Improving Enduser UI for User Request management
03cbeda635 is described below
commit 03cbeda635a3e7ae3467b4b444debb654040e150
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Wed May 21 15:17:18 2025 +0200
Improving Enduser UI for User Request management
---
.../markup/html/form/BpmnProcessesAjaxPanel.java | 42 -------------
.../syncope/client/enduser/pages/Flowable.java | 71 +++++++++++-----------
.../client/enduser/panels/UserRequestDetails.java | 13 ++--
.../client/enduser/rest/UserRequestRestClient.java | 37 +++++------
.../client/enduser/pages/Flowable.properties | 3 +-
.../client/enduser/pages/Flowable_it.properties | 3 +-
.../client/enduser/pages/Flowable_ja.properties | 1 +
.../client/enduser/pages/Flowable_pt_BR.properties | 3 +-
.../client/enduser/pages/Flowable_ru.properties | 1 +
.../client/enduser/panels/UserRequestDetails.html | 23 ++++++-
10 files changed, 84 insertions(+), 113 deletions(-)
diff --git
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/markup/html/form/BpmnProcessesAjaxPanel.java
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/markup/html/form/BpmnProcessesAjaxPanel.java
deleted file mode 100644
index 41b72835af..0000000000
---
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/markup/html/form/BpmnProcessesAjaxPanel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.enduser.markup.html.form;
-
-import java.util.Optional;
-import
org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.model.IModel;
-
-public class BpmnProcessesAjaxPanel extends AjaxTextFieldPanel {
-
- private static final long serialVersionUID = 9082907182704884397L;
-
- public BpmnProcessesAjaxPanel(
- final String id, final String name, final IModel<String> model) {
-
- this(id, name, model, null);
- }
-
- public BpmnProcessesAjaxPanel(
- final String id, final String name, final IModel<String> model,
final Behavior behavior) {
-
- super(id, name, model, false);
- Optional.ofNullable(behavior).ifPresent(field::add);
- }
-}
diff --git
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/pages/Flowable.java
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/pages/Flowable.java
index 589b067092..3b5c0e0002 100644
---
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/pages/Flowable.java
+++
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/pages/Flowable.java
@@ -24,13 +24,13 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
-import
org.apache.syncope.client.enduser.markup.html.form.BpmnProcessesAjaxPanel;
import org.apache.syncope.client.enduser.panels.UserRequestDetails;
import org.apache.syncope.client.enduser.rest.BpmnProcessRestClient;
import org.apache.syncope.client.enduser.rest.UserRequestRestClient;
import org.apache.syncope.client.ui.commons.Constants;
import
org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
import org.apache.syncope.client.ui.commons.annotations.ExtPage;
+import
org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
import
org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion;
import org.apache.syncope.common.lib.to.BpmnProcess;
import org.apache.syncope.common.lib.to.UserRequest;
@@ -70,33 +70,6 @@ public class Flowable extends BaseExtPage {
WebMarkupContainer container = new WebMarkupContainer("content");
contentWrapper.add(container.setOutputMarkupId(true));
- // list of accordions containing request form (if any) and delete
button
- DataView<UserRequest> urDataView = new DataView<>(
- "userRequests", new URDataProvider(ROWS_PER_PAGE,
"bpmnProcess")) {
-
- private static final long serialVersionUID = -5002600396458362774L;
-
- @Override
- protected void populateItem(final Item<UserRequest> item) {
- UserRequest userRequest = item.getModelObject();
- item.add(new Accordion("userRequestDetails", List.of(new
AbstractTab(
- new StringResourceModel("user.requests.accordion",
container, Model.of(userRequest))) {
-
- private static final long serialVersionUID =
1037272333056449378L;
-
- @Override
- public WebMarkupContainer getPanel(final String panelId) {
- // find the form associated to the current request, if
any
- return new UserRequestDetails(panelId, userRequest,
container, notificationPanel);
- }
- }), Model.of(-1)).setOutputMarkupId(true));
- }
- };
- urDataView.setItemsPerPage(ROWS_PER_PAGE);
- urDataView.setOutputMarkupId(true);
- container.add(urDataView);
- container.add(new AjaxPagingNavigator("navigator", urDataView));
-
Model<String> bpmnProcessModel = new Model<>();
AjaxLink<Void> startButton = new AjaxLink<>("start") {
@@ -106,7 +79,7 @@ public class Flowable extends BaseExtPage {
public void onClick(final AjaxRequestTarget target) {
if (StringUtils.isNotBlank(bpmnProcessModel.getObject())) {
try {
-
userRequestRestClient.startRequest(bpmnProcessModel.getObject(), null);
+
userRequestRestClient.startRequest(bpmnProcessModel.getObject());
} catch (Exception e) {
LOG.error("Unable to start bpmnProcess [{}]",
bpmnProcessModel.getObject(), e);
SyncopeEnduserSession.get()
@@ -117,13 +90,12 @@ public class Flowable extends BaseExtPage {
}
}
};
-
- startButton.setEnabled(false);
- container.add(startButton);
+ container.add(startButton.setEnabled(false));
// autocomplete select with bpmnProcesses
- BpmnProcessesAjaxPanel bpmnProcesses = new
BpmnProcessesAjaxPanel("bpmnProcesses", "bpmnProcesses",
- bpmnProcessModel, new
IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+ AjaxTextFieldPanel bpmnProcesses = new AjaxTextFieldPanel(
+ "bpmnProcesses", "bpmnProcesses", bpmnProcessModel, false);
+ bpmnProcesses.getField().add(new
IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@@ -135,8 +107,33 @@ public class Flowable extends BaseExtPage {
});
bpmnProcesses.setChoices(bpmnProcessRestClient.getDefinitions().stream().
filter(Predicate.not(BpmnProcess::isUserWorkflow)).
- map(BpmnProcess::getKey).collect(Collectors.toList()));
+
map(BpmnProcess::getKey).sorted().collect(Collectors.toList()));
container.add(bpmnProcesses);
+
+ // list of accordions containing request form (if any) and delete
button
+ DataView<UserRequest> urDataView = new DataView<>(
+ "userRequests", new URDataProvider(ROWS_PER_PAGE,
"bpmnProcess")) {
+
+ private static final long serialVersionUID = -5002600396458362774L;
+
+ @Override
+ protected void populateItem(final Item<UserRequest> item) {
+ UserRequest userRequest = item.getModelObject();
+ item.add(new Accordion("userRequestDetails", List.of(new
AbstractTab(
+ new StringResourceModel("user.requests.accordion",
container, Model.of(userRequest))) {
+
+ private static final long serialVersionUID =
1037272333056449378L;
+
+ @Override
+ public WebMarkupContainer getPanel(final String panelId) {
+ return new UserRequestDetails(panelId, userRequest,
container, notificationPanel);
+ }
+ }), Model.of(-1)).setOutputMarkupId(true));
+ }
+ };
+ urDataView.setItemsPerPage(ROWS_PER_PAGE);
+ container.add(urDataView.setOutputMarkupId(true));
+ container.add(new AjaxPagingNavigator("navigator", urDataView));
}
protected class URDataProvider implements IDataProvider<UserRequest> {
@@ -155,9 +152,9 @@ public class Flowable extends BaseExtPage {
@Override
public Iterator<UserRequest> iterator(final long first, final long
count) {
int page = ((int) first / paginatorRows);
- return userRequestRestClient.listRequests((page < 0 ? 0 : page) +
1,
+ return userRequestRestClient.listRequests(
+ (page < 0 ? 0 : page) + 1,
paginatorRows,
- SyncopeEnduserSession.get().getSelfTO().getUsername(),
new SortParam<>(sortParam, true)).iterator();
}
diff --git
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/panels/UserRequestDetails.java
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/panels/UserRequestDetails.java
index ae03ab3fa5..c834a440b5 100644
---
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/panels/UserRequestDetails.java
+++
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/panels/UserRequestDetails.java
@@ -60,15 +60,14 @@ public class UserRequestDetails extends Panel {
super(id);
UserRequestForm formTO = userRequest.getHasForm()
- ? userRequestRestClient.getForm(
- SyncopeEnduserSession.get().getSelfTO().getUsername(),
- userRequest.getTaskId()).orElse(null)
+ ?
userRequestRestClient.getForm(userRequest.getTaskId()).orElse(null)
: null;
- if (formTO == null || formTO.getProperties() == null ||
formTO.getProperties().isEmpty()) {
- add(new Fragment("fragContainer", "formDetails",
UserRequestDetails.this)
- .add(new Label("executionId",
userRequest.getExecutionId()))
- .add(new Label("startTime", userRequest.getStartTime())));
+ if (formTO == null || formTO.getProperties().isEmpty()) {
+ add(new Fragment("fragContainer", "requestDetails",
UserRequestDetails.this).
+ add(new Label("executionId",
userRequest.getExecutionId())).
+ add(new Label("activityId", userRequest.getActivityId())).
+ add(new Label("startTime", userRequest.getStartTime())));
} else {
Form<Void> form = new Form<>("userRequestWrapForm");
diff --git
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java
index 2d64f52971..6dd775c31f 100644
---
a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java
+++
b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.enduser.rest;
import java.util.List;
import java.util.Optional;
import javax.ws.rs.core.GenericType;
-import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
@@ -37,26 +36,24 @@ public class UserRequestRestClient extends BaseRestClient {
private static final long serialVersionUID = -4785231164900813921L;
- public int countRequests() {
- return getService(UserRequestService.class).
- listRequests(new UserRequestQuery.Builder()
-
.user(SyncopeEnduserSession.get().getSelfTO().getUsername())
- .page(1)
- .size(0)
- .build()).getTotalCount();
+ public long countRequests() {
+ return getService(UserRequestService.class).listRequests(
+ new UserRequestQuery.Builder().
+
user(SyncopeEnduserSession.get().getSelfTO().getUsername()).
+ page(1).size(0).build()).
+ getTotalCount();
}
public List<UserRequest> listRequests(
final int page,
final int size,
- final String username,
final SortParam<String> sort) {
- return getService(UserRequestService.class).listRequests(new
UserRequestQuery.Builder().
- user(StringUtils.isBlank(username)
- ? SyncopeEnduserSession.get().getSelfTO().getUsername()
- : username).
-
page(page).size(size).orderBy(toOrderBy(sort)).build()).getResult();
+ return getService(UserRequestService.class).listRequests(
+ new UserRequestQuery.Builder().
+
user(SyncopeEnduserSession.get().getSelfTO().getUsername()).
+
page(page).size(size).orderBy(toOrderBy(sort)).build()).
+ getResult();
}
public void cancelRequest(final String executionId, final String reason) {
@@ -75,11 +72,9 @@ public class UserRequestRestClient extends BaseRestClient {
getResult();
}
- public Optional<UserRequestForm> getForm(final String username, final
String taskId) {
- return
Optional.ofNullable(getService(UserRequestService.class).getForm(StringUtils.isBlank(username)
- ? SyncopeEnduserSession.get().getSelfTO().getUsername()
- : username,
- taskId));
+ public Optional<UserRequestForm> getForm(final String taskId) {
+ return Optional.ofNullable(getService(UserRequestService.class).
+ getForm(SyncopeEnduserSession.get().getSelfTO().getUsername(),
taskId));
}
public ProvisioningResult<UserTO> submitForm(final UserRequestForm form) {
@@ -88,12 +83,12 @@ public class UserRequestRestClient extends BaseRestClient {
});
}
- public void startRequest(final String bpmnProcess, final String user) {
+ public void startRequest(final String bpmnProcess) {
UserRequestService service = getService(UserRequestService.class);
WebClient.getConfig(WebClient.client(service)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC,
Boolean.FALSE);
- service.startRequest(bpmnProcess, user, null);
+ service.startRequest(bpmnProcess, null, null);
WebClient.getConfig(WebClient.client(service)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC,
Boolean.TRUE);
diff --git
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable.properties
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable.properties
index 61a1f703f3..17cc65dccf 100644
---
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable.properties
+++
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable.properties
@@ -17,8 +17,9 @@
user.requests.accordion=${bpmnProcess} (${activityId})
bpmn.process.title=Requests
submit=Submit
-executionId=Execution ID
+executionId=Execution Id
startTime=Start time
delete=Delete
start=Start
requests.to.be.approved=Your active requests
+activityId=Activity Id
diff --git
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_it.properties
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_it.properties
index 5f11651a86..aba7051a6d 100644
---
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_it.properties
+++
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_it.properties
@@ -17,8 +17,9 @@
user.requests.accordion=${bpmnProcess} (${activityId})
bpmn.process.title=Richieste
submit=Salva
-executionId=Execution ID
+executionId=Id esecuzione
startTime=Eseguito il
delete=Cancella
start=Esegui
requests.to.be.approved=Richieste in lavorazione
+activityId=Id attivit\u00e0
diff --git
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ja.properties
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ja.properties
index 64bcf41d23..2a8e4033b7 100644
---
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ja.properties
+++
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ja.properties
@@ -22,3 +22,4 @@ startTime=\u59cb\u307e\u308b\u6642\u9593
delete=\u30af\u30ea\u30a2
start=\u958b\u59cb
requests.to.be.approved=\u3042\u306a\u305f\u306e\u30a2\u30af\u30c6\u30a3\u30d6\u306a\u30ea\u30af\u30a8\u30b9\u30c8
+activityId=Activity Id
diff --git
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_pt_BR.properties
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_pt_BR.properties
index 947d75efb6..57b7d62683 100644
---
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_pt_BR.properties
+++
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_pt_BR.properties
@@ -17,8 +17,9 @@
user.requests.accordion=${bpmnProcess} (${activityId})
bpmn.process.title=Os pedidos
submit=Enviar
-executionId=Execution ID
+executionId=Execution Id
startTime=Hora de in\u00edcio
delete=Limpa
start=Come\u00e7ar
requests.to.be.approved=Seus pedidos ativos
+activityId=Activity Id
diff --git
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ru.properties
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ru.properties
index 5dba97663f..87cfaccc4a 100644
---
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ru.properties
+++
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/pages/Flowable_ru.properties
@@ -22,3 +22,4 @@
startTime=\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0
delete=\u0440\u0430\u0441\u0441\u0435\u0435\u0442\u0441\u044f
start=\u041d\u0430\u0447\u043d\u0438\u0442\u0435
requests.to.be.approved=\u0412\u0430\u0448\u0438
\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435
\u0437\u0430\u043f\u0440\u043e\u0441\u044b
+activityId=Activity Id
diff --git
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/panels/UserRequestDetails.html
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/panels/UserRequestDetails.html
index c715117996..ac1b54bc2c 100644
---
a/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/panels/UserRequestDetails.html
+++
b/ext/flowable/client-enduser/src/main/resources/org/apache/syncope/client/enduser/panels/UserRequestDetails.html
@@ -21,6 +21,7 @@ under the License.
<wicket:panel>
<div class="card-container-padding">
<span wicket:id="fragContainer"/>
+
<wicket:fragment wicket:id="formProperties">
<form wicket:id="userRequestWrapForm" class="form-horizontal">
<span wicket:id="userRequestFormPanel"></span>
@@ -29,10 +30,26 @@ under the License.
</div>
</form>
</wicket:fragment>
- <wicket:fragment wicket:id="formDetails">
- <span><wicket:message key="executionId"/>: <label
wicket:id="executionId"/></span>
- <span><wicket:message key="startTime"/>: <label
wicket:id="startTime"/></span>
+
+ <wicket:fragment wicket:id="requestDetails">
+ <table class="table table-striped table-bordered">
+ <thead>
+ <tr>
+ <th><wicket:message key="executionId"/></th>
+ <th><wicket:message key="activityId"/></th>
+ <th><wicket:message key="startTime"/></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><span wicket:id="executionId"/></td>
+ <td><span wicket:id="activityId"/></td>
+ <td><span wicket:id="startTime"/></td>
+ </tr>
+ </tbody>
+ </table>
</wicket:fragment>
+
<input wicket:id="delete" type="button" wicket:message="value:delete"
class="btn btn-danger float-left">
</div>
</wicket:panel>