Skip to content

Commit

Permalink
MID-7976 request access ui, poi now selectable via collectionRef, imp…
Browse files Browse the repository at this point in the history
…roved tile/table layout
  • Loading branch information
1azyman committed Jul 13, 2022
1 parent 4054e7d commit 4b4972b
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 16 deletions.
6 changes: 0 additions & 6 deletions gui/admin-gui/src/frontend/scss/_tiles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
}

.tile-panel {
width: 250px;
height: 250px;

@include tile();
}

Expand All @@ -60,9 +57,6 @@
}

.catalog-tile-panel {
width: 317px;
height: 376px;

@include tile();

& > .logo {
Expand Down
5 changes: 5 additions & 0 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1725,3 +1725,8 @@ th.debug-list-buttons {
}
}
}

.role-catalog-tiles-table .catalog-tile-panel {
height: 376px;
margin-bottom: $grid-gutter-width;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<wicket:enclosure child="tilesContainer">
<div class="d-flex flex-column flex-grow-1 gap-3">
<div wicket:id="tilesHeader"/>
<div class="d-flex flex-grow-1 flex-wrap gap-3" wicket:id="tilesContainer">
<wicket:container wicket:id="tiles">
<div class="row" wicket:id="tilesContainer">
<div wicket:id="tiles">
<div wicket:id="tile"/>
</wicket:container>
</div>
</div>
<div class="align-self-end" wicket:id="tilesPaging"/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
Expand Down Expand Up @@ -85,6 +86,8 @@ private void initLayout(ISortableDataProvider<O, String> provider, List<IColumn<

@Override
protected void populateItem(ListItem<T> item) {
item.add(AttributeAppender.append("class", () -> getTileCssClasses()));

Component tile = createTile(ID_TILE, item.getModel());
item.add(tile);
}
Expand Down Expand Up @@ -122,6 +125,10 @@ protected Component createHeader(String headerId) {
add(table);
}

protected String getTileCssClasses() {
return null;
}

protected Component createTile(String id, IModel<T> model) {
return new CatalogTilePanel(id, model);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import com.evolveum.midpoint.gui.api.component.wizard.BasicWizardPanel;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.component.tile.Tile;
import com.evolveum.midpoint.gui.impl.component.tile.TilePanel;
import com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.security.api.MidPointPrincipal;
import com.evolveum.midpoint.security.api.SecurityUtil;
Expand Down Expand Up @@ -313,7 +315,7 @@ private void groupOthersPerformed(AjaxRequestTarget target, Tile<PersonOfInteres
}

private ObjectFilter createObjectFilterFromGroupSelection(String identifier) {
if (identifier==null) {
if (identifier == null) {
return null;
}

Expand All @@ -333,12 +335,20 @@ private ObjectFilter createObjectFilterFromGroupSelection(String identifier) {
return null;
}

SearchFilterType search;
if (collection.getCollectionRef() != null) {
com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType collectionRef = collection.getCollectionRef();
// todo use collection somehow as well
PrismObject obj = WebModelServiceUtils.loadObject(collectionRef, getPageBase());
if (obj == null) {
return null;
}

ObjectCollectionType objectCollection = (ObjectCollectionType) obj.asObjectable();
search = objectCollection.getFilter();
} else {
search = collection.getFilter();
}

SearchFilterType search = collection.getFilter();
if (search == null) {
return null;
}
Expand All @@ -362,7 +372,6 @@ private void selectManuallyPerformed(AjaxRequestTarget target) {
filter = createObjectFilterFromGroupSelection(identifier);
}

// todo user group identifier from tile PersonOfInterest to properly filter users, also support collections somehow
ObjectBrowserPanel<UserType> panel = new ObjectBrowserPanel<>(getPageBase().getMainPopupBodyId(), UserType.class,
List.of(UserType.COMPLEX_TYPE), true, getPageBase(), filter) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-4 col-xxl-2 d-flex flex-column align-items-stretch gap-3">
<div class="col-sm-12 col-md-5 col-lg-4 col-xxl-2 d-flex flex-column align-items-stretch gap-3">
<div wicket:id="viewToggle"/>
<ul wicket:id="menu"/>
</div>
<wicket:remove>
<!-- todo mt-2 added because search panel now uses *-sm classes and it doesn't match rest of the layout -->
</wicket:remove>
<div class="col-sm-12 col-md-6 col-lg-8 col-xxl-10 mt-2" wicket:id="tilesTable"/>
<div class="col-sm-12 col-md-7 col-lg-8 col-xxl-10 mt-2 role-catalog-tiles-table" wicket:id="tilesTable"/>
</div>
</wicket:panel>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected Search load() {

List<IColumn<SelectableBean<ObjectType>, String>> columns = createColumns();
TileTablePanel<CatalogTile<SelectableBean<ObjectType>>, SelectableBean<ObjectType>> tilesTable =
new TileTablePanel<CatalogTile<SelectableBean<ObjectType>>, SelectableBean<ObjectType>>(ID_TILES, provider, columns, createViewToggleModel()) {
new TileTablePanel<>(ID_TILES, provider, columns, createViewToggleModel()) {

@Override
protected WebMarkupContainer createTableButtonToolbar(String id) {
Expand Down Expand Up @@ -198,6 +198,11 @@ protected void onClick(AjaxRequestTarget target) {
};
}

@Override
protected String getTileCssClasses() {
return "col-12 col-md-6 col-lg-4 col-xxl-2";
}

@Override
protected IModel<Search> createSearchModel() {
return searchModel;
Expand Down

0 comments on commit 4b4972b

Please sign in to comment.