Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Dec 20, 2022
2 parents c9864fe + 702d2e0 commit 22b11bf
Show file tree
Hide file tree
Showing 25 changed files with 595 additions and 135 deletions.
2 changes: 0 additions & 2 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1479,9 +1479,7 @@ td .prism-property-value {
}
.compositedButton > .compositedButtonIcon {
//background-color: #f1f1f1;
margin: 10px;
text-align: center;
line-height: 75px;
font-size: 50px;
width: 115px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.QNameUtil;

import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -425,9 +426,9 @@ private boolean isAddButtonEnabled(){
return false;
}

private void executeMemberOperation(AbstractRoleType targetObject, ObjectQuery query,
protected Task executeMemberOperation(AbstractRoleType targetObject, ObjectQuery query,
@NotNull QName relation, QName type, AjaxRequestTarget target, PageBase pageBase) {
MemberOperationsHelper.createAndSubmitAssignMembersTask(targetObject, type, query,
return MemberOperationsHelper.createAndSubmitAssignMembersTask(targetObject, type, query,
relation, target, pageBase);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void renderHead(IHeaderResponse response) {
@Override
public void onStepChanged(WizardStep newStep) {
WizardStep step = getActiveStep();
((Component)step).add(AttributeAppender.append("class", () -> getActiveStep().appendCssToWizard()));

addOrReplace((Component) step);
}
Expand All @@ -106,10 +107,11 @@ private IModel<List<IModel<String>>> createStepsModel() {

private void initLayout() {
add(AttributeAppender.prepend("class", "bs-stepper"));
add(AttributeAppender.append("class", () -> getActiveStep().appendCssToWizard()));
add(AttributeAppender.append("class", () -> "w-100"));

WebMarkupContainer header = new WebMarkupContainer(ID_HEADER);
header.add(new BehaviourDelegator(() -> getActiveStep().getStepsBehaviour()));
header.add(AttributeAppender.append("class", getCssForStepsHeader()));
header.setOutputMarkupId(true);
add(header);

Expand Down Expand Up @@ -177,6 +179,27 @@ protected void onNextPerformed(AjaxRequestTarget target) {
add(new WebMarkupContainer(ID_CONTENT_BODY));
}

private String getCssForStepsHeader() {
int steps = wizardModel.getSteps().size();
if (steps == 2) {
return "col-xxl-5 col-xl-7 col-lg-9 col-md-9 col-sm-12 m-auto";
}

if (steps == 3) {
return "col-xxl-7 col-xl-10 col-12 m-auto";
}

if (steps == 4) {
return "col-xxl-10 col-12 m-auto";
}

if (steps >= 5) {
return "col-12 m-auto";
}

return "";
}

public WizardStep getActiveStep() {
return wizardModel.getActiveStep();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="d-flex flex-wrap gap-2 justify-content-center">
<div class="d-block position-relative w-100" wicket:id="layeredIcon">
<span class="d-flex flex-wrap gap-2 justify-content-center">
<span class="d-block position-relative px-3" wicket:id="layeredIcon">
<i wicket:id="basicIcon"/>
<div wicket:id="layerIcons">
<wicket:container wicket:id="layerIcons">
<i wicket:id="layerIcon"/>
</div>
</div>
</wicket:container>
</span>

<wicket:child/>
</div>
</span>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,21 @@
*/
package com.evolveum.midpoint.gui.impl.component.data.column;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.component.password.StringLimitationPanel;
import com.evolveum.midpoint.gui.impl.component.icon.LayerIcon;

import com.evolveum.midpoint.model.api.validator.StringLimitationResult;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebComponent;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon;
import com.evolveum.midpoint.gui.impl.component.icon.LayerIcon;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.IconType;

import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

/**
* @author skublik
*/
Expand All @@ -41,7 +33,6 @@ public class CompositedIconPanel extends BasePanel<CompositedIcon> {
private static final String ID_LAYER_ICONS = "layerIcons";
private static final String ID_LAYER_ICON = "layerIcon";


public CompositedIconPanel(String id, IModel<CompositedIcon> compositedIcon) {
super(id, compositedIcon);
}
Expand All @@ -54,22 +45,22 @@ protected void onInitialize() {

private void initLayout() {
WebMarkupContainer layeredIcon = new WebMarkupContainer(ID_LAYERED_ICON);
layeredIcon.add(AttributeAppender.append("title", (IModel<String>) () -> {
if (getModelObject() != null && org.apache.commons.lang3.StringUtils.isNotBlank(getModelObject().getTitle())) {
layeredIcon.add(AttributeAppender.append("title", () -> {
if (getModelObject() != null && StringUtils.isNotBlank(getModelObject().getTitle())) {
return getModelObject().getTitle();
}
return null;
}));

add(layeredIcon);

WebComponent basicIcon = new WebComponent(ID_BASIC_ICON);
basicIcon.add(AttributeAppender.append("class", (IModel<String>) () -> {
basicIcon.add(AttributeAppender.append("class", () -> {
if (getModelObject() != null && getModelObject().hasBasicIcon()) {
return getModelObject().getBasicIcon();
}
return null;
}));
basicIcon.add(AttributeAppender.append("style", (IModel<String>) () -> {
basicIcon.add(AttributeAppender.append("style", () -> {
if (getModelObject() != null && getModelObject().hasBasicIcon() && getModelObject().hasBasicIconHtmlColor()) {
return "color:" + getModelObject().getBasicIconHtmlColor();
}
Expand All @@ -83,26 +74,26 @@ private void initLayout() {

@Override
protected void populateItem(ListItem<LayerIcon> item) {
if (item.getModelObject() == null) {
LayerIcon layerIcon = item.getModelObject();
if (layerIcon == null) {
return;
}

IconType iconType = layerIcon.getIconType();
if (StringUtils.isEmpty(iconType.getCssClass())) {
return;
}
if (StringUtils.isNotEmpty(item.getModelObject().getIconType().getCssClass())) {
WebComponent icon = new WebComponent(ID_LAYER_ICON);
icon.add(AttributeAppender.append("class", item.getModelObject().getIconType().getCssClass()));
if (StringUtils.isNotEmpty(item.getModelObject().getIconType().getColor())) {
icon.add(AttributeAppender.append("style", "color: " + item.getModelObject().getIconType().getColor()));
}
item.add(icon);

WebComponent icon = new WebComponent(ID_LAYER_ICON);
icon.add(AttributeAppender.append("class", iconType.getCssClass()));
if (StringUtils.isNotEmpty(iconType.getColor())) {
icon.add(AttributeAppender.append("style", "color: " + iconType.getColor()));
}
item.add(icon);
}
};
layeredIcon.add(validationItems);

add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null;
}
});
add(new VisibleBehaviour(() -> getModelObject() != null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public boolean isEnabled() {
}

public boolean isVisible() {
return CollectionUtils.isEmpty(getSearchConfig().getSupportedRelations())
return super.isVisible() && (CollectionUtils.isEmpty(getSearchConfig().getSupportedRelations())
|| getSearchConfig().getDefaultScope() == null
|| !SearchBoxScopeType.SUBTREE.equals(getSearchConfig().getDefaultScope());
|| !SearchBoxScopeType.SUBTREE.equals(getSearchConfig().getDefaultScope()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<i class="fa fa-pen-to-square mr-2"/>
<wicket:message key="MemberTilePanel.details"/>
</a>
<a class="btn btn-link mt-3 ml-auto" wicket:id="unassign">
<a wicket:id="unassign">
<i class="fa fa-link-slash mr-2"/>
<wicket:message key="MemberTilePanel.unassign"/>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ protected void populateItem(ListItem<DisplayType> item) {
add(tagPanel);

Component unassign = createUnassignButton(ID_UNASSIGN);
unassign.add(AttributeAppender.append("class", getCssForUnassignButton()));
add(unassign);
}

protected String getCssForUnassignButton() {
return "btn btn-link mt-3 ml-auto";
}

protected List<InlineMenuItem> createMenuItems() {
return new ArrayList<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<wicket:panel>
<i class="fa-4x text-lightblue mt-5" wicket:id="icon"></i>
<span class="mt-4 text-secondary text-capitalize" wicket:id="title"/>
<div class="tile-description mt-2 text-center text-secondary flex-grow-1" style="display: -webkit-box; text-overflow: ellipsis;" wicket:id="description"/>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

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

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

import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
Expand All @@ -28,6 +33,8 @@ public class TilePanel<T extends Serializable> extends BasePanel<Tile<T>> {
private static final String ID_ICON = "icon";
private static final String ID_TITLE = "title";

private static final String ID_DESCRIPTION = "description";

public TilePanel(String id, IModel<Tile<T>> model) {
super(id, model);

Expand All @@ -47,6 +54,12 @@ private void initLayout() {
return title != null ? getString(title, null, title) : null;
}));

Label description = new Label(ID_DESCRIPTION, () -> getModelObject().getDescription());
description.add(AttributeAppender.replace("title", () -> getModelObject().getDescription()));
description.add(new TooltipBehavior());
description.add(getDescriptionBehaviour());
add(description);

add(new AjaxEventBehavior("click") {

@Override
Expand All @@ -56,6 +69,10 @@ protected void onEvent(AjaxRequestTarget target) {
});
}

protected VisibleEnableBehaviour getDescriptionBehaviour() {
return VisibleEnableBehaviour.ALWAYS_INVISIBLE;
}

protected WebMarkupContainer createIconPanel(String idIcon) {
WebMarkupContainer icon = new WebMarkupContainer(idIcon);
icon.add(AttributeAppender.append("class", () -> getModelObject().getIcon()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public <C extends Containerable> Class<C> getTypeClass() {
}

public QName getType() {
ContainerPanelConfigurationType config = getPanelConfiguration();
if (config == null) {
return null;
}
return getPanelConfiguration().getType();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;

import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType;

import org.apache.wicket.Component;
Expand Down Expand Up @@ -56,6 +57,7 @@ protected List<Tile<CompiledObjectCollectionView>> load() {
null,
WebComponentUtil.getTranslatedPolyString(
GuiDisplayTypeUtil.getLabel(collection.getDisplay())));
tile.setDescription(GuiDisplayTypeUtil.getHelp(collection.getDisplay()));
tile.setValue(collection);
tiles.add(tile);
});
Expand All @@ -77,6 +79,10 @@ protected WebMarkupContainer createIconPanel(String idIcon) {
return new CompositedIconPanel(idIcon, iconModel);
}

protected VisibleEnableBehaviour getDescriptionBehaviour() {
return VisibleEnableBehaviour.ALWAYS_VISIBLE_ENABLED;
}

@Override
protected void onClick(AjaxRequestTarget target) {
Tile<CompiledObjectCollectionView> tile = tileModel.getObject();
Expand Down

0 comments on commit 22b11bf

Please sign in to comment.