Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Jun 13, 2022
2 parents 1664990 + 29bbcef commit f81ff19
Show file tree
Hide file tree
Showing 27 changed files with 516 additions and 148 deletions.
58 changes: 58 additions & 0 deletions gui/admin-gui/src/frontend/js/list-group-menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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.
*/
import $ from 'jquery';

const NAME = 'list-group-menu'
const VERSION = '0.1'
const DATA_KEY = 'mp.list-group-menu'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
const JQUERY_NO_CONFLICT = $.fn[NAME]

// todo implement properly
class ListGroupMenu {

constructor(element, config) {
}

static get VERSION() {
return VERSION
}

static get Default() {
return Default
}

static _jQueryInterface(config) {

}
}

$.fn[NAME] = ListGroupMenu._jQueryInterface
$.fn[NAME].Constructor = ListGroupMenu
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
return ListGroupMenu._jQueryInterface
}

export default ListGroupMenu;

$(document).ready(function () {
$('.list-group-menu').find('.chevron').parent().click(function (event) {
event.preventDefault();

var link = $(this);
var item = link.parent();
var submenu = item.find('.list-group-submenu');
if (!submenu.is(':visible')) {
$(submenu).slideDown();
} else {
console.info('visible');
$(submenu).slideUp();
}
});
});
1 change: 1 addition & 0 deletions gui/admin-gui/src/frontend/js/midpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import MidPointTheme from './midpoint-theme';
import MidPointAceEditor from "./ace-editor";
import "./list-group-menu";

window.MidPointTheme = new MidPointTheme();
window.MidPointAceEditor = new MidPointAceEditor();
1 change: 1 addition & 0 deletions gui/admin-gui/src/frontend/scss/_list-group-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ $list-group-item-padding-sm-x: 1rem;

.list-group-submenu-item {
@include list-group-menu-item;
border-radius: inherit;

// 3rd level padding
& .list-group-submenu > .list-group-submenu-item > a {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,11 @@ private SideBarMenuItem createSelfServiceMenu(boolean experimentalFeaturesEnable
pageParameters.add(OnePageParameterEncoder.PARAMETER, WebModelServiceUtils.getLoggedInFocusOid());
menu.addMainMenuItem(createMainMenuItem("PageAdmin.menu.profile", GuiStyleConstants.CLASS_ICON_PROFILE,
WebComponentUtil.resolveSelfPage(), pageParameters));
menu.addMainMenuItem(createMainMenuItem("PageAdmin.menu.credentials", GuiStyleConstants.CLASS_ICON_CREDENTIALS,
PageSelfCredentials.class));
/** menu item which leads to new self Credentials page
// old self credentials page is commented
// menu.addMainMenuItem(createMainMenuItem("PageAdmin.menu.credentials", GuiStyleConstants.CLASS_ICON_CREDENTIALS,
// PageSelfCredentials.class));
menu.addMainMenuItem(createMainMenuItem("PageAdmin.menu.credentials", GuiStyleConstants.CLASS_ICON_CREDENTIALS,
com.evolveum.midpoint.gui.impl.page.self.credentials.PageSelfCredentials.class));
*/
if (WebModelServiceUtils.getLoggedInFocus() instanceof UserType) {
menu.addMainMenuItem(createMainMenuItem("PageAdmin.menu.request", GuiStyleConstants.CLASS_ICON_REQUEST,
PageAssignmentShoppingCart.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<wicket:extend>

<div style="width:300px;">
<ul wicket:id="sample"/>
<hr class="m-5"/>
<ul class="list-group-menu list-group-menu-sm align-self-stretch align-self-md-start">
<li class="list-group-menu-item">
<a href="#" class="item-link active">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.gui.impl.page.self;

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

Expand Down Expand Up @@ -97,6 +98,30 @@ private void initLayout() {
WizardPanel wizard = new WizardPanel(ID_WIZARD, new WizardModel(createSteps()));
wizard.setOutputMarkupId(true);
mainForm.add(wizard);

List<ListGroupMenuItem> list = new ArrayList<>();
ListGroupMenuItem allRoles = new ListGroupMenuItem("fa fa-fw fa-border-all", "All roles");
allRoles.setActive(true);
list.add(allRoles);

ListGroupMenuItem rolesOfTeamMate = new ListGroupMenuItem("fa fa-fw fa-users", "Roles of team mate");
rolesOfTeamMate.setBadge("12");
list.add(rolesOfTeamMate);

ListGroupMenuItem menu2 = new ListGroupMenuItem("fa fa-fw fa-users", "Roles of team mate");
list.add(menu2);

ListGroupMenuItem o1 = new ListGroupMenuItem(null, "Option 1");
menu2.getItems().add(o1);
ListGroupMenuItem o2 = new ListGroupMenuItem(null, "Option 2");
menu2.getItems().add(o2);
ListGroupMenuItem o3 = new ListGroupMenuItem(null, "Option 3");
menu2.getItems().add(o3);
ListGroupMenuItem o31 = new ListGroupMenuItem(null, "Option 31");
o3.getItems().add(o31);

ListGroupMenuPanel sample = new ListGroupMenuPanel("sample", Model.ofList(list));
add(sample);
}

private List<WizardStep> createSteps() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.progress.ProgressDto;
import com.evolveum.midpoint.web.component.progress.ProgressReporter;
import com.evolveum.midpoint.web.component.util.EnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;
import com.evolveum.midpoint.web.security.MidPointApplication;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
Expand Down Expand Up @@ -69,7 +70,7 @@ public class ChangePasswordPanel<F extends FocusType> extends BasePanel<F> {
protected String currentPasswordValue = null;
protected ProtectedStringType newPasswordValue = new ProtectedStringType();
protected LoadableDetachableModel<CredentialsPolicyType> credentialsPolicyModel;
private boolean savedPassword = false;
protected boolean savedPassword = false;
protected ProgressDto progress = null;

public ChangePasswordPanel(String id, IModel<F> objectModel) {
Expand Down Expand Up @@ -108,6 +109,7 @@ public void setObject(String value) {
PasswordTextField currentPasswordField =
new PasswordTextField(ID_CURRENT_PASSWORD_FIELD, currentPasswordModel);
currentPasswordField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
currentPasswordField.add(new EnableBehaviour(() -> !savedPassword));
currentPasswordField.setRequired(false);
currentPasswordField.setResetPassword(false);
currentPasswordField.setOutputMarkupId(true);
Expand Down Expand Up @@ -170,6 +172,7 @@ public void onSubmit(AjaxRequestTarget target) {
changePasswordPerformed(target);
}
};
changePasswordButton.add(new EnableBehaviour(() -> !savedPassword));
changePasswordButton.setOutputMarkupId(true);
add(changePasswordButton);

Expand Down Expand Up @@ -282,7 +285,6 @@ private void changePasswordPerformed(AjaxRequestTarget target) {
}

OperationResult result = new OperationResult(OPERATION_SAVE_PASSWORD);
Task task = getPageBase().createSimpleTask(OPERATION_SAVE_PASSWORD);
ProgressReporter reporter = new ProgressReporter(MidPointApplication.get());
reporter.getProgress().clear();
reporter.setWriteOpResultForProgressActivity(true);
Expand All @@ -296,7 +298,7 @@ private void changePasswordPerformed(AjaxRequestTarget target) {
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<>();
ItemPath valuePath = ItemPath.create(SchemaConstantsGenerated.C_CREDENTIALS,
CredentialsType.F_PASSWORD, PasswordType.F_VALUE);
collectDeltas(deltas, currentPassword, valuePath);
collectDeltas(deltas, newPasswordValue, valuePath);
getPageBase().getModelService().executeChanges(
deltas, null, getPageBase().createSimpleTask(OPERATION_SAVE_PASSWORD, SchemaConstants.CHANNEL_SELF_SERVICE_URI),
Collections.singleton(reporter), result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.web.component.util.Selectable;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.SelectableRow;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
Expand All @@ -21,12 +23,9 @@
/**
* @author lazyman
*/
public class PasswordAccountDto extends Selectable<PasswordAccountDto>
implements Comparable<PasswordAccountDto> {
public class PasswordAccountDto implements SelectableRow<PasswordAccountDto>, Comparable<PasswordAccountDto> {

public static final String F_DISPLAY_NAME = "displayName";
public static final String F_RESOURCE_NAME = "resourceName";
public static final String F_ENABLED = "enabled";

private PrismObject<? extends ObjectType> object;
private final String displayName;
Expand All @@ -43,6 +42,8 @@ public class PasswordAccountDto extends Selectable<PasswordAccountDto>
*/
private final boolean midpoint;

private boolean selected = true;

/**
* contain resourceOid when it is shadow account
*/
Expand Down Expand Up @@ -166,4 +167,12 @@ private int compareString(String s1, String s2) {

return String.CASE_INSENSITIVE_ORDER.compare(s1, s2);
}

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

public boolean isSelected() {
return selected;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.page.self.requestAccess.Toast;
import com.evolveum.midpoint.model.api.ProgressInformation;
import com.evolveum.midpoint.model.api.validator.StringLimitationResult;
import com.evolveum.midpoint.prism.PrismObject;
Expand Down Expand Up @@ -74,6 +75,7 @@ public class PropagatePasswordPanel<F extends FocusType> extends ChangePasswordP
private static final String ID_INDIVIDUAL_SYSTEMS_TABLE = "individualSystemsTable";

private boolean propagatePassword = false;
private boolean showResultInTable = false;
ListDataProvider<PasswordAccountDto> provider = null;

public PropagatePasswordPanel(String id, IModel<F> focusModel) {
Expand Down Expand Up @@ -103,7 +105,7 @@ public void onUpdate(AjaxRequestTarget target) {
WebMarkupContainer individualSystemsContainer = new WebMarkupContainer(ID_INDIVIDUAL_SYSTEMS_CONTAINER);
individualSystemsContainer.setOutputMarkupId(true);
individualSystemsContainer.add(new VisibleBehaviour(() -> propagatePasswordCheckbox.getCheckboxModel().getObject() != null
&& propagatePasswordCheckbox.getCheckboxModel().getObject()));
&& propagatePasswordCheckbox.getCheckboxModel().getObject() || showResultInTable));
add(individualSystemsContainer);

provider = new ListDataProvider<>(PropagatePasswordPanel.this, getShadowModel());
Expand Down Expand Up @@ -545,13 +547,24 @@ protected void collectDeltas(Collection<ObjectDelta<? extends ObjectType>> delta

protected void finishChangePassword(OperationResult result, AjaxRequestTarget target, boolean showFeedback) {
updateResultColumnOfTable(target);
showResultInTable = true;
if (shouldLoadAccounts()) {
showFeedback = false;
String msg;
String cssClass;
if (result.isError()) {
error(createStringResource("PageAbstractSelfCredentials.message.resultInTable.error").getString());
msg = createStringResource("PageAbstractSelfCredentials.message.resultInTable.error").getString();
cssClass = "bg-danger m-3";
} else {
success(createStringResource("PageAbstractSelfCredentials.message.resultInTable").getString());
msg = createStringResource("PageAbstractSelfCredentials.message.resultInTable").getString();
cssClass = "bg-success m-3";
}
new Toast()
.cssClass(cssClass)
.autohide(true)
.delay(10_000)
.title(msg)
.show(target);
}
super.finishChangePassword(result, target, showFeedback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ public class ListGroupMenuItem implements Serializable {

private List<ListGroupMenuItem> items;

public ListGroupMenuItem() {
}

public ListGroupMenuItem(String label) {
this(null, label);
}

public ListGroupMenuItem(String iconCss, String label) {
this.iconCss = iconCss;
this.label = label;
}

public String getIconCss() {
return iconCss;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<a href="#" class="item-link" wicket:id="link">
<i class="icon fa fa-fw fa-border-all" wicket:id="icon"></i>
<i class="icon" wicket:id="icon"></i>
<span class="label" wicket:id="label">All roles</span>
<span class="badge badge-primary badge-pill" wicket:id="badge">14</span>
<i class="fa fa-chevron-left" wicket:id="chevron"></i>
<i class="chevron" wicket:id="chevron"></i>
</a>
<wicket:container wicket:id="content"/>
<ul class="list-group-submenu" wicket:id="itemsContainer">
<wicket:container wicket:id="items">
<li class="list-group-submenu-item" wicket:id="item"/>
</wicket:container>
</ul>
</wicket:panel>
</html>

0 comments on commit f81ff19

Please sign in to comment.