Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed May 29, 2020
2 parents 9769b2c + 177114c commit 095c17a
Show file tree
Hide file tree
Showing 107 changed files with 3,149 additions and 1,365 deletions.
Expand Up @@ -102,6 +102,7 @@ protected Search load() {
List<SearchItemDefinition> availableDefs = initSearchableItems(model.getObject());

Search search = new Search(model.getObject().getCompileTimeClass(), availableDefs);
search.setCanConfigure(true);
return search;
}

Expand Down
Expand Up @@ -11,6 +11,8 @@
import javax.annotation.PostConstruct;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.xml.ns._public.common.common_3.CollectionRefSpecificationType;

import org.springframework.stereotype.Component;

import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext;
Expand Down Expand Up @@ -55,6 +57,11 @@ private boolean filterDefinitins(PrismContainerValue<C> value, ItemDefinition<?>
public boolean match(ItemDefinition<?> def) {
QName defName = def.getTypeName();

if (CollectionRefSpecificationType.COMPLEX_TYPE.equals(defName)
&& def.getItemName().equivalent(CollectionRefSpecificationType.F_BASE_COLLECTION_REF)) {
return true;
}

if (TaskPartitionsDefinitionType.COMPLEX_TYPE.equals(defName)) {
return true;
}
Expand Down
Expand Up @@ -19,23 +19,19 @@
<div class="form-group col-sm-12">
<label class="col-sm-4"><wicket:message key="ReferencePopupPanel.targetType"/></label>
<div class="col-sm-8">
<select wicket:id="type" class="form-control input-sm" style="width: auto; min-width: 150px;"/>
<select wicket:id="type" class="form-control input-sm" style="width: 150px;"/>
</div>
</div>
<div class="form-group col-sm-12">
<label class="col-sm-4"><wicket:message key="ReferencePopupPanel.relation"/></label>
<div class="col-sm-8">
<select wicket:id="relation" class="form-control input-sm" style="width: auto; min-width: 150px;"/>
<select wicket:id="relation" class="form-control input-sm" style="width: 150px;"/>
</div>
</div>
<div class="form-group col-sm-12">
<div>
<div class="input-group-btn">
<a wicket:id="remove" class="btn btn-danger" wicket:message="title:SearchItemPanel.remove">
<i class="fa fa-minus"/>
</a>
<a wicket:id="add" class="btn btn-success" wicket:message="title:SearchItemPanel.add">
<i class="fa fa-plus"/>
<a wicket:id="confirmButton" class="btn btn-sm btn-default pull-right" >
</a>
</div>
</div>
Expand Down
Expand Up @@ -12,6 +12,9 @@
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.PrismConstants;
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.form.DropDownChoice;
Expand All @@ -32,6 +35,7 @@ public class ReferencePopupPanel extends SearchPopupPanel<ObjectReferenceType> {
private static final String ID_OID = "oid";
private static final String ID_TYPE = "type";
private static final String ID_RELATION = "relation";
private static final String ID_CONFIRM_BUTTON = "confirmButton";

// private List<QName> allowedRelations;

Expand Down Expand Up @@ -60,6 +64,7 @@ protected void onUpdate(AjaxRequestTarget target) {
}
});
oidField.setOutputMarkupId(true);
oidField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
add(oidField);

DropDownChoice<QName> type = new DropDownChoice<>(ID_TYPE, new PropertyModel<QName>(getModel(), SearchValue.F_VALUE + ".type"),
Expand All @@ -75,10 +80,10 @@ public boolean isEnabled() {
return getSupportedTargetList().size() > 1;
}
});

type.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
add(type);

if (getModelObject().getValue() != null && getModelObject().getValue().getRelation() == null){
if (getModelObject() != null && getModelObject().getValue() != null && getModelObject().getValue().getRelation() == null){
getModelObject().getValue().setRelation(PrismConstants.Q_ANY);
}
List<QName> allowedRelations = new ArrayList<QName>();
Expand All @@ -99,7 +104,24 @@ public boolean isEnabled() {
return getAllowedRelations().size() > 1;
}
});
relation.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
add(relation);

AjaxButton confirm = new AjaxButton(ID_CONFIRM_BUTTON, createStringResource("Button.ok")) {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
confirmPerformed(target);
}
};
add(confirm);

}

protected void confirmPerformed(AjaxRequestTarget target){

}

protected List<QName> getAllowedRelations() {
Expand Down
Expand Up @@ -57,7 +57,7 @@ public class Search implements Serializable, DebugDumpable {

private boolean showAdvanced = false;
private boolean isFullTextSearchEnabled = false;
private boolean showMoreDialog;
private boolean canConfigure = true; //TODO should be changed to false

private String advancedQuery;
private String advancedError;
Expand Down Expand Up @@ -136,6 +136,8 @@ public SearchItem addItem(ItemDefinition def) {
List<QName> supportedTargets = WebComponentUtil.createSupportedTargetTypeList(((PrismReferenceDefinition) def).getTargetTypeName());
if (supportedTargets.size() == 1) {
ref.setType(supportedTargets.iterator().next());
} else {
ref.setType(ObjectType.COMPLEX_TYPE);
}
if (itemToRemove.getAllowedValues() != null && itemToRemove.getAllowedValues().size() == 1) {
ref.setRelation((QName) itemToRemove.getAllowedValues().iterator().next());
Expand Down Expand Up @@ -377,12 +379,12 @@ public void setFullTextSearchEnabled(boolean fullTextSearchEnabled) {
isFullTextSearchEnabled = fullTextSearchEnabled;
}

public boolean isShowMoreDialog() {
return showMoreDialog;
public boolean isCanConfigure() {
return canConfigure;
}

public void setShowMoreDialog(boolean showMoreDialog) {
this.showMoreDialog = showMoreDialog;
public void setCanConfigure(boolean canConfigure) {
this.canConfigure = canConfigure;
}

private String createErrorMessage(Exception ex) {
Expand Down
Expand Up @@ -18,7 +18,6 @@
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.schema.SchemaRegistry;
import com.evolveum.midpoint.prism.util.ItemPathTypeUtil;
import com.evolveum.midpoint.schema.ResourceShadowDiscriminator;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.FullTextSearchConfigurationUtil;
Expand Down Expand Up @@ -212,7 +211,7 @@ public static <T extends ObjectType> Search createSearch(
item.setFixed(true);
}
}
search.setShowMoreDialog(isAllowToConfigureSearchItems(modelServiceLocator, type, collectionViewName));
search.setCanConfigure(isAllowToConfigureSearchItems(modelServiceLocator, type, collectionViewName));
return search;
}

Expand Down Expand Up @@ -324,7 +323,7 @@ private static <T extends ObjectType> SearchItemsType getConfiguredSearchItems(M
private static <T extends ObjectType> boolean isAllowToConfigureSearchItems(ModelServiceLocator modelServiceLocator, Class<T> type, String collectionViewName){
SearchBoxConfigurationType searchConfig = getSearchBoxConfiguration(modelServiceLocator, type, collectionViewName);
if (searchConfig == null || searchConfig.isAllowToConfigureSearchItems() == null){
return false;
return true; //todo should be set to false
}
return searchConfig.isAllowToConfigureSearchItems();
}
Expand Down
Expand Up @@ -12,36 +12,25 @@
<!-- todo replace style attribute to css class -->
<div class="search-item" wicket:id="searchItemContainer">
<div class="col-sm-3" style="margin-top: 5px; width: fit-content" wicket:id="searchItemLabel" />
<div class="col-sm-7" wicket:id="searchItemField" />
<div class="col-sm-6" wicket:id="searchItemField" />
<div class="col-sm-1">
<a wicket:id="removeButton" class="btn btn-xs" style="margin-top: 5px;">
<a wicket:id="editButton" class="btn btn-xs btn-default" style="margin-top: 5px; border: none !important;">
<i class="fa fa-edit fa-lg" />
</a>
</div>
<div class="col-sm-1">
<a wicket:id="removeButton" class="btn btn-xs btn-default" style="margin-top: 5px; border: none !important;">
<i class="fa fa-times-circle fa-lg" />
</a>
</div>
</div>



<!-- <a wicket:id="mainButton" class="btn btn-sm btn-default" about="searchItemButton">-->
<!-- <span wicket:id="label"/>-->
<!-- &nbsp;-->
<!-- <span class="caret"></span>-->
<!-- <i wicket:id="deleteButton" class="fa fa-times-circle fa-lg text-danger" style="margin-left: 10px;"/>-->
<!-- </a>-->

<!-- <div wicket:id="popover" class="popover bottom">-->
<!-- <div class="arrow"></div>-->
<!-- <div class="popover-content" wicket:id="popoverBody">-->
<!-- <div wicket:id="values" class="input-group input-group-sm">-->
<!-- <div wicket:id="value"/>-->
<!-- </div>-->

<!-- <p style="margin: 0px; padding-top: 7px;">-->
<!-- <a data-type="update" wicket:id="update" class="btn btn-sm btn-success"/>-->
<!-- <a data-type="close" wicket:id="close" class="btn btn-sm btn-default"/>-->
<!-- </p>-->
<!-- </div>-->
<!-- </div>-->
<div wicket:id="popover" class="popover bottom">
<div class="popover-content" wicket:id="popoverBody">
<div wicket:id="value" class="input-group input-group-sm">
</div>
</div>
</div>
</wicket:panel>
</body>
</html>

0 comments on commit 095c17a

Please sign in to comment.