Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 8, 2022
2 parents ffb0804 + bb209da commit 52f9d08
Show file tree
Hide file tree
Showing 62 changed files with 430 additions and 162 deletions.
2 changes: 1 addition & 1 deletion custom/testng-integration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
~ and European Union Public License. See LICENSE file for details.
-->
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="integration" parallel="false" verbose="1">
<suite name="integration" parallel="none" verbose="1">
</suite>
2 changes: 1 addition & 1 deletion custom/testng-unit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
~ and European Union Public License. See LICENSE file for details.
-->
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="unit" parallel="false" verbose="1">
<suite name="unit" parallel="none" verbose="1">
</suite>
3 changes: 3 additions & 0 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1743,3 +1743,6 @@ th.debug-list-buttons {
}
}

.flex-basis-0 {
flex-basis: 0px!important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
<wicket:fragment wicket:id="wizardFragment">
<div wicket:id="wizard"/>
</wicket:fragment>

<wicket:fragment wicket:id="wizardPreviewFragment">
<div wicket:id="preview"/>
</wicket:fragment>
<wicket:child/>
</wicket:extend>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@
import java.util.Collection;

import com.evolveum.midpoint.gui.api.component.result.Toast;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.page.admin.DetailsFragment;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.PageAssignmentHolderDetails;
import com.evolveum.midpoint.gui.impl.page.admin.component.ResourceOperationalButtonsPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.ResourceWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.basic.BasicResourceWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.attributeMapping.AttributeMappingWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.synchronization.SynchronizationConfigWizardPanel;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.ObjectDeltaOperation;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand All @@ -27,6 +32,7 @@

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
Expand Down Expand Up @@ -55,9 +61,6 @@ public class PageResource extends PageAssignmentHolderDetails<ResourceType, Reso
private static final String ID_WIZARD_FRAGMENT = "wizardFragment";
private static final String ID_WIZARD = "wizard";

private static final String ID_WIZARD_PREVIEW_FRAGMENT = "wizardPreviewFragment";
private static final String ID_PREVIEW = "preview";

public PageResource(PageParameters pageParameters) {
super(pageParameters);
}
Expand Down Expand Up @@ -164,4 +167,42 @@ protected Collection<SelectorOptions<GetOperationOptions>> getOperationOptions()
.item(ResourceType.F_CONNECTOR_REF).resolve()
.build();
}

public void showSynchronizationWizard(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
Fragment fragment = new Fragment(ID_DETAILS_VIEW, ID_WIZARD_FRAGMENT, PageResource.this);
fragment.setOutputMarkupId(true);
addOrReplace(fragment);
SynchronizationConfigWizardPanel wizard = new SynchronizationConfigWizardPanel(
ID_WIZARD, getObjectDetailsModels(), valueModel) {

@Override
protected void onExitPerformed(AjaxRequestTarget target) {
DetailsFragment detailsFragment = createDetailsFragment();
PageResource.this.addOrReplace(detailsFragment);
target.add(detailsFragment);
}
};
wizard.setOutputMarkupId(true);
fragment.add(wizard);
target.add(fragment);
}

public void showAttributeMappingWizard(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
Fragment fragment = new Fragment(ID_DETAILS_VIEW, ID_WIZARD_FRAGMENT, PageResource.this);
fragment.setOutputMarkupId(true);
addOrReplace(fragment);
AttributeMappingWizardPanel wizard = new AttributeMappingWizardPanel(
ID_WIZARD, getObjectDetailsModels(), valueModel) {

@Override
protected void onExitPerformed(AjaxRequestTarget target) {
DetailsFragment detailsFragment = createDetailsFragment();
PageResource.this.addOrReplace(detailsFragment);
target.add(detailsFragment);
}
};
wizard.setOutputMarkupId(true);
fragment.add(wizard);
target.add(fragment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
Expand Down Expand Up @@ -199,4 +200,8 @@ public IModel<List<ObjectClassWrapper>> getObjectClassesModel() {
public Collection<ObjectDelta<? extends ObjectType>> collectDeltas(OperationResult result) throws SchemaException {
return super.collectDeltas(result);
}

public PageResource getPageResource() {
return (PageResource) super.getPageBase();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="topButtons"/>
<div class="d-flex flex-wrap">
<div wicket:id="topButtons"/>
</div>
<div class="d-flex flex-wrap justify-content-between my-3">
<div class="d-flex flex-wrap gap-2">
<wicket:enclosure child="intent">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
package com.evolveum.midpoint.gui.impl.page.admin.resource.component;

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

import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;

import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.ResourceObjectTypeWizardPreviewPanel.ResourceObjectTypePreviewTileType;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.synchronization.SynchronizationConfigWizardPanel;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.processor.*;

import com.evolveum.midpoint.schema.util.ShadowUtil;
Expand All @@ -23,6 +27,10 @@
import com.evolveum.midpoint.web.component.AjaxIconButton;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;

import com.evolveum.midpoint.web.model.ContainerValueWrapperFromObjectWrapperModel;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
Expand All @@ -32,6 +40,7 @@
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

Expand All @@ -51,9 +60,6 @@
import com.evolveum.midpoint.web.page.admin.resources.content.dto.ResourceContentSearchDto;
import com.evolveum.midpoint.web.session.ResourceContentStorage;
import com.evolveum.midpoint.web.session.SessionStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;

/**
* @author katkav
Expand Down Expand Up @@ -121,7 +127,7 @@ private void updateResourceContentSearch() {
}

private ResourceContentStorage getContentStorage(ShadowKindType kind, String searchMode) {
return getPageBase().getSessionStorage().getResourceContentStorage(kind, searchMode);
return getObjectDetailsModels().getPageResource().getSessionStorage().getResourceContentStorage(kind, searchMode);
}

protected void initLayout() {
Expand All @@ -132,18 +138,8 @@ protected void initLayout() {
topButtons.add(new VisibleBehaviour(() -> isTopTableButtonsVisible()));
add(topButtons);

AjaxIconButton synchConfButton = new AjaxIconButton(
topButtons.newChildId(),
Model.of(ResourceObjectTypePreviewTileType.SYNCHRONIZATION_CONFIG.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.SYNCHRONIZATION_CONFIG)) {
@Override
public void onClick(AjaxRequestTarget target) {
// SynchronizationConfigWizardPanel synchPanel = new SynchronizationConfigWizardPanel()
}
};
synchConfButton.showTitleAsLabel(true);
synchConfButton.add(AttributeAppender.append("class", "btn btn-default btn-lg"));
topButtons.add(synchConfButton);
initSychronizationButton(topButtons);
initAttributeMappingButton (topButtons);

final Form mainForm = new MidpointForm(ID_MAIN_FORM);
mainForm.setOutputMarkupId(true);
Expand Down Expand Up @@ -225,7 +221,7 @@ public String getObject() {
add(realObjectClassLabel);

AutoCompleteQNamePanel objectClassPanel = new AutoCompleteQNamePanel(ID_OBJECT_CLASS,
new PropertyModel<>(resourceContentSearch, "objectClass")) {
new PropertyModel<>(resourceContentSearch, "objectClass")) {
private static final long serialVersionUID = 1L;

@Override
Expand Down Expand Up @@ -254,7 +250,7 @@ public boolean isVisible() {
add(objectClassPanel);

AjaxLink<Boolean> repoSearch = new AjaxLink<Boolean>(ID_REPO_SEARCH,
new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
private static final long serialVersionUID = 1L;

@Override
Expand All @@ -275,14 +271,13 @@ public void onClick(AjaxRequestTarget target) {
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if (!getModelObject().booleanValue())
add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));
if (!getModelObject().booleanValue()) {add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));}
}
};
add(repoSearch);

AjaxLink<Boolean> resourceSearch = new AjaxLink<Boolean>(ID_RESOURCE_SEARCH,
new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
private static final long serialVersionUID = 1L;

@Override
Expand All @@ -303,14 +298,106 @@ public void onClick(AjaxRequestTarget target) {
protected void onBeforeRender() {
super.onBeforeRender();
getModelObject().booleanValue();
if (getModelObject().booleanValue())
add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));
if (getModelObject().booleanValue()) {add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));}
}
};
add(resourceSearch);

}

private void initAttributeMappingButton(RepeatingView topButtons) {
AjaxIconButton attrMappingButton = new AjaxIconButton(
topButtons.newChildId(),
Model.of(ResourceObjectTypePreviewTileType.ATTRIBUTE_MAPPING.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.ATTRIBUTE_MAPPING)) {
@Override
public void onClick(AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel =
getResourceObjectTypeValue(target);
if (valueModel != null) {
getObjectDetailsModels().getPageResource().showAttributeMappingWizard(
target,
valueModel);
}
}
};
attrMappingButton.showTitleAsLabel(true);
attrMappingButton.add(AttributeAppender.append("class", "btn btn-primary btn p-3 flex-basis-0 flex-fill"));
topButtons.add(attrMappingButton);
}

private void initSychronizationButton(RepeatingView topButtons) {
AjaxIconButton synchConfButton = new AjaxIconButton(
topButtons.newChildId(),
Model.of(ResourceObjectTypePreviewTileType.SYNCHRONIZATION_CONFIG.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.SYNCHRONIZATION_CONFIG)) {
@Override
public void onClick(AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel =
getResourceObjectTypeValue(target);
if (valueModel != null) {
getObjectDetailsModels().getPageResource().showSynchronizationWizard(
target,
valueModel);
}
}
};
synchConfButton.showTitleAsLabel(true);
synchConfButton.add(AttributeAppender.append("class", "btn btn-primary btn p-3 flex-fill flex-basis-0 mr-3"));
topButtons.add(synchConfButton);
}

private IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> getResourceObjectTypeValue(
AjaxRequestTarget target) {

if ((!isUseObjectClass() && resourceContentSearch.getObject().getKind() == null)
|| (isUseObjectClass() && resourceContentSearch.getObject().getObjectClass() == null)) {
getPageBase().warn("Couldn't recognize resource object type");
LOGGER.debug("Couldn't recognize resource object type");
target.add(getPageBase().getFeedbackPanel());
return null;
}
PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> foundValue = null;
PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> defaultValue = null;
try {
PrismContainerWrapper<ResourceObjectTypeDefinitionType> container = getObjectWrapperModel().getObject().findContainer(
ItemPath.create(ResourceType.F_SCHEMA_HANDLING, SchemaHandlingType.F_OBJECT_TYPE));
for (PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> value : container.getValues()) {
if (!isUseObjectClass()
&& (resourceContentSearch.getObject().getKind().equals(value.getRealValue().getKind()))
|| kind.equals(value.getRealValue().getKind())) {
if (resourceContentSearch.getObject().getIntent() != null
&& resourceContentSearch.getObject().getIntent().equals(value.getRealValue().getKind())) {
foundValue = value;
}
if (Boolean.TRUE.equals(value.getRealValue().isDefaultForKind())){
defaultValue = value;
}
}
if (isUseObjectClass()
&& resourceContentSearch.getObject().getObjectClass().equals(value.getRealValue().getObjectClass())
&& Boolean.TRUE.equals(value.getRealValue().isDefaultForObjectClass())) {
foundValue = value;
}
if (Boolean.TRUE.equals(value.getRealValue().isDefault() && defaultValue == null)) {
defaultValue = value;
}
}
} catch (SchemaException e) {
//ignore issue log error below
}
if (foundValue == null) {
if (defaultValue == null) {
getPageBase().warn("Couldn't recognize resource object type");
LOGGER.debug("Couldn't recognize resource object type");
target.add(getPageBase().getFeedbackPanel());
return null;
}
foundValue = defaultValue;
}
return new ContainerValueWrapperFromObjectWrapperModel<>(getObjectWrapperModel(), foundValue.getPath());
}

private boolean isTopTableButtonsVisible() {
return true;
}
Expand Down Expand Up @@ -339,7 +426,7 @@ private ResourceContentResourcePanel initResourceContent(IModel<PrismObjectWrapp
String searchMode = isRepoSearch ? SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT :
SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT;
ResourceContentResourcePanel resourceContent = new ResourceContentResourcePanel(ID_TABLE, loadResourceModel(),
getObjectClass(), getKind(), getIntent(), searchMode, getPanelConfiguration()){
getObjectClass(), getKind(), getIntent(), searchMode, getPanelConfiguration()) {
@Override
protected ResourceSchema getRefinedSchema() throws SchemaException, ConfigurationException {
try {
Expand All @@ -358,7 +445,7 @@ private ResourceContentRepositoryPanel initRepoContent(IModel<PrismObjectWrapper
String searchMode = isRepoSearch ? SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT :
SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT;
ResourceContentRepositoryPanel repositoryContent = new ResourceContentRepositoryPanel(ID_TABLE, loadResourceModel(),
getObjectClass(), getKind(), getIntent(), searchMode, getPanelConfiguration()){
getObjectClass(), getKind(), getIntent(), searchMode, getPanelConfiguration()) {
@Override
protected ResourceSchema getRefinedSchema() throws SchemaException, ConfigurationException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
<wicket:extend>
<div class="col-8">
<div class="d-flex flex-column justify-content-center mt-5 col-12">
<div class="bg-white rounded p-2 pl-3 pr-3 card mb-0" wicket:id="header"/>
<div class="bg-white rounded p-2 pl-3 pr-3 card mb-0" wicket:id="header">
<span>
<i wicket:id="icon"></i>
<span class="pl-1" wicket:id="title"/>
</span>
</div>
<div class="mb-3">
<div wicket:id="value"/>
</div>
Expand Down

0 comments on commit 52f9d08

Please sign in to comment.