Skip to content

Commit

Permalink
MID-7963 css option to create tile "not selectable" (without hover bo…
Browse files Browse the repository at this point in the history
…rder)
  • Loading branch information
1azyman committed Jun 14, 2022
1 parent 23a32c8 commit 8e4a54f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
32 changes: 23 additions & 9 deletions gui/admin-gui/src/frontend/scss/_tiles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@
* Contains all styles for all kinds of tile panels
*/

@mixin selectable-tile {
@mixin tile {
border: 2px solid $white;
border-radius: $border-radius;
background-color: $white;

&.selectable {
@include selectable-tile();
}
}

@mixin selectable-tile {
cursor: pointer;

&:hover,
Expand All @@ -22,11 +29,17 @@
}
}

@mixin selectable-tile-dark-mode {
@mixin tile-dark-mode {
border-color: $secondary-alt;
background-color: lighten($dark, 7.5%) !important;
color: $white !important;

&.selectable {
@include selectable-tile-dark-mode();
}
}

@mixin selectable-tile-dark-mode {
&:hover,
&.active {
border-color: $primary-alt;
Expand All @@ -37,19 +50,20 @@
width: 250px;
height: 250px;

@include selectable-tile();
@include tile();
}

@include dark-mode () {
@include dark-mode() {
.tile-panel {
@include selectable-tile-dark-mode();
@include tile-dark-mode();
}
}

.catalog-tile-panel {
width: 317px;
height: 376px;
@include selectable-tile();

@include tile();

& > .logo {
min-width: 84px;
Expand All @@ -61,8 +75,8 @@
}
}

@include dark-mode () {
.catalog-tile-panel {
@include selectable-tile-dark-mode();
@include dark-mode() {
.catalog-tile-panel.selectable {
@include tile-dark-mode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<wicket:fragment wicket:id="tileFragment">
<div class="d-flex flex-wrap gap-3 justify-content-center mt-5" wicket:id="listContainer">
<wicket:container wicket:id="list">
<div wicket:id="tile"/>
<div class="selectable" wicket:id="tile"/>
</wicket:container>
</div>
</wicket:fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<wicket:extend>
<div class="d-flex flex-wrap gap-3 justify-content-center mt-5" wicket:id="listContainer">
<wicket:container wicket:id="list">
<div wicket:id="tile"/>
<div class="selectable" wicket:id="tile"/>
</wicket:container>
</div>
</wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import java.util.Objects;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.util.logging.Trace;

import com.evolveum.midpoint.util.logging.TraceManager;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
Expand Down Expand Up @@ -55,6 +59,8 @@ public class RoleCatalogPanel extends WizardStepPanel<RequestAccess> {

private static final long serialVersionUID = 1L;

private static final Trace LOGGER = TraceManager.getTrace(RoleCatalogPanel.class);

private static final String DOT_CLASS = RoleCatalogPanel.class.getName() + ".";
private static final String OPERATION_LOAD_ROLE_CATALOG_MENU = DOT_CLASS + "loadRoleCatalogMenu";

Expand Down Expand Up @@ -210,6 +216,8 @@ protected List<ListGroupMenuItem> load() {
add(menu);
}

// todo use configuration getAllowedViews from RoleCatalogType

private IModel<ViewToggle> createViewToggleModel() {
return new LoadableModel<>(false) {

Expand Down Expand Up @@ -251,10 +259,17 @@ private RoleCatalogType getRoleCatalogConfiguration() {
}

private List<ListGroupMenuItem> loadRoleCatalogMenu() {
CompiledGuiProfile profile = getPageBase().getCompiledGuiProfile();
AccessRequestType accessRequest = profile.getAccessRequest();
RoleCatalogType roleCatalog = accessRequest.getRoleCatalog();
RoleCatalogType roleCatalog = getRoleCatalogConfiguration();
if (roleCatalog == null) {
return new ArrayList<>();
}

ObjectReferenceType ref = roleCatalog.getRoleCatalogRef();
if (ref != null) {
return loadMenuItems(ref);
}

// todo custom menu tree definition, not via org. tree hierarchy

return loadMenuItems(ref);
}
Expand All @@ -280,11 +295,12 @@ private List<ListGroupMenuItem> loadMenuItems(ObjectReferenceType ref) {
try {
List<PrismObject<ObjectType>> objects = WebModelServiceUtils.searchObjects(ot.getClassDefinition(), query, result, getPageBase());
for (PrismObject o : objects) {
ListGroupMenuItem menu = new ListGroupMenuItem(WebComponentUtil.getName(o));
String name = WebComponentUtil.getDisplayNameOrName(o, true);
ListGroupMenuItem menu = new ListGroupMenuItem(name);
list.add(menu);
}
} catch (Exception ex) {
ex.printStackTrace();
LOGGER.debug("Couldn't load menu using role catalog reference to org. structure, reason: " + ex.getMessage(), ex);
}

return list;
Expand Down

0 comments on commit 8e4a54f

Please sign in to comment.