Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
* 'master' of github.com:Evolveum/midpoint:
  MID-7976 request access ui, more bugfixes for steps skipping/hiding
  MID-7976 refreshing state of steps everytime they become active, fixed default relation handling
  MID-7976 wizard improvements to support steps visibility and skipping, wip
  MID-7976 attempt to improve wizard, fix steps skipping, wip
  MID-7976 fixed localization, and initial system config
  adding part of resource wizard for attribute mapping
  MID-7976 catalog item details panel, wip
  MID-7976 gui profile compiler - better merging for accessRequest configuration
  Make TestUserTemplate more stable
  Fix bulk modification of multiple objects
  adding wizard for resource object wizard
  adding panel for Resource wizard preview
  adding small improvements for selection resource template panel of new resource wizard
  • Loading branch information
katkav committed Aug 1, 2022
2 parents 43acc0b + a1f4e27 commit ece3660
Show file tree
Hide file tree
Showing 108 changed files with 4,052 additions and 679 deletions.
6 changes: 6 additions & 0 deletions gui/admin-gui/src/frontend/js/midpoint-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,10 @@ export default class MidPointTheme {
iconElement.className = 'fa fa-eye';
}
}

updatePageUrlParameter(paramName, paramValue) {
var queryParams = new URLSearchParams(window.location.search);
queryParams.set(paramName, paramValue);
history.replaceState(null, null, "?" + queryParams.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="row" wicket:id="itemPath">
<div class="pull-left" style="width: 90%;">
<div wicket:id="itemPath">
<div class="pull-left">
<div wicket:id="namespaceModeConteiner">
<div wicket:id="namespace" style="padding-bottom: 5px;" />
<div wicket:id="definition"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
~ Copyright (c) 2022 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="d-flex flex-column gap-3 align-items-center mt-5">
<h2 class="mb-3" wicket:id="text"/>
<h5 class="text-secondary mb-5" wicket:id="subText"/>
<div class="col-12">
<wicket:child/>
</div>
<div class="d-flex gap-3 justify-content-center">
<a class="btn" wicket:id="buttons"/>
</div>
</div>
</wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* 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.api.component.wizard;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.web.component.AjaxIconButton;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.page.admin.resources.PageResources;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

public abstract class AbstractWizardBasicPanel extends BasePanel {

private static final String ID_TEXT = "text";
private static final String ID_SUBTEXT = "subText";
private static final String ID_BUTTONS = "buttons";

private final ResourceDetailsModel resourceModel;
public AbstractWizardBasicPanel(String id, ResourceDetailsModel resourceModel) {
super(id);
this.resourceModel = resourceModel;
}

public ResourceDetailsModel getResourceModel() {
return resourceModel;
}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout();
}

private void initLayout() {

Label mainText = new Label(ID_TEXT, getTextModel());
mainText.add(new VisibleBehaviour(() -> getTextModel().getObject() != null));
add(mainText);

Label secondaryText = new Label(ID_SUBTEXT, getSubTextModel());
secondaryText.add(new VisibleBehaviour(() -> getSubTextModel().getObject() != null));
add(secondaryText);

RepeatingView buttons = new RepeatingView(ID_BUTTONS);

AjaxIconButton exit = new AjaxIconButton(
buttons.newChildId(),
Model.of("fa fa-right-from-bracket"),
getPageBase().createStringResource("ResourceWizard.exit")) {
@Override
public void onClick(AjaxRequestTarget target) {
onExitPerformed(target);
}
};
exit.showTitleAsLabel(true);
exit.add(AttributeAppender.append("class", "btn btn-outline-primary"));
buttons.add(exit);

addCustomButtons(buttons);
add(buttons);
}

protected void onExitPerformed(AjaxRequestTarget target) {
getPageBase().navigateToNext(PageResources.class);
}

protected void addCustomButtons(RepeatingView buttons) {
}

protected IModel<String> getSubTextModel(){
return getPageBase().createStringResource(getClass().getSimpleName() + ".text");
};

protected IModel<String> getTextModel(){
return getPageBase().createStringResource(getClass().getSimpleName() + ".subText");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ <h5 class="text-secondary mb-5" wicket:id="subText"/>
<i class="fas fa-arrow-left mr-2"></i>
<wicket:message key="WizardHeader.back"/>
</a>
<a class="btn btn-outline-primary" wicket:id="exit">
<i class="fas fa-arrow-left mr-2"></i>
<wicket:message key="WizardPanel.exit"/>
</a>
<a class="btn btn-success" wicket:id="next">
<wicket:message key="WizardHeader.next"/>
<span wicket:id="nextLabel"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
Expand All @@ -24,20 +22,21 @@
/**
* @author lskublik
*/
public class BasicWizardPanel<T> extends WizardStepPanel<T> {
public class BasicWizardStepPanel<T> extends WizardStepPanel<T> {

private static final long serialVersionUID = 1L;

private static final String ID_TEXT = "text";
private static final String ID_SUBTEXT = "subText";
private static final String ID_BACK = "back";
private static final String ID_EXIT = "exit";
private static final String ID_NEXT = "next";
private static final String ID_NEXT_LABEL = "nextLabel";

public BasicWizardPanel() {
public BasicWizardStepPanel() {
}

public BasicWizardPanel(IModel<T> model) {
public BasicWizardStepPanel(IModel<T> model) {
super(model);
}

Expand Down Expand Up @@ -70,6 +69,19 @@ public void onClick(AjaxRequestTarget target) {
WebComponentUtil.addDisabledClassBehavior(back);
add(back);

AjaxLink exit = new AjaxLink<>(ID_EXIT) {

@Override
public void onClick(AjaxRequestTarget target) {
onExitPerformed(target);
}
};
exit.add(getExitVisibility());
exit.setOutputMarkupId(true);
exit.setOutputMarkupPlaceholderTag(true);
WebComponentUtil.addDisabledClassBehavior(exit);
add(exit);

AjaxSubmitButton next = new AjaxSubmitButton(ID_NEXT) {

@Override
Expand All @@ -92,6 +104,17 @@ protected void onError(AjaxRequestTarget target) {
next.add(nextLabel);
}

private VisibleBehaviour getExitVisibility() {
return new VisibleBehaviour(() -> isExitButtonVisible());
}

protected boolean isExitButtonVisible() {
return false;
}

protected void onExitPerformed(AjaxRequestTarget target) {
}

protected IModel<String> getNextLabelModel() {
return () -> {
WizardStep step = getWizard().getNextPanel();
Expand All @@ -102,10 +125,6 @@ protected IModel<String> getNextLabelModel() {
protected void updateFeedbackPanels(AjaxRequestTarget target) {
}

protected WebMarkupContainer createContentPanel(String id) {
return new WebMarkupContainer(id);
}

protected AjaxSubmitButton getNext() {
return (AjaxSubmitButton) get(ID_NEXT);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.evolveum.midpoint.gui.api.component.wizard;

import java.io.Serializable;

public interface TileEnum extends Serializable {
String getIcon();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
~ Copyright (c) 2022 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:extend>
<div class="request-access-wizard d-flex flex-wrap gap-3 justify-content-center">
<wicket:container wicket:id="list">
<div class="card mb-0 simple-tile selectable" wicket:id="tile"/>
</wicket:container>
</div>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* 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.api.component.wizard;

import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.impl.component.tile.Tile;
import com.evolveum.midpoint.gui.impl.component.tile.TilePanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;

import org.apache.commons.lang3.Validate;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;

import java.util.ArrayList;
import java.util.List;

public abstract class WizardChoicePanel<T extends TileEnum> extends AbstractWizardBasicPanel {

private static final String ID_LIST = "list";
private static final String ID_TILE = "tile";

private LoadableModel<List<Tile<T>>> tiles;

private final Class<T> tileTypeClass;

/**
* @param tileTypeClass have to be Enum class
**/
public WizardChoicePanel(String id, ResourceDetailsModel resourceModel, Class<T> tileTypeClass) {
super(id, resourceModel);
Validate.isAssignableFrom(Enum.class, tileTypeClass);
this.tileTypeClass = tileTypeClass;
}

@Override
protected void onInitialize() {
super.onInitialize();
initModels();
initLayout();
}

private void initModels() {
tiles = new LoadableModel<>(false) {

@Override
protected List<Tile<T>> load() {
List<Tile<T>> list = new ArrayList<>();

for (T type : tileTypeClass.getEnumConstants()) {
Tile tile = new Tile(type.getIcon(), getString((Enum) type));
tile.setValue(type);
list.add(tile);
}
addDefaultTile(list);

return list;
}
};
}

protected void addDefaultTile(List<Tile<T>> list) {
}

private void initLayout() {
ListView<Tile<T>> list = new ListView<>(ID_LIST, tiles) {

@Override
protected void populateItem(ListItem<Tile<T>> item) {
TilePanel tp = new TilePanel(ID_TILE, item.getModel()) {

@Override
protected void onClick(AjaxRequestTarget target) {
Tile<T> tile = item.getModelObject();
onTileClick(tile.getValue(), target);
}
};
item.add(tp);
}
};
add(list);
}

protected abstract void onTileClick(T value, AjaxRequestTarget target);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Created by Viliam Repan (lazyman).
*/
public class WizardHeader extends BasePanel {
public class WizardHeader extends BasePanel implements WizardListener {

private static final long serialVersionUID = 1L;

Expand All @@ -36,13 +36,13 @@ public class WizardHeader extends BasePanel {

private WizardModel model;

private int activeStepIndex = -1;

public WizardHeader(String id, WizardModel model) {
super(id);

this.model = model;

model.addWizardListener(this);

IModel<String> currentPanelTitle = () -> model.getActiveStep().getTitle().getObject();
IModel<String> nextPanelTitle = () -> {
WizardStep next = model.getNextPanel();
Expand All @@ -53,10 +53,8 @@ public WizardHeader(String id, WizardModel model) {
}

@Override
protected void onBeforeRender() {
public void onStepChanged(WizardStep newStep) {
addOrReplace(createHeaderContent(ID_CONTENT));

super.onBeforeRender();
}

private void initLayout(IModel<String> currentPanelTitle, IModel<String> nextPanelTitle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@
*/
public interface WizardListener {

void onStepChanged();
default void onStepChanged(WizardStep newStep) {
}

default void onCancel() {
}

default void onFinish() {
}
}

0 comments on commit ece3660

Please sign in to comment.