This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_1_X by this push:
     new 9da6aee  Enhancing group search for user edit
9da6aee is described below

commit 9da6aee71ac473a880ccd396850b596c34769354
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Thu Mar 26 09:53:40 2020 +0100

    Enhancing group search for user edit
---
 .../commons/StyledNotificationBehavior.java        |  4 +-
 .../client/console/panels/NotificationPanel.java   |  6 ++-
 .../wicket/markup/html/form/AjaxPalettePanel.java  | 57 +++++++++-----------
 .../syncope/client/console/wizards/any/Groups.java | 31 +++++------
 .../console/SyncopeConsoleApplication.properties   |  1 +
 .../SyncopeConsoleApplication_fr_CA.properties     | 63 +++++++++++-----------
 .../SyncopeConsoleApplication_it.properties        |  1 +
 .../SyncopeConsoleApplication_ja.properties        |  1 +
 .../SyncopeConsoleApplication_pt_BR.properties     |  1 +
 .../SyncopeConsoleApplication_ru.properties        |  1 +
 10 files changed, 86 insertions(+), 80 deletions(-)

diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
index 262871a..a09d678 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/commons/StyledNotificationBehavior.java
@@ -41,8 +41,8 @@ public class StyledNotificationBehavior extends 
NotificationBehavior {
         if (handler != null) {
             handler.appendJavaScript(String.format("%s.options.autoHideAfter = 
%s; %s.show( { message: '%s' } , '%s');",
                     this.widget(),
-                    Notification.SUCCESS.equalsIgnoreCase(level)
-                    || Notification.INFO.equalsIgnoreCase(level) ? 
AUTOHIDEAFTER_SUCCESS : AUTOHIDEAFTER_ERROR,
+                    Notification.SUCCESS.equalsIgnoreCase(level) || 
Notification.INFO.equalsIgnoreCase(level)
+                    ? AUTOHIDEAFTER_SUCCESS : AUTOHIDEAFTER_ERROR,
                     this.widget(),
                     this.format(String.valueOf(message), level),
                     level.toLowerCase()));
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
index ec2fdc2..77cf9e8 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
@@ -41,7 +41,7 @@ public class NotificationPanel extends Panel
     public NotificationPanel(final String id) {
         super(id);
 
-        final Options options = new Options();
+        Options options = new Options();
         options.set("appendTo", "'#appendto'");
         options.set("stacking", "'up'");
         options.set("templates",
@@ -63,6 +63,10 @@ public class NotificationPanel extends Panel
         add(notification);
     }
 
+    public final void hide(final IPartialPageRequestHandler handler) {
+        this.notification.hide(handler);
+    }
+
     public final void refresh(final IPartialPageRequestHandler handler) {
         this.getModelObject().forEach(message -> {
             if (message.isError()) {
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java
index 0d6225f..05dd251 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java
@@ -29,7 +29,9 @@ import java.util.Map;
 import java.util.regex.Pattern;
 import org.apache.commons.collections4.ListUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.pages.BasePage;
 import 
org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -59,15 +61,16 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
 
     public AjaxPalettePanel(
             final String id, final IModel<List<T>> model, final 
Builder.Query<T> choices, final Builder<T> builder) {
+
         super(id, builder.name == null ? id : builder.name, model);
 
-        choicesModel = new PaletteLoadableDetachableModel(builder) {
+        choicesModel = new PaletteLoadableDetachableModel() {
 
             private static final long serialVersionUID = -108100712154481840L;
 
             @Override
             protected List<T> getChoices() {
-                return choices.execute(getFilter());
+                return choices.execute(queryFilter.getObject());
             }
         };
         initialize(model, builder);
@@ -77,14 +80,14 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
             final String id, final IModel<List<T>> model, final 
IModel<List<T>> choices, final Builder<T> builder) {
         super(id, builder.name == null ? id : builder.name, model);
 
-        choicesModel = new PaletteLoadableDetachableModel(builder) {
+        choicesModel = new PaletteLoadableDetachableModel() {
 
             private static final long serialVersionUID = -108100712154481840L;
 
             @Override
             protected List<T> getChoices() {
                 return builder.filtered
-                        ? getFilteredList(choices.getObject(), 
getFilter().replaceAll("\\*", "\\.\\*"))
+                        ? getFilteredList(choices.getObject(), 
queryFilter.getObject().replaceAll("\\*", "\\.\\*"))
                         : choices.getObject();
             }
         };
@@ -179,6 +182,7 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
         Form<?> form = new Form<>("form");
         add(form.setEnabled(builder.filtered).setVisible(builder.filtered));
 
+        queryFilter.setObject(builder.filter);
         AjaxTextFieldPanel filter = new AjaxTextFieldPanel("filter", "filter", 
queryFilter, false);
         form.add(filter.hideLabel().setOutputMarkupId(true));
 
@@ -188,6 +192,12 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
 
             @Override
             protected void onSubmit(final AjaxRequestTarget target) {
+                if (StringUtils.isEmpty(queryFilter.getObject())) {
+                    SyncopeConsoleSession.get().warn(getString("nomatch"));
+                    ((BasePage) 
getPage()).getNotificationPanel().refresh(target);
+                } else {
+                    ((BasePage) getPage()).getNotificationPanel().hide(target);
+                }
                 target.add(palette);
             }
         };
@@ -315,19 +325,8 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
 
         private static final long serialVersionUID = -7745220313769774616L;
 
-        private final Builder<T> builder;
-
-        PaletteLoadableDetachableModel(final Builder<T> builder) {
-            super();
-            this.builder = builder;
-        }
-
         protected abstract List<T> getChoices();
 
-        protected String getFilter() {
-            return StringUtils.isBlank(queryFilter.getObject()) ? 
builder.filter : queryFilter.getObject();
-        }
-
         @Override
         protected List<T> load() {
             final List<T> selected = availableBefore.isEmpty()
@@ -340,16 +339,14 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
         }
 
         private List<T> getSelectedList(final Collection<T> choices, final 
String selection) {
-            final IChoiceRenderer<? super T> renderer = 
palette.getChoiceRenderer();
-            final List<T> selected = new ArrayList<>();
+            IChoiceRenderer<? super T> renderer = palette.getChoiceRenderer();
+            List<T> selected = new ArrayList<>();
 
-            final Map<T, String> idForChoice = new HashMap<>();
-            choices.forEach(choice -> {
-                idForChoice.put(choice, renderer.getIdValue(choice, 0));
-            });
+            Map<T, String> idForChoice = new HashMap<>();
+            choices.forEach(choice -> idForChoice.put(choice, 
renderer.getIdValue(choice, 0)));
 
-            for (final String id : Strings.split(selection, ',')) {
-                final Iterator<T> iter = choices.iterator();
+            for (String id : Strings.split(selection, ',')) {
+                Iterator<T> iter = choices.iterator();
                 boolean found = false;
                 while (!found && iter.hasNext()) {
                     final T choice = iter.next();
@@ -365,18 +362,16 @@ public class AjaxPalettePanel<T extends Serializable> 
extends AbstractFieldPanel
         }
 
         protected List<T> getFilteredList(final Collection<T> choices, final 
String filter) {
-            final IChoiceRenderer<? super T> renderer = 
palette.getChoiceRenderer();
-            final List<T> selected = new ArrayList<>(choices.size());
+            IChoiceRenderer<? super T> renderer = palette.getChoiceRenderer();
+            List<T> selected = new ArrayList<>(choices.size());
 
-            final Map<T, String> idForChoice = new HashMap<>();
-            choices.forEach(choice -> {
-                idForChoice.put(choice, renderer.getIdValue(choice, 0));
-            });
+            Map<T, String> idForChoice = new HashMap<>();
+            choices.forEach(choice -> idForChoice.put(choice, 
renderer.getIdValue(choice, 0)));
 
-            final Pattern pattern = Pattern.compile(filter, 
Pattern.CASE_INSENSITIVE);
+            Pattern pattern = Pattern.compile(filter, 
Pattern.CASE_INSENSITIVE);
 
             choices.forEach(choice -> {
-                final String idValue = idForChoice.get(choice);
+                String idValue = idForChoice.get(choice);
                 if (pattern.matcher(idValue).matches()) {
                     selected.add(choice);
                 }
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
index bdc2730..98eff48 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Groups.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.client.console.wizards.any;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -114,7 +115,7 @@ public class Groups extends AbstractGroups {
                         }
                     });
 
-            
groupsContainer.add(builder.setAllowOrder(true).withFilter().build("groups",
+            
groupsContainer.add(builder.setAllowOrder(true).withFilter("*").build("groups",
                     new ListModel<MembershipTO>() {
 
                 private static final long serialVersionUID = 
-2583290457773357445L;
@@ -130,20 +131,20 @@ public class Groups extends AbstractGroups {
 
                 @Override
                 public List<MembershipTO> execute(final String filter) {
-                    return (StringUtils.isEmpty(filter) || "*".equals(filter)
-                            ? groupsModel.getObject()
-                            : groupRestClient.search(
-                                    anyTO.getRealm(),
-                                    
SyncopeClient.getGroupSearchConditionBuilder().
-                                            
isAssignable().and("name").equalToIgnoreCase(filter).query(),
-                                    1, Constants.MAX_GROUP_LIST_SIZE,
-                                    new SortParam<>("name", true),
-                                    null)).stream().map(input -> {
-
-                                return new MembershipTO.Builder().
-                                        group(input.getKey(), input.getName()).
-                                        build();
-                            }).collect(Collectors.toList());
+                    return StringUtils.isEmpty(filter)
+                            ? Collections.emptyList()
+                            : ("*".equals(filter)
+                                    ? groupsModel.getObject()
+                                    : groupRestClient.search(
+                                            anyTO.getRealm(),
+                                            
SyncopeClient.getGroupSearchConditionBuilder().
+                                                    
isAssignable().and("name").equalToIgnoreCase(filter).query(),
+                                            1, Constants.MAX_GROUP_LIST_SIZE,
+                                            new SortParam<>("name", true),
+                                            null)).stream().
+                                    map(group -> new MembershipTO.Builder().
+                                    group(group.getKey(), 
group.getName()).build()).
+                                    collect(Collectors.toList());
                 }
             }).hideLabel().setOutputMarkupId(true));
 
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
index a3e5785..be10086 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
@@ -75,3 +75,4 @@ timeout=Operation is taking too long: it will be executed in 
background. Please
 security=Security
 before=Before
 after=After
+nomatch=No matches found
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
index f3824d7..e98987c 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
@@ -20,56 +20,57 @@ configuration=Configuration
 resources=Ressources
 connectors=Raccordements
 reports=Rapports
-tasks=T�ches
-logout=D�connexion
-schema=Sch�ma
-operation_succeeded=Op�ration compl�t�e avec succ�s
-operation_error=Une erreur s'est produite pendant l'op�ration
+tasks=T\u00e2ches
+logout=D\u00e9connexion
+schema=Sch\u00e9ma
+operation_succeeded=Op\u00e9ration compl\u00e9t\u00e9e avec succ\u00e8s
+operation_error=Une erreur s'est produite pendant l'op\u00e9ration
 alert=Alerte:
-confirmDelete=Voulez-vous vraiment supprimer le(s) article(s) s�lectionn�(s)?
-confirmUnlink=Voulez-vous vraiment supprimer le lien entre le(s) article(s) 
s�lectionn�(s) et la ressource?
-confirmUnassign=Souhaitez-vous vraiment supprimer l'affectation entre le(s) 
article(s) s�lectionn�(s) et la ressource?
-confirmDeprovision=Souhaitez-vous vraiment d�provisionner le(s) article(s) 
s�lectionn�(s)?
-confirmProvision=Souhaitez-vous vraiment approvisionner le(s) article(s) 
s�lectionn�(s)?
-confirmClone=Voulez-vous vraiment cloner le(s) article(s) s�lectionn�(s)?
+confirmDelete=Voulez-vous vraiment supprimer le(s) article(s) 
s\u00e9lectionn\u00e9(s)?
+confirmUnlink=Voulez-vous vraiment supprimer le lien entre le(s) article(s) 
s\u00e9lectionn\u00e9(s) et la ressource?
+confirmUnassign=Souhaitez-vous vraiment supprimer l'affectation entre le(s) 
article(s) s\u00e9lectionn\u00e9(s) et la ressource?
+confirmDeprovision=Souhaitez-vous vraiment d\u00e9provisionner le(s) 
article(s) s\u00e9lectionn\u00e9(s)?
+confirmProvision=Souhaitez-vous vraiment approvisionner le(s) article(s) 
s\u00e9lectionn\u00e9(s)?
+confirmClone=Voulez-vous vraiment cloner le(s) article(s) 
s\u00e9lectionn\u00e9(s)?
 dropDownChoiceField.nullValid=Faire un choix
-DateTimeField$HoursValidator=La valeur horaire doit �tre dans la gamme (1, 12)
+DateTimeField$HoursValidator=La valeur horaire doit \u00eatre dans la gamme 
(1, 12)
 error=Erreur
-generic_error=Une erreur s'est produite pendant l'op�ration
-id=Cl�
+generic_error=Une erreur s'est produite pendant l'op\u00e9ration
+id=Cl\u00e9
 name=Nom
 palette.available=Disponible
-palette.selected=S�lectionn�
+palette.selected=S\u00e9lectionn\u00e9
 jexl_info=Ce champ requiert une expression JEXL, par exemple:
-jexl_ex1=nom de famille + ',' + pr�nom
+jexl_ex1=nom de famille + ',' + pr\u00e9nom
 jexl_ex2=new.' + nom de famille
-jexl_syntax_url=R�f�rence JEXL compl�te
-create=Cr�er
-key=Cl�
+jexl_syntax_url=R\u00e9f\u00e9rence JEXL compl\u00e8te
+create=Cr\u00e9er
+key=Cl\u00e9
 types=Types
 dashboard=Page d'accueil
 realms=Domaines
 topology=Topologie
-roles=R�les
+roles=R\u00f4les
 policies=Politiques
 workflow=Flux
 logs=Registres
 layouts=Dispositions
 notifications=Notifications
-parameters=Param�tres
+parameters=Param\u00e8tres
 extensions=Extensions
-NavigatorLabel=Affichage des rang�es ${from} � ${to} de ${of}
-displayRows=Rang�es � afficher
+NavigatorLabel=Affichage des rang\u00e9es ${from} \u00e0 ${to} de ${of}
+displayRows=Rang\u00e9es \u00e0 afficher
 OrderByLink.CSS.ascending=tri_asc
 OrderByLink.CSS.descending=tri_desc
 OrderByLink.CSS.none=tri
-entitlements=Droits et privil�ges
+entitlements=Droits et privil\u00e8ges
 audit=Audit
-connectors.confirm.reload=Cette demande est potentiellement dangereuse pour le 
d�roulement des op�rations, continuer?
-intAttrNameInfo.help=En plus des attributs auto-compl�t�s, vous pouvez 
�galement faire r�f�rence � des groupes, des objets, des appartenances ou des 
privil�ges, par exemple:
-confirmGlobalLogout=Voulez-vous vraiment effectuer une d�connexion compl�te?
-implementations=Impl�mentations
-timeout=L'op�ration prend trop de temps: elle sera ex�cut�e en arri�re-plan. 
Veuillez v�rifier plus tard le r�sultat (les erreurs ne seront pas d�tect�es).
-security=S�curit�
+connectors.confirm.reload=Cette demande est potentiellement dangereuse pour le 
d\u00e9roulement des op\u00e9rations, continuer?
+intAttrNameInfo.help=En plus des attributs auto-compl\u00e9t\u00e9s, vous 
pouvez \u00e9galement faire r\u00e9f\u00e9rence \u00e0 des groupes, des objets, 
des appartenances ou des privil\u00e8ges, par exemple:
+confirmGlobalLogout=Voulez-vous vraiment effectuer une d\u00e9connexion 
compl\u00e8te?
+implementations=Impl\u00e9mentations
+timeout=L'op\u00e9ration prend trop de temps: elle sera ex\u00e9cut\u00e9e en 
arri\u00e8re-plan. Veuillez v\u00e9rifier plus tard le r\u00e9sultat (les 
erreurs ne seront pas d\u00e9tect\u00e9es).
+security=S\u00e9curit\u00e9
 before=Avant
-after=Apr�s
+after=Apr\u00e8s
+nomatch=Aucune correspondance trouv\u00e9e
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
index bb0b3af..1cd8df1 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
@@ -75,3 +75,4 @@ timeout=L'operazione sta durando troppo: sar\u00e0 eseguita 
in background. Verif
 security=Sicurezza
 before=Prima
 after=Dopo
+nomatch=Nessun risultato trovato
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
index 2d90f0c..a0275df 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
@@ -73,3 +73,4 @@ 
timeout=\u64cd\u4f5c\u306b\u9577\u6642\u9593\u304b\u304b\u3063\u3066\u3044\u307e
 security=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3
 before=\u524d
 after=\u5f8c
+nomatch=No matches found
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
index c1ed8c6..8e2a574 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
@@ -75,3 +75,4 @@ timeout=Operation is taking too long: it will be executed in 
background. Please
 security=Security
 before=Before
 after=After
+nomatch=Nenhuma correspond\u00eancia encontrada
diff --git 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
index 6619e1d..2154692 100644
--- 
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
+++ 
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
@@ -74,3 +74,4 @@ timeout=Operation is taking too long: it will be executed in 
background. Please
 security=Security
 before=Before
 after=After
+nomatch=No matches found

Reply via email to