Skip to content

Commit

Permalink
Merge branch 'master' into feature/connectors-available
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Aug 23, 2022
2 parents 3b62cac + 3bad047 commit 21e9b56
Show file tree
Hide file tree
Showing 64 changed files with 878 additions and 496 deletions.
56 changes: 56 additions & 0 deletions gui/admin-gui/src/frontend/scss/_rounded-icon.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*!
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

.rounded-icon {
display: flex;
border-radius: 50% !important;
align-items: center !important;
justify-content: center !important;
width: 24px;
height: 24px;
min-width: 24px;
min-height: 24px;
border: 2px solid;

&.rounded-icon-sm {
width: 16px !important;
height: 16px !important;
min-width: 16px !important;
min-height: 16px !important;

& > i.fa {
font-size: 0.75em;
line-height: 0.08333em;
}
}

&.rounded-icon-none {
display: none !important;
}

@each $name, $color in $theme-colors {
&.rounded-icon-#{$name} {
&.rounded-icon-partial {
background-color: $white !important;
border-color: $color !important;

& > i {
color: $color !important;
}
}

&.rounded-icon-full {
background-color: $color !important;
border-color: $color !important;

& > i {
color: $white !important;
}
}
}
}
}
29 changes: 1 addition & 28 deletions gui/admin-gui/src/frontend/scss/_tiles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,37 +68,10 @@
background-color: rgba(60, 141, 188, 0.1);
}

& > .check {
width: 24px;
height: 24px;
min-width: 24px;
min-height: 24px;
border: 2px solid;
& > .rounded-icon {
position: relative;
top: -20px;
left: 32px;

&.check-none {
display: none !important;
}

&.check-partial {
background-color: $white !important;
border-color: $success !important;

& > i {
color: $success !important;
}
}

&.check-full {
background-color: $success !important;
border-color: $success !important;

& > i {
color: $white !important;
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@import "wicket";
@import "bs-stepper-custom";

@import "rounded-icon";
@import "tiles";
@import "tables";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* @author semancik
*/
public class BasePanel<T> extends Panel {

private static final long serialVersionUID = 1L;

private IModel<T> model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,18 @@

package com.evolveum.midpoint.gui.impl.component.tile;

import com.evolveum.midpoint.web.component.util.VisibleBehaviour;

import java.io.Serializable;

/**
* Created by Viliam Repan (lazyman).
*/
public class CatalogTile<T extends Serializable> extends Tile<T> {

public enum CheckState {
NONE, PARTIAL, FULL
}

private String description;

private String info;

private CheckState checkState;
private RoundedIconPanel.State checkState;

public CatalogTile() {
this(null, null);
Expand All @@ -50,14 +44,14 @@ public void setInfo(String info) {
this.info = info;
}

public CheckState getCheckState() {
public RoundedIconPanel.State getCheckState() {
if (checkState == null) {
checkState = CheckState.NONE;
checkState = RoundedIconPanel.State.NONE;
}
return checkState;
}

public void setCheckState(CheckState checkState) {
public void setCheckState(RoundedIconPanel.State checkState) {
this.checkState = checkState;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="logo mt-3" wicket:id="logo"/>
<span wicket:id="check" class="check rounded-circle d-flex align-items-center justify-content-center">
<i class="fa fa-check"></i>
</span>
<!-- <span wicket:id="check" class="check rounded-circle d-flex align-items-center justify-content-center border-success bg-white"-->
<!-- style="width: 24px; height: 24px; border: 2px solid; position: relative; top: -20px; left: 32px;">-->
<!-- <i class="fa fa-check text-success"></i>-->
<!-- </span>-->
<span wicket:id="check" class="rounded-icon-success"/>
<span class="mt-4">
<i wicket:id="icon"></i>
<span class="font-weight-bold mx-1" wicket:id="title"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,7 @@ private void initLayout() {
RoundedImagePanel logo1 = new RoundedImagePanel(ID_LOGO, () -> createDisplayType(getModel()), createPreferredImage(getModel()));
add(logo1);

WebMarkupContainer check = new WebMarkupContainer(ID_CHECK);
check.add(AttributeAppender.append("class", () -> {
CatalogTile t = getModelObject();
CatalogTile.CheckState state = t.getCheckState();

if (state == null) {
return "check-none";
}

switch (state) {
case FULL:
return "check-full";
case PARTIAL:
return "check-partial";
case NONE:
default:
return "check-none";
}
}));
RoundedIconPanel check = new RoundedIconPanel(ID_CHECK, () -> "fa fa-check", () -> getModelObject().getCheckState());
add(check);

Label description = new Label(ID_DESCRIPTION, () -> getModelObject().getDescription());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<i wicket:id="icon"></i>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.component.tile;

import com.evolveum.midpoint.gui.api.component.BasePanel;

import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;

/**
* Created by Viliam Repan (lazyman).
*/
public class RoundedIconPanel extends BasePanel<String> {

private static final long serialVersionUID = 1L;

private static final String ID_ICON = "icon";

public enum State {
NONE, PARTIAL, FULL
}

private IModel<State> state;

public RoundedIconPanel(String id, IModel<String> icon, IModel<State> state) {
super(id, icon);

this.state = state;

initLayout();
}

private void initLayout() {
add(AttributeAppender.prepend("class", "rounded-icon"));
add(AttributeAppender.append("class", this::getCssStateClass));

Label icon = new Label(ID_ICON);
icon.add(AttributeAppender.append("class", getModel()));
add(icon);
}

private String getCssStateClass() {
State state = this.state.getObject();
if (state == null) {
return "rounded-icon-none";
}

switch (state) {
case FULL:
return "rounded-icon-full";
case PARTIAL:
return "rounded-icon-partial";
case NONE:
default:
return "rounded-icon-none";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.io.Serializable;
import java.util.List;

import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
Expand All @@ -36,6 +39,8 @@
*/
public class TileTablePanel<T extends Tile, O extends Serializable> extends BasePanel<O> {

private static final long serialVersionUID = 1L;

private static final String ID_TILES_CONTAINER = "tilesContainer";
private static final String ID_TILES = "tiles";

Expand All @@ -47,19 +52,22 @@ public class TileTablePanel<T extends Tile, O extends Serializable> extends Base

private IModel<ViewToggle> viewToggleModel;

private IModel<Search> searchModel;
private IModel<Search<? extends ObjectType>> searchModel;

private UserProfileStorage.TableId tableId;

public TileTablePanel(String id, ISortableDataProvider provider) {
this(id, provider, List.of(), null);
this(id, provider, List.of(), null, null);
}

public TileTablePanel(String id, ISortableDataProvider provider, List<IColumn<O, String>> columns, IModel<ViewToggle> viewToggle) {
public TileTablePanel(String id, ISortableDataProvider provider, List<IColumn<O, String>> columns, IModel<ViewToggle> viewToggle, UserProfileStorage.TableId tableId) {
super(id);

if (viewToggle == null) {
viewToggle = Model.of(ViewToggle.TILE);
}
this.viewToggleModel = viewToggle;
this.tableId = tableId;

initModels();
initLayout(provider, columns);
Expand All @@ -82,7 +90,7 @@ private void initLayout(ISortableDataProvider<O, String> provider, List<IColumn<
tilesContainer.add(new VisibleBehaviour(() -> viewToggleModel.getObject() == ViewToggle.TILE));
add(tilesContainer);

PageableListView<T, O> tiles = new PageableListView<>(ID_TILES, provider) {
PageableListView<T, O> tiles = new PageableListView<>(ID_TILES, provider, tableId) {

@Override
protected void populateItem(ListItem<T> item) {
Expand All @@ -109,7 +117,7 @@ protected String getPaginationCssClass() {
};
add(tilesPaging);

BoxedTablePanel table = new BoxedTablePanel(ID_TABLE, provider, columns) {
BoxedTablePanel table = new BoxedTablePanel(ID_TABLE, provider, columns, tableId) {

@Override
protected WebMarkupContainer createButtonToolbar(String id) {
Expand All @@ -130,6 +138,11 @@ protected String getPaginationCssClass() {
add(table);
}

public ISortableDataProvider<O, String> getProvider() {
PageableListView view = (PageableListView) get(ID_TILES_CONTAINER).get(ID_TILES);
return view.getProvider();
}

protected String getTileCssClasses() {
return null;
}
Expand All @@ -152,7 +165,7 @@ public void refresh(AjaxRequestTarget target) {
}
}

protected IModel<Search> createSearchModel() {
protected IModel<Search<? extends ObjectType>> createSearchModel() {
return null;
}

Expand Down

0 comments on commit 21e9b56

Please sign in to comment.