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 Nov 7, 2022
2 parents 4a60998 + 1e12bec commit a4474e1
Show file tree
Hide file tree
Showing 86 changed files with 945 additions and 1,712 deletions.
4 changes: 4 additions & 0 deletions config/sql/native-new/postgres-new-upgrade-audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ call apply_audit_change(2, $aa$
ALTER TYPE ObjectType ADD VALUE IF NOT EXISTS 'MESSAGE_TEMPLATE' AFTER 'LOOKUP_TABLE';
$aa$);

-- SCHEMA-COMMIT 4.6: commit 71f2df50

-- changes for 4.7

-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_audit_change number at the end of postgres-new-audit.sql
-- to match the number used in the last change here!
7 changes: 6 additions & 1 deletion config/sql/native-new/postgres-new-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ call apply_change(11, $aa$
ALTER TABLE m_connector ADD available BOOLEAN;
$aa$);

-- SCHEMA-COMMIT 4.6: commit TODO
-- SCHEMA-COMMIT 4.5: commit c5f19c9e

-- No changes for audit schema in 4.6
-- SCHEMA-COMMIT 4.6: commit 71f2df50

-- changes for 4.7

-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_change number at the end of postgres-new.sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="card-header p-0 border-bottom-0">
<ul class="nav nav-tabs" wicket:id="tabs-container">
<li class="nav-item flex-grow-1" wicket:id="tabs">
<a class="nav-link" href="#" wicket:id="link">
<a class="nav-link text-center" href="#" wicket:id="link">
<i wicket:id="icon"/>
<span wicket:id="title"/>
<small class="badge" wicket:id="count"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb;
import com.evolveum.midpoint.web.component.message.FeedbackAlerts;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.page.admin.resources.PageResources;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -147,6 +146,35 @@ public void onClick(AjaxRequestTarget target) {

addCustomButtons(buttons);
buttonsContainer.add(buttons);

AjaxIconButton saveButton = new AjaxIconButton(
buttons.newChildId(),
Model.of(getSubmitIcon()),
getSubmitLabelModel()) {
@Override
public void onClick(AjaxRequestTarget target) {
onSubmitPerformed(target);
}
};
saveButton.showTitleAsLabel(true);
saveButton.add(new VisibleBehaviour(() -> isSubmitButtonVisible()));
saveButton.add(AttributeAppender.append("class", "btn btn-success"));
buttons.add(saveButton);
}

protected boolean isSubmitButtonVisible() {
return false;
}

protected void onSubmitPerformed(AjaxRequestTarget target) {
}

protected String getSubmitIcon() {
return "fa fa-floppy-disk";
}

protected IModel<String> getSubmitLabelModel() {
return getPageBase().createStringResource("WizardPanel.submit");
}

protected boolean isExitButtonVisible() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected void onError(AjaxRequestTarget target) {
next.add(nextLabel);
}

protected IModel<?> getSubmitLabelModel() {
protected IModel<String> getSubmitLabelModel() {
return getPageBase().createStringResource("WizardPanel.submit");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
package com.evolveum.midpoint.gui.impl.component;

import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
import com.evolveum.midpoint.gui.impl.component.message.FeedbackLabels;
import com.evolveum.midpoint.web.component.data.*;

import com.evolveum.midpoint.web.component.input.validator.NotNullValidator;
import com.evolveum.midpoint.web.component.prism.InputPanel;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -27,6 +32,7 @@
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Fragment;
Expand All @@ -35,6 +41,7 @@
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.StringValue;
import org.apache.wicket.util.visit.IVisitor;
import org.apache.wicket.validation.ValidatorAdapter;
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand Down Expand Up @@ -1333,4 +1340,33 @@ && getObjectCollectionView().getPaging().getOrderBy() != null) {
public ContainerPanelConfigurationType getPanelConfiguration() {
return config;
}

public boolean isValidFormComponents(AjaxRequestTarget target) {
AtomicReference<Boolean> valid = new AtomicReference<>(true);
getTable().visitChildren(SelectableDataTable.SelectableRowItem.class, (row, object) -> {
((SelectableDataTable.SelectableRowItem) row).visitChildren(FormComponent.class, (baseFormComponent, object2) -> {
baseFormComponent.getBehaviors().stream()
.filter(behaviour -> behaviour instanceof ValidatorAdapter
&& ((ValidatorAdapter)behaviour).getValidator() instanceof NotNullValidator)
.map(adapter -> ((ValidatorAdapter)adapter).getValidator())
.forEach(validator -> ((NotNullValidator)validator).setUseModel(true));
((FormComponent)baseFormComponent).validate();
if (baseFormComponent.hasErrorMessage()) {
valid.set(false);
if (target != null) {
target.add(baseFormComponent);
InputPanel inputParent = baseFormComponent.findParent(InputPanel.class);
if (inputParent != null && inputParent.getParent() != null) {
target.addChildren(inputParent.getParent(), FeedbackLabels.class);
}
}
}
});
});
return valid.get();
}

public boolean isValidFormComponents() {
return isValidFormComponents(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected PageStorage getPageStorage() {
protected List<Component> createToolbarButtonsList(String idButton) {
List<Component> bar = new ArrayList<>();

AjaxIconButton newObjectButton = new AjaxIconButton(idButton, new Model<>(GuiStyleConstants.CLASS_ADD_NEW_OBJECT),
AjaxIconButton newObjectButton = new AjaxIconButton(idButton, new Model<>(getIconForNewObjectButton()),
createStringResource(getKeyOfTitleForNewObjectButton())) {

private static final long serialVersionUID = 1L;
Expand All @@ -155,6 +155,10 @@ public void onClick(AjaxRequestTarget target) {
return bar;
}

protected String getIconForNewObjectButton() {
return GuiStyleConstants.CLASS_ADD_NEW_OBJECT;
}

protected String getKeyOfTitleForNewObjectButton() {
return "MainObjectListPanel.newObject";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,46 @@
<div class="d-flex flex-wrap" wicket:id="topButtonsContainer">
<div wicket:id="topButtons"/>
</div>
<div class="d-flex flex-wrap justify-content-between my-3">
<div class="d-flex flex-wrap justify-content-between pl-4">
<div class="d-flex flex-wrap gap-2">
<wicket:enclosure child="intent">
<label class="col-form-label-sm mb-0"><wicket:message key="ShadowType.intent"/></label>
<div wicket:id="intent" />
<wicket:enclosure child="realObjectClass">
<span class="col-form-label-sm mb-0">(<wicket:message key="ShadowType.objectClass"/>: <span wicket:id="realObjectClass"/>)</span>
</wicket:enclosure>
<div class="my-3 d-flex flex-wrap gap-2">
<label class="col-form-label-sm mb-0">
<wicket:message key="ShadowType.intent"/>
</label>
<div wicket:id="intent"/>
<wicket:enclosure child="realObjectClass">
<span class="col-form-label-sm mb-0">(<wicket:message key="ShadowType.objectClass"/>: <span wicket:id="realObjectClass"/>)</span>
</wicket:enclosure>
</div>
</wicket:enclosure>
<wicket:enclosure child="objectClass">
<label class="col-form-label-sm mb-0"><wicket:message key="ShadowType.objectClass"/></label>
<div wicket:id="objectClass" />
<div class="my-3 d-flex flex-wrap gap-2">
<label class="col-form-label-sm mb-0">
<wicket:message key="ShadowType.objectClass"/>
</label>
<div wicket:id="objectClass"/>
</div>
</wicket:enclosure>
</div>

<div class="d-flex flex-wrap gap-2" wicket:id="resourceChoiceContainer">
<label class="col-form-label-sm mb-0"><wicket:message key="ResourceContentTabPanel.searchType" /></label>
<label class="col-form-label-sm mb-0">
<wicket:message key="ResourceContentTabPanel.searchType"/>
</label>
<div class="btn-group btn-group-sm">
<a class="btn btn-default" wicket:id="repositorySearch">
<wicket:message key="ResourceContentTabPanel.searchType.repository" />
<wicket:message key="ResourceContentTabPanel.searchType.repository"/>
</a>
<a class="btn btn-default" wicket:id="resourceSearch">
<wicket:message key="ResourceContentTabPanel.searchType.resource" />
<wicket:message key="ResourceContentTabPanel.searchType.resource"/>
</a>
</div>
</div>
</div>

<form wicket:id="mainForm">
<div wicket:id="table" />
<div wicket:id="table"/>
</form>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
import com.evolveum.midpoint.util.exception.ConfigurationException;

import com.evolveum.midpoint.web.component.AjaxIconButton;
import com.evolveum.midpoint.web.component.data.BoxedTablePanel;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;

import com.evolveum.midpoint.web.model.ContainerValueWrapperFromObjectWrapperModel;
import com.evolveum.midpoint.web.page.admin.shadows.ShadowTablePanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
Expand Down Expand Up @@ -678,4 +679,17 @@ protected boolean isIntentAndObjectClassPanelVisible() {
return true;
}

public BoxedTablePanel getTable() {
com.evolveum.midpoint.web.page.admin.resources.ResourceContentPanel panel =
(com.evolveum.midpoint.web.page.admin.resources.ResourceContentPanel) get(getPageBase().createComponentPath(ID_MAIN_FORM, ID_TABLE));
if (panel == null) {
return null;
}
ShadowTablePanel table = panel.getTable();
if (table == null) {
return null;
}
return table.getTable();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.web.component.AjaxIconButton;
import com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn;
import com.evolveum.midpoint.web.component.form.MidpointForm;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
Expand All @@ -34,13 +35,9 @@
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

import com.evolveum.prism.xml.ns._public.types_3.PolyStringTranslationType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -95,7 +92,6 @@ protected UserProfileStorage.TableId getTableId() {
@Override
protected List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> createDefaultColumns() {
List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> columns = new ArrayList<>();
// columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_KIND, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_INTENT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DEFAULT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
Expand All @@ -114,6 +110,33 @@ public String getCssClass() {
return columns;
}

@Override
protected List<Component> createToolbarButtonsList(String idButton) {
List<Component> buttons = super.createToolbarButtonsList(idButton);
buttons.stream()
.filter(component -> component instanceof AjaxIconButton)
.forEach(button -> {
((AjaxIconButton) button).showTitleAsLabel(true);
button.add(AttributeAppender.replace("class", "btn btn-primary btn-sm"));
});
return buttons;
}

@Override
protected String getIconForNewObjectButton() {
return "fa fa-circle-plus";
}

@Override
protected String getKeyOfTitleForNewObjectButton() {
return "ResourceSchemaHandlingPanel.newObject";
}

@Override
protected boolean isHeaderVisible() {
return false;
}

@Override
protected IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {
Expand Down Expand Up @@ -162,47 +185,6 @@ protected boolean isCreateNewObjectVisible() {
return true;
}

// protected void editItemPerformed(
// AjaxRequestTarget target,
// IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> rowModel,
// List<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> listItems,
// AbstractPageObjectDetails parent) {
//
// ContainerPanelConfigurationType detailsPanel = new ContainerPanelConfigurationType();
// detailsPanel.setPanelType("schemaHandlingDetails");
//
// PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> objectTypeDef;
// if (rowModel != null) {
// objectTypeDef = rowModel.getObject();
// } else {
// objectTypeDef = listItems.iterator().next();
// }
// detailsPanel.setPath(new ItemPathType(objectTypeDef.getPath()));
//
// detailsPanel.setIdentifier("schemaHandlingDetails");
// DisplayType displayType = new DisplayType();
// displayType.setLabel(getObjectTypeDisplayName(objectTypeDef.getNewValue().asContainerable()));
// detailsPanel.setDisplay(displayType);
//
// getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
//
// ResourceSchemaHandlingPanel.this.getPanelConfiguration().getPanel().add(detailsPanel);
// target.add(parent);
// parent.replacePanel(detailsPanel, target);
// }

private PolyStringType getObjectTypeDisplayName(ResourceObjectTypeDefinitionType resourceObjectTypeDefinitionType) {
String displayName = resourceObjectTypeDefinitionType.getDisplayName();
if (StringUtils.isNotBlank(displayName)) {
return new PolyStringType(displayName);
}
PolyStringType polyStringType = new PolyStringType();
PolyStringTranslationType translationType = new PolyStringTranslationType();
translationType.setKey("feedbackMessagePanel.message.undefined");
polyStringType.setTranslation(translationType);
return polyStringType;
}

private MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerListPanel() {
return ((MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType>) get(getPageBase().createComponentPath(ID_FORM, ID_TABLE)));
}
Expand Down

0 comments on commit a4474e1

Please sign in to comment.