Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/shadow-marks
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydamage committed Feb 12, 2023
2 parents 35cc72a + 2a75d02 commit 7a3748b
Show file tree
Hide file tree
Showing 176 changed files with 4,038 additions and 1,364 deletions.
2 changes: 1 addition & 1 deletion gui/admin-gui/src/frontend/scss/_tiles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
word-break: break-all;
word-break: break-word;
}
}

Expand Down
4 changes: 2 additions & 2 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1724,9 +1724,9 @@ th.debug-list-buttons {
}
}

.conflict-item {
.card-outline-left {
@each $name, $color in $theme-colors {
&.conflict-item-#{$name} {
&.card-outline-left-#{$name} {
border-left: 5px solid $color;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ protected void onComponentTag(ComponentTag tag) {

private void initLayout() {
add(AttributeAppender.append("class", () -> getModelObject().getCssClass()));
add(new VisibleBehaviour(() -> StringUtils.isNotEmpty(getModelObject().getText()) || StringUtils.isNotEmpty(getModelObject().getIconCssClass())));
add(new VisibleBehaviour(() ->
getModelObject() != null
&& (StringUtils.isNotEmpty(getModelObject().getText()) || StringUtils.isNotEmpty(getModelObject().getIconCssClass()))));

WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeAppender.append("class", () -> getModelObject().getIconCssClass()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5135,7 +5135,7 @@ public static CredentialsPolicyType getPasswordCredentialsPolicy(PrismObject<? e

@Contract("_,true->!null")
public static Long getTimestampAsLong(XMLGregorianCalendar cal, boolean currentIfNull) {
Long calAsLong = MiscUtil.asLong(cal);
Long calAsLong = MiscUtil.asMillis(cal);
if (calAsLong == null) {
if (currentIfNull) {
return System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private void initSearchModel() {
}
}

protected boolean isUseStorageSearch(Search search) {
private boolean isUseStorageSearch(Search search) {
if (search == null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
~ Copyright (c) 2023 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<wicket:panel xmlns:wicket="http://wicket.apache.org">
<div wicket:id="panel"/>

<div class="d-flex">
<a wicket:id="doneButton" class="ml-auto btn btn-primary">
<span><wicket:message key="OnePanelPopupPanel.button.done"/></span>
</a>
</div>
</wicket:panel>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2023 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.dialog;

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

import com.evolveum.midpoint.web.component.dialog.SimplePopupable;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;

import com.evolveum.midpoint.web.component.dialog.Popupable;

import org.apache.wicket.model.IModel;

public abstract class OnePanelPopupPanel extends SimplePopupable {
private static final String ID_PANEL = "panel";
private static final String ID_BUTTON_DONE = "doneButton";

public OnePanelPopupPanel(String id){
this(id, null);
}
public OnePanelPopupPanel(String id, IModel<String> title){
super(id, 400, 600, title);
initLayout();
}

private void initLayout(){
add(createPanel(ID_PANEL));
AjaxLink<Void> done = new AjaxLink<>(ID_BUTTON_DONE) {
@Override
public void onClick(AjaxRequestTarget target) {
processHide(target);
}
};
add(done);
}

protected void processHide(AjaxRequestTarget target) {
getPageBase().hideMainPopup(target);
}

protected Component getPanel () {
return get(ID_PANEL);
}

protected abstract WebMarkupContainer createPanel(String id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2023 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 wicket:id="valueContainer">
<div class="prism-property-label p-0">
<span wicket:id="valueContainerLabel" />
<button wicket:id="add" class="btn btn-tool text-primary" trigger="hover">
<i class="fa fa-plus-circle pr-1"></i>
<wicket:message key="VerticalFormItemHeaderPanel.addValue"/>
</button>

<button wicket:id="remove" class="btn btn-tool text-danger" trigger="hover">
<i class="fa fa-eraser pr-1"></i>
<wicket:message key="VerticalFormItemHeaderPanel.removeAll"/>
</button>
</div>
<div class="prism-property-value" wicket:id="valueInput"/>
<span wicket:id="feedback"/>
</div>
</wicket:panel>
</html>

Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* Copyright (c) 2023 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.input.expression;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel;
import com.evolveum.midpoint.gui.api.model.NonEmptyModel;
import com.evolveum.midpoint.gui.impl.component.message.FeedbackLabels;
import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel;
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
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;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public abstract class EvaluatorExpressionPanel extends BasePanel<ExpressionType> {

private static final long serialVersionUID = 1L;

private static final String ID_VALUE_INPUT = "valueInput";
private static final String ID_VALUE_CONTAINER = "valueContainer";
private static final String ID_VALUE_CONTAINER_LABEL = "valueContainerLabel";
private static final String ID_ADD_BUTTON = "add";
private static final String ID_REMOVE_BUTTON = "remove";
private static final String ID_FEEDBACK = "feedback";

public EvaluatorExpressionPanel(String id, IModel<ExpressionType> model) {
super(id, model);
}

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

private void initLayout() {
setOutputMarkupId(true);

WebMarkupContainer valueContainer = new WebMarkupContainer(ID_VALUE_CONTAINER);
valueContainer.setOutputMarkupId(true);
add(valueContainer);

valueContainer.add(new Label(ID_VALUE_CONTAINER_LABEL, getValueContainerLabelModel()));

FeedbackLabels feedback = new FeedbackLabels(ID_FEEDBACK);
feedback.setOutputMarkupPlaceholderTag(true);
valueContainer.add(feedback);

AjaxLink<Void> addButton = new AjaxLink<>(ID_ADD_BUTTON) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
addValue(target);
}
};
valueContainer.add(addButton);

AjaxLink<Void> removeButton = new AjaxLink<>(ID_REMOVE_BUTTON) {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
removeItem(target);
}
};
valueContainer.add(removeButton);

valueContainer.add(createDefaultInputPanel());
}

public abstract IModel<String> getValueContainerLabelModel();

protected WebMarkupContainer createDefaultInputPanel() {

IModel<List<String>> model = new IModel<>() {
@Override
public List<String> getObject() {
return getEvaluatorValues();
}

@Override
public void setObject(List<String> strings) {
updateEvaluatorValue(getModelObject(), strings);
}

@Override
public void detach() {
}
};

NonEmptyModel<Boolean> readOnlyModel = new NonEmptyLoadableModel<>(false) {
@NotNull
@Override
protected Boolean load() {
return false;
}
};
MultiValueTextPanel<String> valueInput = new MultiValueTextPanel<>(EvaluatorExpressionPanel.ID_VALUE_INPUT, model, readOnlyModel, false) {

@Override
protected Behavior getAddButtonVisibleBehavior(NonEmptyModel<Boolean> readOnlyModel) {
return VisibleBehaviour.ALWAYS_INVISIBLE;
}

@Override
protected IModel<String> createEmptyItemPlaceholder() {
return () -> "";
}

@Override
protected InputPanel createTextPanel(String id, IModel<String> model) {
return EvaluatorExpressionPanel.this.createTextPanel(id, model);
}

@Override
protected void modelObjectUpdatePerformed(AjaxRequestTarget target, List<String> strings) {
updateEvaluatorValue(EvaluatorExpressionPanel.this.getModelObject(), strings);
target.add(getFeedback());
}
};
valueInput.setOutputMarkupId(true);
return valueInput;
}

protected InputPanel createTextPanel(String id, IModel<String> model) {
return new TextPanel<>(id, model);
}

private void removeItem(AjaxRequestTarget target) {
getModelObject().getExpressionEvaluator().clear();
target.add(get(ID_VALUE_CONTAINER));
target.add(getFeedback());
}

private void addValue(AjaxRequestTarget target) {
List<String> values = getEvaluatorValues();
values.add("");
updateEvaluatorValue(EvaluatorExpressionPanel.this.getModelObject(), values);
target.add(get(ID_VALUE_CONTAINER));
target.add(getFeedback());
}

protected FeedbackLabels getFeedback() {
return (FeedbackLabels) get(createComponentPath(ID_VALUE_CONTAINER, ID_FEEDBACK));
}

protected abstract void updateEvaluatorValue(ExpressionType expression, List<String> values);

protected abstract List<String> getEvaluatorValues();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
~ Copyright (c) 2023 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>
<wicket:enclosure child="typeChoice">
<div class="input-group mb-1">
<div class="custom-file" style="height: calc(1.8125rem + 2px);" wicket:id="typeChoice"/>
<wicket:enclosure child="typeButton">
<div class="input-group-append">
<button class="pl-2 btn btn-sm btn-primary" wicket:id="typeButton"/>
</div>
</wicket:enclosure>
</div>
</wicket:enclosure>
<div wicket:id="infoContainer" class="d-flex">
<span class="text-info" wicket:id="infoLabel"/>
<span class="btn btn-tool mt-0">
<i class="p-1" wicket:id="infoIcon"/>
</span>
<button class="ml-auto btn btn-sm btn-primary" wicket:id="resetButton">
<wicket:message key="ExpressionPanel.resetButton"/>
</button>
</div>
<div wicket:id="evaluatorPanel"/>
</wicket:panel>
</html>

0 comments on commit 7a3748b

Please sign in to comment.