Skip to content

Commit

Permalink
MID-8038 Org member panel missing "All" option for type search
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna Honchar committed Sep 8, 2022
1 parent 0fb3740 commit 36beb87
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import javax.xml.namespace.QName;

public class ObjectTypeSearchItemPanel<T> extends AbstractSearchItemPanel<ObjectTypeSearchItemWrapper> {

public ObjectTypeSearchItemPanel(String id, IModel<ObjectTypeSearchItemWrapper> searchItem) {
Expand All @@ -25,7 +27,7 @@ public ObjectTypeSearchItemPanel(String id, IModel<ObjectTypeSearchItemWrapper>

@Override
protected Component initSearchItemField() {
DropDownChoicePanel choices = new DropDownChoicePanel(ID_SEARCH_ITEM_FIELD, new PropertyModel(getModel(), ObjectTypeSearchItemWrapper.F_VALUE),
DropDownChoicePanel<QName> choices = new DropDownChoicePanel<>(ID_SEARCH_ITEM_FIELD, new PropertyModel(getModel(), ObjectTypeSearchItemWrapper.F_VALUE),
Model.ofList(getModelObject().getAvailableValues()),
new QNameObjectTypeChoiceRenderer(), getModelObject().isAllowAllTypesSearch()) {

Expand All @@ -36,7 +38,6 @@ protected String getNullValidDisplayValue() {
return getString("ObjectTypes.all");
}
};
// choices.getBaseFormComponent().add(WebComponentUtil.getSubmitOnEnterKeyDownBehavior("searchSimple"));
choices.getBaseFormComponent().add(new OnChangeAjaxBehavior() {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,10 @@ private static <C extends Containerable> Search<C> createSearch(
searchConfWrapper = searchConfigurationWrapper;
}
if (CollectionUtils.isNotEmpty(searchConfWrapper.getAllowedTypeList()) && !objectTypeSearchItemWrapperExists(searchConfWrapper.getItemsList())) {
searchConfWrapper.getItemsList().add(new ObjectTypeSearchItemWrapper(searchConfWrapper.getAllowedTypeList(),
WebComponentUtil.containerClassToQName(PrismContext.get(), searchConfWrapper.getTypeClass())));
ObjectTypeSearchItemWrapper typeItem = new ObjectTypeSearchItemWrapper(searchConfWrapper.getAllowedTypeList(),
WebComponentUtil.containerClassToQName(PrismContext.get(), searchConfWrapper.getTypeClass()));
typeItem.setAllowAllTypesSearch(searchConfWrapper.isAllowAllTypeSearch());
searchConfWrapper.getItemsList().add(typeItem);
}
if (searchConfWrapper.getAllowedModeList().contains(SearchBoxModeType.OID)) {
OidSearchItemWrapper oidWrapper = new OidSearchItemWrapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.*;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.impl.component.search.ObjectTypeSearchItemWrapper;
import com.evolveum.midpoint.web.component.data.column.ColumnMenuAction;

import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -434,7 +435,11 @@ private SearchConfigurationWrapper createSearchConfigWrapper(Class<? extends Obj
if (additionalPanelConfig != null) {
searchConfigWrapper.setAllowToConfigureSearchItems(!Boolean.FALSE.equals(additionalPanelConfig.isAllowToConfigureSearchItems()));
}
searchConfigWrapper.setAllowAllTypeSearch(true);
searchConfigWrapper.getItemsList().forEach(item -> {
if (item instanceof ObjectTypeSearchItemWrapper) {
((ObjectTypeSearchItemWrapper)item).setAllowAllTypesSearch(true);
}
});
return searchConfigWrapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,13 @@ protected Search<? extends ObjectType> load() {
Search search = storage.getSearch();

if (search == null) {
// ContainerTypeSearchItem<? extends ObjectType> defaultType =
// new ContainerTypeSearchItem(
// new SearchValue<Class>(SystemConfigurationType.class, "ObjectType." + SystemConfigurationType.COMPLEX_TYPE.getLocalPart()),
// getAllowedTypes());
// defaultType.setVisible(true);
// search = SearchFactory.createSearch(defaultType, PageDebugList.this, true);
// configureSearch(search);
search = SearchFactory.createSearch(createSearchConfigWrapper(confDialogModel.getObject().getType(), SystemConfigurationType.COMPLEX_TYPE), PageDebugList.this);
storage.setSearch(search);
}
return search;
}
};

// confDialogModel = new LoadableModel<>() {
// private static final long serialVersionUID = 1L;
//
// @Override
// protected DebugConfDialogDto load() {
// return new DebugConfDialogDto();
// }
// };

initLayout();
}

Expand All @@ -173,17 +157,6 @@ private <C extends Containerable> SearchConfigurationWrapper<C> createSearchConf
return searchConfigurationWrapper;
}

// private List<DisplayableValue<Class<? extends ObjectType>>> getAllowedTypes() {
// List<DisplayableValue<Class<? extends ObjectType>>> choices = new ArrayList<>();
// List<ObjectTypes> objectTypes = WebComponentUtil.createObjectTypesList();
//
// for (ObjectTypes objectType : objectTypes) {
// String key = "ObjectType." + objectType.getTypeQName().getLocalPart();
// choices.add(new SearchValue<>(objectType.getClassDefinition(), key));
// }
// return choices;
// }

private List<Class<ObjectType>> getAllowedTypes() {
List<Class<ObjectType>> choices = new ArrayList<>();
WebComponentUtil.createObjectTypesList().stream()
Expand Down Expand Up @@ -361,10 +334,6 @@ private Class<? extends ObjectType> getType() {
return searchModel.isLoaded() ? searchModel.getObject().getTypeClass() : SystemConfigurationType.class;
}

// private ContainerTypeSearchItem<? extends ObjectType> getTypeItem() {
// return searchModel.isLoaded() ? searchModel.getObject().getType() : null;
// }

private List<InlineMenuItem> initInlineMenu() {
List<InlineMenuItem> headerMenuItems = new ArrayList<>();
headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportSelected"), true) {
Expand Down

0 comments on commit 36beb87

Please sign in to comment.