Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
* 'master' of github.com:Evolveum/midpoint:
  MID-8722 fixed effective status visualization overview, fixed localization typo
  style fix for advanced/axiom searches error displaying
  midpoint-main-generic-pg-pipeline: Xmx8g, RAM 10g (was 6/8)
  MID-8721 spring boot static resources configuration with content hash in url, integrated to wicket via markup filter
  hide AsyncUpdateConnector, AsyncProvisioningConnector and ManualConnector for resource wizard
  fix for MID-8734 Saving search filter does not appear in saved filters until logout/login
  hide template and abstract element in resource wizard
  MID-8739: fix for construction association panel
  MID-8722 fixed effective status visualization overview
  MID-8735:fix for association search panel (right namespace for seached QName)
  MID-8736:fix for editing and removing of association value in resource inducement panel
  allow add only user member for governance role wizard panel
  Fix handling autz of so-called elaborate items
  pipelines: added failureOnFailedTestConfig for other pipelines too
  MID-8743 typo fix for listing unmodified objects
  MID-8745 nasty fix to improve - show warning when row was selected for action
  MID-8745 NPE fix in simulation result table for show objects action
  Fix displaying the number of object classes/type
  • Loading branch information
katkav committed Apr 4, 2023
2 parents 96b0054 + 50eb7e5 commit 047ff5a
Show file tree
Hide file tree
Showing 36 changed files with 640 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5416,17 +5416,17 @@ public static String getCollectionNameParameterValueAsString(PageBase pageBase)
return stringValue == null ? null : stringValue.toString();
}

public static StringValue getCollectionNameParameterValue(PageBase pageBase) {
PageParameters parameters = pageBase.getPageParameters();
public static StringValue getCollectionNameParameterValue(PageAdminLTE parentPage) {
PageParameters parameters = parentPage.getPageParameters();
return parameters == null ? null : parameters.get(PageBase.PARAMETER_OBJECT_COLLECTION_NAME);
}

public static <C extends Containerable> GuiObjectListViewType getPrincipalUserObjectListView(PageBase pageBase,
public static <C extends Containerable> GuiObjectListViewType getPrincipalUserObjectListView(PageAdminLTE parentPage,
FocusType principalFocus, @NotNull Class<C> viewType, boolean createIfNotExist, String defaultIdentifier) {
if (!(principalFocus instanceof UserType)) {
return null;
}
StringValue collectionViewParameter = WebComponentUtil.getCollectionNameParameterValue(pageBase);
StringValue collectionViewParameter = WebComponentUtil.getCollectionNameParameterValue(parentPage);
String viewName = !collectionViewParameter.isNull() && !collectionViewParameter.isEmpty() ? collectionViewParameter.toString() : defaultIdentifier;
AdminGuiConfigurationType adminGui = ((UserType) principalFocus).getAdminGuiConfiguration();
if (adminGui == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ protected ObjectQuery getCustomizeContentQuery() {
return PrismContext.get().queryFor(ConnectorType.class)
.item(ConnectorType.F_AVAILABLE)
.eq(true)
.and()
.not()
.item(ConnectorType.F_CONNECTOR_TYPE)
.eq("AsyncUpdateConnector")
.and()
.not()
.item(ConnectorType.F_CONNECTOR_TYPE)
.eq("AsyncProvisioningConnector")
.and()
.not()
.item(ConnectorType.F_CONNECTOR_TYPE)
.eq("ManualConnector")
.build();
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.api.page.PageAdminLTE;
import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -43,6 +44,7 @@ public class Search<T extends Serializable> implements Serializable, DebugDumpab

private static final String DOT_CLASS = Search.class.getName() + ".";
private static final String OPERATION_EVALUATE_COLLECTION_FILTER = DOT_CLASS + "evaluateCollectionFilter";
private static final String OPERATION_LOAD_PRINCIPAL = DOT_CLASS + "loadPrincipalObject";
public static final String F_FULL_TEXT = "fullText";
public static final String F_TYPE = "type";

Expand Down Expand Up @@ -222,6 +224,7 @@ public ObjectQuery createObjectQuery(VariablesMap variables, PageBase pageBase,
LOGGER.trace("Cannot create query, not supported search box mode: {}", getSearchMode());
return PrismContext.get().queryFactory().createQuery();
}
queryWrapper.setAdvancedError(null);

ObjectQuery query = null;
try {
Expand Down Expand Up @@ -346,14 +349,14 @@ private ObjectFilter getCollectionFilter(PageBase pageBase, Task task, Operation
return null;
}

private CompiledObjectCollectionView determineObjectCollectionView(PageBase pageBase) {
private CompiledObjectCollectionView determineObjectCollectionView(PageAdminLTE parentPage) {
ObjectCollectionSearchItemWrapper objectCollectionSearchItemWrapper = findObjectCollectionSearchItemWrapper();
if (objectCollectionSearchItemWrapper != null && objectCollectionSearchItemWrapper.getObjectCollectionView() != null) {
return objectCollectionSearchItemWrapper.getObjectCollectionView();
}
if (StringUtils.isNotEmpty(getCollectionViewName())) {
return pageBase.getCompiledGuiProfile()
.findObjectCollectionView(WebComponentUtil.anyClassToQName(pageBase.getPrismContext(), getTypeClass()),
return parentPage.getCompiledGuiProfile()
.findObjectCollectionView(WebComponentUtil.anyClassToQName(parentPage.getPrismContext(), getTypeClass()),
getCollectionViewName());
}
return null;
Expand Down Expand Up @@ -519,4 +522,29 @@ public boolean isForceReload() {
public List<AvailableFilterType> getAvailableFilterTypes() {
return availableFilterTypes;
}

/** todo review
* temporary decision to fix MID-8734, should be discussed later
* saved filters cannot be reloaded from the compiledGuiProfile at the moment, because
* GuiProfileCompiler.compileFocusProfile doesn't get the new filter changes while its saving
* @param parentPage
*/
public void reloadSavedFilters(PageAdminLTE parentPage) {
CompiledObjectCollectionView view = determineObjectCollectionView(parentPage);
if (view == null) {
return;
}
String principalOid = parentPage.getPrincipalFocus().getOid();
Task task = parentPage.createSimpleTask(OPERATION_LOAD_PRINCIPAL);
OperationResult result = task.getResult();
PrismObject<UserType> loggedUser = WebModelServiceUtils.loadObject(UserType.class, principalOid, parentPage, task, result);
GuiObjectListViewType userView = WebComponentUtil.getPrincipalUserObjectListView(parentPage, loggedUser.asObjectable(),
(Class<? extends Containerable>) getTypeClass(), false, view.getViewIdentifier());
if (userView != null) {
SearchBoxConfigurationType config = userView.getSearchBoxConfiguration();
if (config != null) {
availableFilterTypes = config.getAvailableFilter();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<wicket:panel>
<div class="d-flex justify-content-end mp-w-8 mp-w-xxl-6">
<div class="d-flex flex-column flex-grow-1 align-items-end has-feedback">
<div class="d-flex flex-column flex-grow-1 align-items-end has-feedback form-group">
<input wicket:id="axiomQueryField" type="text" class="form-control form-control-sm mp-w-12"/>
<span class="text-wrap" wicket:id="advancedError"/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ private void initLayout() {
// }
// });

queryDslField.add(AttributeAppender.append("class",
() -> StringUtils.isEmpty(getModelObject().getAdvancedError()) ? "is-valid" : "is-invalid"));
queryDslField.add(AttributeAppender.append("placeholder", getPageBase().createStringResource("SearchPanel.insertAxiomQuery")));
add(queryDslField);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.List;
import java.util.stream.Collectors;

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

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
Expand Down Expand Up @@ -57,10 +59,6 @@
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AvailableFilterType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchBoxModeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchItemType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

public abstract class SearchPanel<C extends Serializable> extends BasePanel<Search<C>> {
Expand Down Expand Up @@ -358,8 +356,10 @@ public void yesPerformed(AjaxRequestTarget target) {

private void saveSearchFilterPerformed(AjaxRequestTarget target) {
savedSearchListModel.detach();
target.add(SearchPanel.this.get(ID_FORM));
getModelObject().reloadSavedFilters(getParentPage());
refreshSearchForm(target);
}

private void deleteFilterPerformed(AvailableFilterType filter, AjaxRequestTarget target) {
Task task = getPageBase().createSimpleTask(OPERATION_REMOVE_SAVED_FILTER);
OperationResult result = task.getResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<wicket:panel>
<div class="d-flex justify-content-end mp-w-8 mp-w-xxl-6">
<a class="btn btn-sm btn-link" wicket:id="debug" />
<div class="d-flex flex-column flex-grow-1 align-items-end has-feedback">
<div class="d-flex flex-column flex-grow-1 align-items-end has-feedback form-group">
<textarea class="form-control form-control-sm mp-w-12" rows="2" wicket:id="advancedArea"></textarea>
<span class="text-wrap" wicket:id="advancedError"/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public void onClick(AjaxRequestTarget target) {
TextArea<?> advancedArea = new TextArea<>(ID_ADVANCED_AREA, new PropertyModel<>(getModel(), AdvancedQueryWrapper.F_ADVANCED_QUERY));
advancedArea.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
advancedArea.add(AttributeAppender.append("placeholder", getPageBase().createStringResource("SearchPanel.insertFilterXml")));
advancedArea.add(AttributeAppender.append("class",
() -> StringUtils.isEmpty(getModelObject().getAdvancedError()) ? "is-valid" : "is-invalid"));
// advancedArea.add(createVisibleBehaviour(SearchBoxModeType.ADVANCED));
// advancedArea.add(AttributeAppender.append("class", createValidityStyle()));
add(advancedArea);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void initSearchModel() {

@Override
protected Search load() {
SearchBuilder searchBuilder = new SearchBuilder(FocusType.class)
SearchBuilder searchBuilder = new SearchBuilder(getSearchableType())
.collectionView(getObjectCollectionView())
.additionalSearchContext(createAdditionalSearchContext())
.modelServiceLocator(getPageBase());
Expand All @@ -112,13 +112,17 @@ protected Search load() {
};
}

protected Class<? extends FocusType> getSearchableType() {
return FocusType.class;
}

private SearchContext createAdditionalSearchContext() {
SearchContext ctx = new SearchContext();
ctx.setPanelType(CollectionPanelType.CARDS_GOVERNANCE);
return ctx;
}

private CompiledObjectCollectionView getObjectCollectionView() {
protected CompiledObjectCollectionView getObjectCollectionView() {
ContainerPanelConfigurationType config = getPanelConfiguration();
if (config == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,24 +357,17 @@ private IModel<InfoBoxData> createSchemaStatusInfoBoxModel() {
String numberMessage;
String description = null;

Integer progress = null;
ResourceSchema refinedSchema;
try {
refinedSchema = getObjectDetailsModels().getRefinedSchema();
if (refinedSchema != null) {
backgroundColor = "bg-purple";
icon = "fa fa-cubes";
// TODO is this correct?
// This is a preliminary solution for MID-8391.
int numObjectTypes = refinedSchema.getObjectTypeDefinitions().size();
int numAllDefinitions = numObjectTypes + refinedSchema.getObjectClassDefinitions().size();
int numObjectClasses = refinedSchema.getObjectClassDefinitions().size();
numberMessage = numObjectTypes + " " + getString("PageResource.resource.objectTypes");
if (numAllDefinitions != 0) {
progress = numObjectTypes * 100 / numAllDefinitions;
if (progress > 100) {
progress = 100;
}
}
description = numAllDefinitions + " " + getString("PageResource.resource.schemaDefinitions");
description = numObjectClasses + " " + getString("PageResource.resource.schemaDefinitions");
} else {
numberMessage = getString("PageResource.resource.noSchema");
}
Expand All @@ -386,8 +379,8 @@ private IModel<InfoBoxData> createSchemaStatusInfoBoxModel() {

InfoBoxData data = new InfoBoxData(backgroundColor, icon, getString("PageResource.resource.schema"));
data.setNumber(numberMessage);
data.setProgress(progress);
data.setDescription(description);
// There is no use in providing a ratio of objects to classes or vice versa. Hence we do not set the progress here.

return data;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ protected boolean checkMandatory(ItemWrapper itemWrapper) {
@Override
protected ItemVisibilityHandler getVisibilityHandler() {
return wrapper -> {
if (wrapper.getItemName().equals(ResourceType.F_CONNECTOR_REF)) {
if (wrapper.getItemName().equals(ResourceType.F_CONNECTOR_REF)
|| wrapper.getItemName().equals(ResourceType.F_TEMPLATE)
|| wrapper.getItemName().equals(ResourceType.F_ABSTRACT)
|| wrapper.getItemName().equals(ResourceType.F_LIFECYCLE_STATE)){
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.ResourceUncategorizedPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.TemplateTile;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
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.data.BoxedTablePanel;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationTypeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -64,6 +61,11 @@ protected String getStorageKeyTabSuffix() {
return getConfiguration() == null ? PANEL_TYPE : super.getStorageKeyTabSuffix();
}

@Override
protected Class<? extends FocusType> getSearchableType() {
return UserType.class;
}

@Override
protected Behavior createCardDetailsButtonBehaviour() {
return VisibleEnableBehaviour.ALWAYS_INVISIBLE;
Expand Down Expand Up @@ -93,6 +95,35 @@ protected String getTileCssClasses() {
protected WebMarkupContainer getFeedback() {
return GovernanceMembersWizardPanel.this.getFeedback();
}

protected CompiledObjectCollectionView getObjectCollectionView() {
ContainerPanelConfigurationType config = getPanelConfiguration();
if (config == null) {
return null;
}
GuiObjectListViewType listViewType = config.getListView();
if (listViewType == null) {
listViewType = config.beginListView();
}

if (listViewType.getSearchBoxConfiguration() == null) {
listViewType.beginSearchBoxConfiguration();
}

if (listViewType.getSearchBoxConfiguration().getObjectTypeConfiguration() == null) {
listViewType.getSearchBoxConfiguration().beginObjectTypeConfiguration();
}

if (listViewType.getSearchBoxConfiguration().getObjectTypeConfiguration().getSupportedTypes().isEmpty()) {
listViewType
.getSearchBoxConfiguration()
.getObjectTypeConfiguration()
.getSupportedTypes()
.add(UserType.COMPLEX_TYPE);
}

return WebComponentUtil.getCompiledObjectCollectionView(listViewType, config, getPageBase());
}
};
table.setOutputMarkupId(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ private void redirectToProcessedObjects(ObjectProcessingStateType state) {
private void redirectToProcessedObjects(BuiltInSimulationMetricType identifier) {
if (identifier == null) {
redirectToProcessedObjects(ObjectProcessingStateType.UNMODIFIED);
return;
}

ObjectProcessingStateType state = SimulationsGuiUtil.builtInMetricToProcessingState(identifier);
Expand Down

0 comments on commit 047ff5a

Please sign in to comment.