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 Oct 12, 2022
2 parents 1aa86eb + 7011064 commit d1d8878
Show file tree
Hide file tree
Showing 14 changed files with 317 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ol>
</div>
<h2 class="mb-3" wicket:id="text"/>
<h5 class="text-secondary mb-5" wicket:id="subText"/>
<h5 class="text-center text-secondary mb-5 col-xxl-8 col-10" wicket:id="subText"/>
<div class="col-12">
<div wicket:id="feedbackContainer" class="feedbackContainer">
<div wicket:id="feedback" class="messagePanel"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.evolveum.midpoint.web.component.dialog.Popupable;
import com.evolveum.midpoint.web.component.search.SearchValue;

import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;
Expand Down Expand Up @@ -432,11 +433,6 @@ private VisibleEnableBehaviour getSearchButtonVisibleEnableBehavior() {
@Override
public boolean isEnabled() {
Search search = getModelObject();
if (SearchBoxModeType.ADVANCED.equals(getModelObject().getSearchMode())
|| SearchBoxModeType.AXIOM_QUERY.equals(getModelObject().getSearchMode())) {
PrismContext ctx = getPageBase().getPrismContext();
return search.isAdvancedQueryValid(ctx);
}
if (SearchBoxModeType.FULLTEXT.equals(getModelObject().getSearchMode())) {
return search.isFullTextSearchEnabled();
}
Expand Down Expand Up @@ -896,43 +892,14 @@ public void onClick(AjaxRequestTarget target) {
advancedGroup.add(advancedCheck);

TextArea<?> advancedArea = new TextArea<>(ID_ADVANCED_AREA, new PropertyModel<>(getModel(), com.evolveum.midpoint.web.component.search.Search.F_ADVANCED_QUERY));
advancedArea.add(new AjaxFormComponentUpdatingBehavior("keyup") {

@Override
protected void onUpdate(AjaxRequestTarget target) {
updateAdvancedArea(advancedArea, target);
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);

attributes.setThrottlingSettings(
new ThrottlingSettings(ID_ADVANCED_AREA, Duration.ofMillis(500), true));
}
});
advancedArea.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
advancedArea.add(AttributeAppender.append("placeholder", getPageBase().createStringResource("SearchPanel.insertFilterXml")));
advancedArea.add(createVisibleBehaviour(SearchBoxModeType.ADVANCED));
advancedGroup.add(advancedArea);

TextField<String> queryDslField = new TextField<>(ID_AXIOM_QUERY_FIELD,
new PropertyModel<>(getModel(), com.evolveum.midpoint.web.component.search.Search.F_DSL_QUERY));
queryDslField.add(new AjaxFormComponentUpdatingBehavior("keyup") {

@Override
protected void onUpdate(AjaxRequestTarget target) {
updateQueryDSLArea(advancedCheck, advancedGroup, target);
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);

attributes.setThrottlingSettings(
new ThrottlingSettings(ID_AXIOM_QUERY_FIELD, Duration.ofMillis(500), true));
attributes.setChannel(new AjaxChannel("Drop", AjaxChannel.Type.DROP));
}
});
queryDslField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
queryDslField.add(AttributeAppender.append("placeholder", getPageBase().createStringResource("SearchPanel.insertAxiomQuery")));
queryDslField.add(createVisibleBehaviour(SearchBoxModeType.AXIOM_QUERY));
advancedGroup.add(queryDslField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.activation.ActivationsWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.associations.AssociationsWizardPanel;
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.capabilities.CapabilitiesWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.correlation.CorrelationWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.credentials.CredentialsWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.synchronization.SynchronizationWizardPanel;
Expand Down Expand Up @@ -224,6 +225,28 @@ protected void onExitPerformed(AjaxRequestTarget target) {
target.add(fragment);
}

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

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

@Override
protected void onExitPerformed(AjaxRequestTarget target) {
backToDetailsFromWizard(target);
}
};
wizard.setOutputMarkupId(true);
fragment.add(wizard);
target.add(fragment);
}

public void showCredentialsWizard(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
Fragment fragment = new Fragment(ID_DETAILS_VIEW, ID_WIZARD_FRAGMENT, PageResource.this);
fragment.setOutputMarkupId(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="card-header">
<h3 class="card-title"><wicket:message key="CapabilitiesPanel.title"/></h3>
<div class="card-header py-2 pl-1">
<span>
<i class="fab fa-react"/>
<span class="pl-1">
<wicket:message key="CapabilitiesPanel.title"/>
</span>
</span>
</div>
<div class="card-body px-0 ml-n2 d-flex flex-wrap justify-content-center">
<div wicket:id="capabilities" class="ml-2 mb-2 d-flex justify-content-center" style="flex:8%">
<div wicket:id="capabilities" class="ml-2 mb-2 d-flex justify-content-center" style="flex:9%">
<a wicket:id="capabilityButton"
class="btn btn-app m-0 w-100 d-flex flex-column"
style="aspect-ratio: 4/3!important; height: auto; max-height:100px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ private String getIcon(Class capability) {
if (AsyncUpdateCapabilityType.class.isAssignableFrom(capability)) {
return "fa fa-arrows-turn-to-dots";
}
if (SchemaCapabilityType.class.isAssignableFrom(capability)) {
return "fa fa-table-cells";
}
return "fa fa-circle";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ protected void initLayout() {
initSychronizationButton(topButtons);
initAttributeMappingButton(topButtons);
initCorrelationButton(topButtons);
initCapabilitiesButton(topButtons);
initCredentialsButton(topButtons);
initActivationsButton(topButtons);
initAssociationsButton(topButtons);
Expand Down Expand Up @@ -398,6 +399,27 @@ public void onClick(AjaxRequestTarget target) {
topButtons.add(correlationConfButton);
}

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

private void initCredentialsButton(RepeatingView topButtons) {
AjaxIconButton credentialsConfButton = new AjaxIconButton(
topButtons.newChildId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.activation.ActivationsWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.associations.AssociationsWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.attributeMapping.*;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.capabilities.CapabilitiesWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.correlation.CorrelationWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.credentials.CredentialsWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.synchronization.SynchronizationWizardPanel;
Expand Down Expand Up @@ -161,6 +162,9 @@ protected void onResourceTileClick(ResourceObjectTypePreviewTileType value, Ajax
case ACTIVATION:
showActivationsWizard(target, getValueModel());
break;
case CAPABILITIES_CONFIG:
showCapabilitiesConfigWizard(target, getValueModel());
break;
}
}

Expand Down Expand Up @@ -220,6 +224,30 @@ protected boolean isSavedAfterWizard() {
});
}

private void showCapabilitiesConfigWizard(
AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
showChoiceFragment(target, new CapabilitiesWizardPanel(getIdOfChoicePanel(), getResourceModel(), valueModel) {
@Override
protected void onExitPerformed(AjaxRequestTarget target) {
showObjectTypePreviewFragment(getValueModel(), target);
}

@Override
protected OperationResult onSaveResourcePerformed(AjaxRequestTarget target) {
OperationResult result = ResourceObjectTypeWizardPanel.this.onSaveResourcePerformed(target);
if (result != null && !result.isError()) {
refreshValueModel();
}
return result;
}

@Override
protected boolean isSavedAfterWizard() {
return isSavedAfterDetailsWizard();
}
});
}

private void showSynchronizationConfigWizard(
AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
showWizardFragment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum ResourceObjectTypePreviewTileType implements TileEnum {
ATTRIBUTE_MAPPING("fa fa-retweet"),
SYNCHRONIZATION_CONFIG("fa fa-arrows-rotate"),
CORRELATION_CONFIG("fa fa-code-branch"),
// CAPABILITIES_CONFIG("fab fa-react"),
CAPABILITIES_CONFIG("fab fa-react"),
ACTIVATION("fa fa-toggle-off"),
CREDENTIALS("fa fa-key"),
ASSOCIATIONS("fa fa-shield");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* 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.admin.resource.component.wizard.objectType.capabilities;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.component.result.Toast;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.AbstractResourceWizardPanel;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.util.annotation.Experimental;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType;

/**
* @author lskublik
*/

@Experimental
public class CapabilitiesWizardPanel extends AbstractResourceWizardPanel<ResourceObjectTypeDefinitionType> {

private final IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel;

public CapabilitiesWizardPanel(String id, ResourceDetailsModel model, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
super(id, model);
this.valueModel = valueModel;
}

protected void initLayout() {
add(createChoiceFragment(createCapabilityPanel(getValueModel())));
}

public IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> getValueModel() {
return valueModel;
}

private CapabilitiesWizardStepPanel createCapabilityPanel(IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel) {
CapabilitiesWizardStepPanel panel = new CapabilitiesWizardStepPanel(
getIdOfChoicePanel(),
getResourceModel(),
getValueModel()) {
@Override
protected void onSaveResourcePerformed(AjaxRequestTarget target) {
if (!isSavedAfterWizard()) {
onExitPerformed(target);
return;
}
OperationResult result = CapabilitiesWizardPanel.this.onSaveResourcePerformed(target);
if (result != null && !result.isError()) {
new Toast()
.success()
.title(getString("ResourceWizardPanel.updateResource"))
.icon("fas fa-circle-check")
.autohide(true)
.delay(5_000)
.body(getString("ResourceWizardPanel.updateResource.text")).show(target);
onExitPerformed(target);
} else {
target.add(getFeedback());
}
}

@Override
protected void onExitPerformed(AjaxRequestTarget target) {
super.onExitPerformed(target);
CapabilitiesWizardPanel.this.onExitPerformed(target);
}

@Override
protected IModel<String> getSubmitLabelModel() {
if (isSavedAfterWizard()) {
return super.getSubmitLabelModel();
}
return getPageBase().createStringResource("WizardPanel.confirm");
}

@Override
protected String getSubmitIcon() {
if (isSavedAfterWizard()) {
return super.getSubmitIcon();
}
return "fa fa-check";
}
};
panel.setOutputMarkupId(true);
return panel;
}

protected boolean isSavedAfterWizard() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
~ Copyright (c) 2022 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:extend>
<div class="card ml-auto mr-auto col-8" wicket:id="panel"/>
</wicket:extend>
</body>
</html>

0 comments on commit d1d8878

Please sign in to comment.