Skip to content

Commit

Permalink
request access wizard, catalog tiles, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed May 27, 2022
1 parent 3d29bea commit 68d196f
Show file tree
Hide file tree
Showing 13 changed files with 229 additions and 99 deletions.
13 changes: 13 additions & 0 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,7 @@ th.debug-list-buttons {
height: 250px;
border: 2px solid $white;
border-radius: $border-radius;
background-color: $white;
cursor: pointer;

&:hover,
Expand All @@ -1768,6 +1769,18 @@ th.debug-list-buttons {
}
}

.catalog-tile-panel {
width: 317px;
height: 376px;
background-color: $white;

&:hover,
&.active {
border: 2px solid $lightblue;
border-radius: $border-radius;
}
}

.details-menu-panel {
min-width: 273px;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ protected void onInitialize() {
initLayout();
}

public IModel<Wizard> getModel() {
return model;
}

@Override
protected void onComponentTag(ComponentTag tag) {
checkComponentTag(tag, "div");
Expand Down Expand Up @@ -81,6 +85,7 @@ private void initLayout() {
model = Model.of(new Wizard(steps.size()));

add(AttributeAppender.prepend("class", "bs-stepper"));
add(AttributeAppender.append("class", () -> getCurrentPanel().appendCssToWizard()));

WebMarkupContainer header = new WebMarkupContainer(ID_HEADER);
header.setOutputMarkupId(true);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public WizardHeader(String id, IModel<String> currentPanelTitle, IModel<String>
}

private void initLayout(IModel<String> currentPanelTitle, IModel<String> nextPanelTitle) {
add(AttributeAppender.append("class", "d-flex align-items-center flex-wrap gap-2"));
add(AttributeAppender.append("class", "d-flex align-items-center flex-wrap gap-3 mb-3"));

AjaxLink back = createBackButton(ID_BACK);
add(back);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
*/
public interface WizardPanel {

default String appendCssToWizard() {
return null;
}

default IModel<String> getTitle() {
String key = getClass().getSimpleName() + ".title";
return () -> Application.get().getResourceSettings().getLocalizer().getString(key, null, key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<body>
<wicket:extend>

<div style="display: none;">
<hr class="my-5"/>

<div class="d-flex flex-column flex-sm-row gap-2">
Expand All @@ -22,6 +23,7 @@
</div>

<hr class="my-5"/>
</div>

<form wicket:id="mainForm" class="d-flex justify-content-center">
<div wicket:id="wizard">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,34 @@ private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);

PersonOfInterestPanel personOfInterest = new PersonOfInterestPanel(ID_PERSON_OF_INTEREST) {
WizardBorder wizard = new WizardBorder(ID_WIZARD) {

@Override
protected void onNextPerformed(AjaxRequestTarget target) {
// wizard.nextStep();
//
// target.add(wizard);
protected List<WizardPanel> createSteps() {
return PageRequestAccess.this.createSteps(this);
}
};
wizard.setOutputMarkupId(true);
mainForm.add(wizard);

RoleCatalogPanel roleCatalog = new RoleCatalogPanel(ID_ROLE_CATALOG) {
//todo delete
add(new DetailsMenuPanel("menu"));
}

private List<WizardPanel> createSteps(WizardBorder border) {
PersonOfInterestPanel personOfInterest = new PersonOfInterestPanel(ID_PERSON_OF_INTEREST) {

@Override
protected void onBackPerformed(AjaxRequestTarget target) {
// wizard.previousStep();
//
// target.add(wizard);
protected void onNextPerformed(AjaxRequestTarget target) {
border.getModel().getObject().nextStep();

target.add(border);
}
};

RoleCatalogPanel roleCatalog = new RoleCatalogPanel(ID_ROLE_CATALOG);
ShoppingCartPanel shoppingCart = new ShoppingCartPanel(ID_SHOPPING_CART);

WizardBorder wizard = new WizardBorder(ID_WIZARD) {

@Override
protected List<WizardPanel> createSteps() {
return Arrays.asList(personOfInterest, roleCatalog, shoppingCart);
}
};
wizard.setOutputMarkupId(true);
mainForm.add(wizard);

//todo delete
add(new DetailsMenuPanel("menu"));
return Arrays.asList(personOfInterest, roleCatalog, shoppingCart);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* 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.page.self.requestAccess;

import java.io.Serializable;

/**
* Created by Viliam Repan (lazyman).
*/
public class CatalogTile implements Serializable {

private String icon;

private String title;

private boolean selected;

public CatalogTile() {
this(null, null);
}

public CatalogTile(String icon, String title) {
this.icon = icon;
this.title = title;
}

public String getIcon() {
return icon;
}

public void setIcon(String icon) {
this.icon = icon;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public boolean isSelected() {
return selected;
}

public void setSelected(boolean selected) {
this.selected = selected;
}

public void toggle() {
setSelected(!isSelected());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
~ 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>
<div class="d-flex justify-content-center mt-3" style="width: 84px; height: 84px; border-radius: 108px; background-color: rgba(60, 141, 188, 0.1);">
<i class="fas fa-utensils fa-3x align-self-center text-lightblue"></i>
</div>
<span class="mt-4">
<i class="fas fa-puzzle-piece text-secondary"></i>
<span class="text-secondary font-weight-bold mx-1">Office 365 Package</span>
<i class="fas fa-info-circle fa-xs text-primary"></i>
</span>
<span class="mt-2 text-center">User role that gives you access to Office 365 products</span>
<a class="btn btn-lightblue mt-3">
<i class="fas fa-cart-plus mr-2"></i>
Add to cart
</a>
<a class="btn btn-link text-lightblue mt-2">
Details
</a>

<i class="fas fa-user-circle fa-4x text-lightblue mt-5" wicket:id="icon"></i>
<span class="mt-4 text-secondary" wicket:id="title"/>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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.page.self.requestAccess;

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

import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
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;

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

private static final long serialVersionUID = 1L;

private static final String ID_ICON = "icon";
private static final String ID_TITLE = "title";

public CatalogTilePanel(String id, IModel<CatalogTile> model) {
super(id, model);

initLayout();
}

private void initLayout() {
add(AttributeAppender.append("class", "catalog-tile-panel d-flex flex-column align-items-center bordered p-4"));
add(AttributeAppender.append("class", () -> getModelObject().isSelected() ? "active" : null));

WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeAppender.append("class", () -> getModelObject().getIcon()));
add(icon);

add(new Label(ID_TITLE, () -> {
String title = getModelObject().getTitle();
return title != null ? getString(title, null, title) : null;
}));

add(new AjaxEventBehavior("click") {

@Override
protected void onEvent(AjaxRequestTarget target) {
CatalogTilePanel.this.onClick(target);
}
});
}

protected void onClick(AjaxRequestTarget target) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public DetailsMenuPanel(String id) {
}

private void initLayout() {
add(AttributeAppender.append("class", "details-menu-panel d-flex rounded bg-white align-self-stretch align-self-sm-start"));
add(AttributeAppender.append("class", "details-menu-panel d-flex rounded bg-white align-self-stretch align-self-md-start"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,22 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="d-flex flex-column align-items-center mt-5">
<div class="d-flex align-items-center gap-3">
<a class="btn btn-outline btn-outline-primary" wicket:id="back">
<i class="fas fa-arrow-left mr-2"></i>
Back
</a>
<h3>Role catalog</h3>
<span class="badge badge-info">Requesting for 4 users</span>

<ol class="breadcrumb flex-grow-1 m-0 p-0">
<li class="breadcrumb-item">
<i class="fas fa-user"></i>
munch
</li>
<li class="breadcrumb-item">
<a href="#">
<i class="fas fa-user"></i>
munch
</a>
</li>
</ol>
</div>
<div class="align-self-end">
search
</div>
<div class="d-flex flex-column justify-content-between w-100 gap-2">
<!-- <div wicket:id="menu"/>-->
<div class="d-flex">
<div class="d-flex flex-column align-items-center bordered p-4" style="width: 317px; height: 345px; background: #fff;">
<div class="d-flex justify-content-center" style="width: 84px; height: 84px; border-radius: 108px; background-color: rgba(60, 141, 188, 0.1);">
<i class="fas fa-utensils fa-3x align-self-center text-lightblue"></i>
</div>
<span class="mt-4">
<i class="fas fa-puzzle-piece text-secondary"></i>
<span class="text-secondary font-weight-bold mx-1">Office 365 Package</span>
<i class="fas fa-info-circle fa-xs text-primary"></i>
</span>
<span class="mt-2 text-center">User role that gives you access to Office 365 products</span>
<a class="btn btn-lightblue mt-3">
<i class="fas fa-cart-plus mr-2"></i>
Add to cart
</a>
<a class="btn btn-link text-lightblue mt-2">
Details
</a>
</div>
<div class="d-flex flex-column flex-md-row gap-3">
<div class="d-flex flex-column align-items-stretch gap-3">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default">
<i class="far fa-list-alt"></i>
</button>
<button type="button" class="btn btn-default">
<i class="fas fa-border-all"></i>
</button>
</div>
<div wicket:id="menu"/>
</div>
<div class="flex-grow-1">
<wicket:container wicket:id="tiles">
<div wicket:id="tile"/>
</wicket:container>
</div>
</div>
</wicket:panel>
Expand Down

0 comments on commit 68d196f

Please sign in to comment.