directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-commander git commit: FC-177 - remove kendo UI datatable control
Date Fri, 26 Aug 2016 16:50:38 GMT
Repository: directory-fortress-commander
Updated Branches:
  refs/heads/master bb4233471 -> d95afe8c8


FC-177 - remove kendo UI datatable control


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/commit/d95afe8c
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/tree/d95afe8c
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/diff/d95afe8c

Branch: refs/heads/master
Commit: d95afe8c8d26dbf8dd182167a2d618925aeaac3b
Parents: bb42334
Author: Shawn McKinney <smckinney@apache.org>
Authored: Fri Aug 26 10:45:31 2016 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Fri Aug 26 10:45:31 2016 -0500

----------------------------------------------------------------------
 .../fortress/web/FortressWebBasePage.java       |   2 -
 .../apache/directory/fortress/web/NavPanel.java |  13 --
 .../fortress/web/common/GlobalIds.java          |   2 +-
 .../fortress/web/panel/GroupDetailPanel.java    | 178 ++++++++-----------
 .../fortress/web/FortressWebBasePage.html       |   2 -
 .../apache/directory/fortress/web/NavPanel.html |   2 -
 .../fortress/web/panel/GroupDetailPanel.html    |  59 +++++-
 7 files changed, 123 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
index c54f5be..9da9a5e 100644
--- a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
+++ b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
@@ -120,10 +120,8 @@ public abstract class FortressWebBasePage extends WebPage
             OuPermPage.class, parameters, org.apache.directory.fortress.web.common.GlobalIds.ROLE_PERMOUS
);
         add( permouLink );
 
-        /* TODO: Add groups back:
         add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.GROUP_PAGE,
GroupPage.class,
             org.apache.directory.fortress.web.common.GlobalIds.ROLE_GROUPS ) );
-        */
 
         add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_BINDS_PAGE,
AuditBindPage.class,
             org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_BINDS ) );

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/java/org/apache/directory/fortress/web/NavPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/NavPanel.java b/src/main/java/org/apache/directory/fortress/web/NavPanel.java
index 78e71dd..b3d1844 100644
--- a/src/main/java/org/apache/directory/fortress/web/NavPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/NavPanel.java
@@ -478,35 +478,24 @@ public class NavPanel extends FormComponentPanel
 
             );
 
-            /*
-            TODO: Add Group Back (replace datatable)
             add( new SecureIndicatingAjaxButton( GlobalIds.GROUP_PAGE, GlobalIds.ROLE_GROUPS
)
             {
-                */
-                /** Default serialVersionUID *//*
-
                 private static final long serialVersionUID = 1L;
 
-
                 @Override
                 public void onSubmit( AjaxRequestTarget target, Form<?> form )
                 {
                     setResponsePage( GroupPage.class );
                 }
 
-
                 @Override
                 protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
                 {
                     super.updateAjaxAttributes( attributes );
                     AjaxCallListener ajaxCallListener = new AjaxCallListener()
                     {
-                        */
-                        /** Default serialVersionUID *//*
-
                         private static final long serialVersionUID = 1L;
 
-
                         @Override
                         public CharSequence getFailureHandler( Component component )
                         {
@@ -516,9 +505,7 @@ public class NavPanel extends FormComponentPanel
                     attributes.getAjaxCallListeners().add( ajaxCallListener );
                 }
             }
-
             );
-            */
 
             add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_BINDS_PAGE, GlobalIds.ROLE_AUDIT_BINDS
)
             {

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
index 851942b..19bc342 100644
--- a/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
+++ b/src/main/java/org/apache/directory/fortress/web/common/GlobalIds.java
@@ -51,7 +51,7 @@ public class GlobalIds
     public static final String DEL_REVIEW_MGR = "org.apache.directory.fortress.core.impl.DelReviewMgrImpl";
     public static final String PWPOLICY_MGR = "org.apache.directory.fortress.core.impl.PwPolicyMgrImpl";
     public static final String AUDIT_MGR = "org.apache.directory.fortress.core.impl.AuditMgrImpl";
-    public static final String GROUP_MGR = "org.apache.directory.fortress.core.ldap.group.GroupMgrImpl";
+    public static final String GROUP_MGR = "org.apache.directory.fortress.core.impl.GroupMgrImpl";
     public static final String ASSIGN_USER = "assignUser";
     public static final String ADD = "add";
     public static final String COMMIT = "commit";

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
index 8c2f2f1..b7a6e71 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
@@ -20,25 +20,22 @@
 
 package org.apache.directory.fortress.web.panel;
 
-
-import com.googlecode.wicket.jquery.core.Options;
-//import com.googlecode.wicket.kendo.ui.datatable.ColumnButton;
-import com.googlecode.wicket.kendo.ui.datatable.DataTable;
-//import com.googlecode.wicket.kendo.ui.datatable.column.CommandsColumn;
-import com.googlecode.wicket.kendo.ui.datatable.column.IColumn;
-import com.googlecode.wicket.kendo.ui.datatable.column.PropertyColumn;
 import com.googlecode.wicket.kendo.ui.form.combobox.ComboBox;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.fortress.core.*;
+import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.log4j.Logger;
+import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.attributes.AjaxCallListener;
 import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
 import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
 import org.apache.wicket.event.IEvent;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
@@ -46,8 +43,12 @@ import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.FormComponentPanel;
 import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.markup.repeater.data.DataView;
 import org.apache.wicket.markup.repeater.data.IDataProvider;
 import org.apache.wicket.markup.repeater.data.ListDataProvider;
+import org.apache.wicket.model.AbstractReadOnlyModel;
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.PropertyModel;
@@ -58,16 +59,15 @@ import org.apache.directory.fortress.web.event.SaveModelEvent;
 import org.apache.directory.fortress.web.control.SecureIndicatingAjaxButton;
 import org.apache.directory.fortress.web.event.SelectModelEvent;
 import org.apache.directory.fortress.core.model.Group;
-import org.apache.directory.fortress.core.GroupMgr;
 import org.apache.directory.fortress.core.model.User;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
 
+
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
@@ -105,15 +105,11 @@ public class GroupDetailPanel extends FormComponentPanel
         /** Default serialVersionUID */
         private static final long serialVersionUID = 1L;
         private Component component;
-        private DataTable<Member> table;
-        private List<IColumn> columns;
-        private Options options;
         private String memberAssign;
         private TextField memberAssignTF;
         private ComboBox<String> memberPropsCB;
         private String memberPropsSelection;
 
-
         public GroupDetailForm( String id, final IModel<Group> model )
         {
             super( id, model );
@@ -122,7 +118,6 @@ public class GroupDetailPanel extends FormComponentPanel
             setOutputMarkupId( true );
         }
 
-
         private void addGroupDetailFields()
         {
             add( new Label( "groupAssignmentsLabel", "Group Detail" ) );
@@ -139,24 +134,71 @@ public class GroupDetailPanel extends FormComponentPanel
                 "memberPropsSelection" ), new ArrayList<String>() );
             memberPropsCB.setOutputMarkupId( true );
             add( memberPropsCB );
-
             memberAssignTF = new TextField( "memberAssign", new PropertyModel( this, "memberAssign"
) );
             memberAssignTF.setOutputMarkupId( true );
             add( memberAssignTF );
             addUserSearchModal();
-
-            // DataTable //
-            //columns = newColumnList();
-            options = new Options();
-            options.set( "selectable", Options.asString( "single" ) );
-            options.set( "scrollable", "{ virtual: true }" ); //infinite scroll
-            options.set( "height", 300 );
-            options.set( "pageable", "{ pageSizes: [ 5, 10, 15, 20 ] }" );
-            table = new DataTable<>( "memberstable", columns, createDataProvider( null
), ROWS, options );
-            table.setOutputMarkupId( true );
-            add( table );
+            createDataTable( null );
         }
 
+        private void createDataTable( List<String> members )
+        {
+            DataView< Member > view = new DataView<Member>("members", createDataProvider(
members ) )
+            {
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                protected void populateItem(final Item<Member> item)
+                {
+                    Member member = item.getModelObject();
+                    item.add( new Label( "index", member.getIndex() ) );
+                    item.add( new Label( "userDn", member.getUserDn() ) );
+                    item.add( AttributeModifier.replace( "class", new AbstractReadOnlyModel<String>()
+                    {
+                        private static final long serialVersionUID = 1L;
+
+                        @Override
+                        public String getObject()
+                        {
+                            return ( item.getIndex() % 2 == 1 ) ? "even" : "odd";
+                        }
+                    } ));
+
+                    AjaxFallbackLink<Member> removeLink = new AjaxFallbackLink<Member>(
"remove-member", item.getModel() )
+                    {
+                        @Override
+                        public void onClick(AjaxRequestTarget target)
+                        {
+                            Member member = item.getModelObject();
+                            Group group = ( Group ) editForm.getModel().getObject();
+                            try
+                            {
+                                String memberId = getUserId( member.getUserDn() );
+                                Group newGroup = groupMgr.deassign( group, memberId );
+                                group.setMembers( newGroup.getMembers() );
+                                String msg = "Group: " + group.getName() + ", member: " +
memberId
+                                    + ", has been deassigned";
+                                display.setMessage( msg );
+                                component = editForm;
+                                createDataTable( newGroup.getMembers() );
+                            }
+                            catch( SecurityException se )
+                            {
+                                String szError = "Group deassign failed group: " + se;
+                                display.setMessage( szError );
+                                log.warn( szError );
+                            }
+                            target.add( component );
+                        }
+                    };
+                    removeLink.setOutputMarkupId( true );
+                    item.add(removeLink);
+                }
+            };
+            view.setItemsPerPage( 5L );
+            addOrReplace( view );
+            addOrReplace( new PagingNavigator( "navigator", view ) );
+        }
 
         private void addGroupButtons()
         {
@@ -528,7 +570,6 @@ public class GroupDetailPanel extends FormComponentPanel
                     {
                         try
                         {
-                            // TODO: figure out how to get the table to refresh its values
here:
                             String userId = getUserId( memberAssign );
                             if( userId != null )
                             {
@@ -539,9 +580,9 @@ public class GroupDetailPanel extends FormComponentPanel
                                     + ", has been assigned";
                                 memberAssign = "";
                                 form.add( memberAssignTF );
-                                addMemberTable( group );
                                 display.setMessage( msg );
                                 log.debug( msg );
+                                createDataTable( newGroup.getMembers() );
                             }
                         }
                         catch ( org.apache.directory.fortress.core.SecurityException se )
@@ -601,14 +642,13 @@ public class GroupDetailPanel extends FormComponentPanel
                             {
                                 Group newGroup = groupMgr.deassign( group, userId );
                                 group.setMembers( newGroup.getMembers() );
-
                                 String msg = "Group: " + group.getName() + ", member: " +
memberAssign
                                     + ", has been deassigned";
                                 memberAssign = "";
                                 form.add( memberAssignTF );
-                                addMemberTable( group );
                                 display.setMessage( msg );
                                 log.debug( msg );
+                                createDataTable( newGroup.getMembers() );
                             }
                         }
                         catch ( org.apache.directory.fortress.core.SecurityException se )
@@ -658,39 +698,12 @@ public class GroupDetailPanel extends FormComponentPanel
             memberPropsCB = new ComboBox<>( "memberProps", new PropertyModel<String>(
form,
                 "memberPropsSelection" ), new ArrayList<String>() );
             editForm.addOrReplace( memberPropsCB );
-            table.refresh( target );
-            table = new DataTable<>( "memberstable", columns, createDataProvider( null
), ROWS, options );
-            editForm.addOrReplace( table );
+            createDataTable( null );
             modelChanged();
             component = editForm;
             display.setMessage( msg );
         }
 
-
-/*
-        private List<IColumn> newColumnList()
-        {
-            List<IColumn> columns = new ArrayList<>();
-            columns.add( new PropertyColumn( "#", "index", 30 ) );
-            columns.add( new PropertyColumn( "User DN", "userDn", 150 ) );
-            columns.add( new CommandsColumn( "", 100 )
-            {
-
-                private static final long serialVersionUID = 1L;
-
-
-                @Override
-                public List<ColumnButton> newButtons()
-                {
-                    return Arrays.asList( new ColumnButton( "remove", "userDn" ) );
-                }
-            } );
-
-            return columns;
-        }
-*/
-
-
         private IDataProvider<Member> createDataProvider( List<String> members
)
         {
             ListDataProvider<Member> results;
@@ -753,7 +766,6 @@ public class GroupDetailPanel extends FormComponentPanel
             {
                 private static final long serialVersionUID = 1L;
 
-
                 @Override
                 protected void onSubmit( AjaxRequestTarget target, Form<?> form )
                 {
@@ -812,7 +824,7 @@ public class GroupDetailPanel extends FormComponentPanel
                         "memberPropsSelection" ), group.getPropList() );
                     editForm.addOrReplace( memberPropsCB );
                 }
-                addMemberTable( group );
+                createDataTable( group.getMembers() );
                 String msg = "Group Name: " + group.getName() + " has been selected";
                 display.setMessage( msg );
                 log.debug( msg );
@@ -832,52 +844,6 @@ public class GroupDetailPanel extends FormComponentPanel
             }
         }
 
-
-        private void addMemberTable( final Group group )
-        {
-            table = new DataTable<Member>( "memberstable", columns, createDataProvider(
group.getMembers() ), ROWS,
-                options )
-            {
-                /** Default serialVersionUID */
-                private static final long serialVersionUID = 1L;
-
-                /**
-                 * Triggered when a column button is clicked.
-                 */
-/*
-                @Override
-                public void onClick( AjaxRequestTarget target, ColumnButton button, String
value )
-                {
-                    if ( StringUtils.isNotEmpty( value ) )
-                    {
-                        try
-                        {
-                            // TODO: figure out how to get the table to refresh its values
here:
-                            String userId = getUserId( value );
-                            if( userId != null )
-                            {
-                                Group newGroup = groupMgr.deassign( group, userId );
-                                group.setMembers( newGroup.getMembers() );
-                                table.refresh( target );
-                                String msg = "User: " + userId + ", deassigned from group:
" + group.getName();
-                                display.setMessage( msg );
-                                log.debug( msg );
-                            }
-                        }
-                        catch ( org.apache.directory.fortress.core.SecurityException se )
-                        {
-                            String error = "Failed deassign user: " + value + ", SecurityException="
+ se;
-                            log.warn( error );
-                            display.setMessage( error );
-                        }
-                    }
-                }
-*/
-            };
-
-            addOrReplace( table );
-        }
-
         /**
          * Method will retrieve the userId from a distinguished name variable.
          *

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
b/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
index 03465f4..6319e8f 100644
--- a/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
+++ b/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
@@ -71,10 +71,8 @@
             &nbsp
             <a href="#" wicket:id="pwpolicies">PLCYS</a>
             &nbsp
-<!--
             <a href="#" wicket:id="groups">GROUPS</a>
             &nbsp
--->
             <a href="#" wicket:id="binds">BINDS</a>
             &nbsp
             <a href="#" wicket:id="authzs">AUTHZ</a>

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/resources/org/apache/directory/fortress/web/NavPanel.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/directory/fortress/web/NavPanel.html b/src/main/resources/org/apache/directory/fortress/web/NavPanel.html
index 5c53d86..219a6b1 100644
--- a/src/main/resources/org/apache/directory/fortress/web/NavPanel.html
+++ b/src/main/resources/org/apache/directory/fortress/web/NavPanel.html
@@ -88,13 +88,11 @@
                     <button wicket:id="pwpolicies">PLCYS&nbsp</button>
                 </td>
             </tr>
-<!--
             <tr>
                 <td>
                     <button wicket:id="groups">GROUP</button>
                 </td>
             </tr>
--->
             <tr>
                 <td>
                     <button wicket:id="binds">BINDS&nbsp</button>

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/d95afe8c/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
b/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
index da1f5ae..9cae4cb 100644
--- a/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
+++ b/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
@@ -65,22 +65,41 @@
                     </td>
                 </tr>
                 <tr>
+                    <td colspan="3"><hr/></td>
+                </tr>
+                <tr>
                     <td>
                         <label for="memberProps">Properties</label>
                     </td>
                     <td>
                         <input type="text" wicket:id="memberProps"  id="memberProps" style="width:
250px"/>
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <label>Operations</label>
+                    </td>
+                    <td>
                         <button wicket:id="memberProps.add" name="memberProps.add">add</button>
                         <button wicket:id="memberProps.delete" name="memberProps.delete">delete</button>
                     </td>
                 </tr>
                 <tr>
+                    <td colspan="3"><hr/></td>
+                </tr>
+                <tr>
                     <td>
                         <label for="memberAssign">User DN</label>
                     </td>
                     <td>
                         <input type="text" wicket:id="memberAssign" id="memberAssign"
class="formLarge" style="width: 250px"/>
-
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <label for="memberAssign">Operations</label>
+                    </td>
+                    <td>
                         <input type="button" class="ui-button ui-widget ui-state-default
ui-corner-all ui-button-text-only"
                                wicket:id="members.search" name="members.search" value="search"/>
 
@@ -93,17 +112,39 @@
                         <div wicket:id="membersmodal"></div>
                     </td>
                 </tr>
+                <tr>
+                    <td colspan="3"><hr/></td>
+                </tr>
+                <tr>
+                    <td>
+                        <label>Members</label>
+                    </td>
+                    <td>
+                        <span wicket:id="navigator">[dataview navigator]</span>
+                        <table cellspacing="0" class="dataview">
+                            <tr>
+                                <th></th>
+                                <th></th>
+                                <th>#   </th>
+                                <th></th>
+                                <th>DN</th>
+                            </tr>
+                            <tr wicket:id="members">
+                                <td><a href="#" wicket:id="remove-member">remove</a></td>
+                                <td><span>        </span></td>
+                                <td><span wicket:id="index">[id]</span>
</td>
+                                <td><span>        </span></td>
+                                <td><span wicket:id="userDn">[userDn]</span></td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+                <tr>
+                    <td colspan="3"><hr/></td>
+                </tr>
             </table>
-            <div wicket:id="memberstable" id="modstable" style="width: 720px;"></div>
         </fieldset>
     </form>
-    <!-- Group attributes:
-        "name",
-        "description",
-        "protocol",
-        "members",
-        "props",
-    -->
 </wicket:panel>
 </body>
 </html>
\ No newline at end of file


Mime
View raw message