Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 21, 2023
2 parents 0a1ed20 + ac24b66 commit d64854c
Show file tree
Hide file tree
Showing 19 changed files with 280 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</wicket:enclosure>
<div wicket:id="infoContainer" class="d-flex">
<span class="text-info" wicket:id="infoLabel"/>
<span class="btn btn-tool mt-0">
<span class="btn btn-tool mt-0 p-0">
<i class="p-1" wicket:id="infoIcon"/>
</span>
<div class="ml-auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;

import com.evolveum.midpoint.gui.api.prism.wrapper.PrismValueWrapper;
Expand Down Expand Up @@ -35,6 +36,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType;

import org.apache.wicket.model.Model;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -78,19 +80,18 @@ protected void onBeforeRender() {

@Override
protected void onNewValue(IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> containerModel, AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model = () -> {
PrismContainerWrapper<ResourceObjectTypeDefinitionType> container = containerModel.getObject();
PrismContainerValue<ResourceObjectTypeDefinitionType> value = container.getItem().createNewValue();
try {
PrismContainerValueWrapper newWrapper = WebPrismUtil.createNewValueWrapper(
container, value, getPageBase(), getObjectDetailsModels().createWrapperContext());
container.getValues().add(newWrapper);
return newWrapper;
} catch (SchemaException e) {
LOGGER.error("Couldn't create new value for container " + container, e);
}
return null;
};
PageBase pageBase = getPageBase();
PrismContainerWrapper<ResourceObjectTypeDefinitionType> container = containerModel.getObject();
PrismContainerValue<ResourceObjectTypeDefinitionType> value = container.getItem().createNewValue();
PrismContainerValueWrapper newWrapper = null;
try {
newWrapper = WebPrismUtil.createNewValueWrapper(
container, value, pageBase, getObjectDetailsModels().createWrapperContext());
container.getValues().add(newWrapper);
} catch (SchemaException e) {
LOGGER.error("Couldn't create new value for container " + container, e);
}
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model = Model.of(newWrapper);
onCreateValue(model, target);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import com.evolveum.midpoint.web.component.prism.ValueStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
Expand Down Expand Up @@ -230,10 +232,11 @@ public String getCssClass() {
MappingType.F_ENABLED,
AbstractItemWrapperColumn.ColumnType.VALUE,
getPageBase()) {

@Override
public String getCssClass() {
return "col-md-2";
protected Component createHeader(String componentId, IModel<? extends PrismContainerDefinition<MappingType>> mainModel) {
Component header = super.createHeader(componentId, mainModel);
header.add(AttributeAppender.append("class", "d-table-row"));
return header;
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,15 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

columns.add(new PrismPropertyWrapperColumn(
getMappingTypeDefinition(),
MappingType.F_EXPRESSION,
AbstractItemWrapperColumn.ColumnType.VALUE,
getPageBase()){

@Override
public String getCssClass() {
return "col-xl-2 col-lg-2 col-md-3";
}

});
getPageBase()));

columns.add(new IconColumn<>(Model.of()) {
@Override
Expand All @@ -100,7 +93,7 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void setObject(Collection<VariableBindingDefinitionType> newValues) {

@Override
public String getCssClass() {
return "col-xl-4 col-lg-4 col-md-4";
return "col-xl-2 col-lg-2 col-md-2";
}
});

Expand All @@ -165,22 +165,15 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

columns.add(new PrismPropertyWrapperColumn(
mappingTypeDef,
MappingType.F_EXPRESSION,
AbstractItemWrapperColumn.ColumnType.VALUE,
getPageBase()){

@Override
public String getCssClass() {
return "col-xl-2 col-lg-2 col-md-3";
}

});
getPageBase()));

columns.add(new IconColumn<>(Model.of()) {
@Override
Expand All @@ -190,7 +183,7 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,31 +202,43 @@ protected List<DashboardWidgetType> load() {
.end();

SimulationMetricReferenceType metricRef = m.getRef();
if (metricRef.getEventMarkRef() != null) {
ObjectReferenceType eventMarkRef = metricRef.getEventMarkRef();
String metricIdentifier = metricRef.getIdentifier();
if (eventMarkRef != null) {
PrismObject<MarkType> markObject =
WebModelServiceUtils.loadObject(metricRef.getEventMarkRef(), PageSimulationResult.this);
WebModelServiceUtils.loadObject(eventMarkRef, PageSimulationResult.this);
DisplayType display;
if (markObject != null) {
MarkType mark = markObject.asObjectable();
DisplayType display = mark.getDisplay();
display = mark.getDisplay();
if (display == null) {
display = new DisplayType();
display.setLabel(mark.getName());
}
dw.setDisplay(display);
dw.setDisplayOrder(mark.getDisplayOrder());
} else {
display = new DisplayType();
display.setLabel(new PolyStringType(WebComponentUtil.getName(eventMarkRef)));
}
} else if (metricRef.getIdentifier() != null) {

dw.setDisplay(display);
} else if (metricIdentifier != null) {
SimulationMetricDefinitionType def =
getSimulationResultManager().getMetricDefinition(metricRef.getIdentifier());
getSimulationResultManager().getMetricDefinition(metricIdentifier);
DisplayType display;
if (def != null) {
DisplayType display = def.getDisplay();
display = def.getDisplay();
if (display == null) {
display = new DisplayType();
display.setLabel(new PolyStringType(def.getIdentifier()));
}
dw.setDisplay(display);
dw.setDisplayOrder(def.getDisplayOrder());
} else {
display = new DisplayType();
display.setLabel(new PolyStringType(metricIdentifier));
}

dw.setDisplay(display);
} else {
// built-in -> ignored
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,13 @@ private ObjectFilter createObjectFilter(CollectionRefSpecificationType collectio
private void initLayout() {
add(AttributeModifier.prepend("class", "d-flex flex-column border rounded bg-white"));

Label title = new Label(ID_TITLE, () -> {
IModel<String> titleModel = () -> {
DisplayType display = getModelObject().getDisplay();
return display != null ? WebComponentUtil.getTranslatedPolyString(display.getLabel()) : null;
});
};

Label title = new Label(ID_TITLE, titleModel);
title.add(AttributeAppender.append("title", titleModel));
add(title);

BadgePanel trendBadge = new BadgePanel(ID_TREND_BADGE, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismReferenceWrapper;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebPrismUtil;
import com.evolveum.midpoint.prism.*;
Expand Down Expand Up @@ -124,6 +125,11 @@ private void removeIdFromContainerValue(PrismValue value) {
private Collection<ItemDelta<PrismValue, ItemDefinition<?>>> processModifyDeltas(
Collection<ItemDelta<PrismValue, ItemDefinition<?>>> deltas) throws SchemaException {

PrismReferenceWrapper superRef = findReference(ItemPath.create(ResourceType.F_SUPER, SuperResourceDeclarationType.F_RESOURCE_REF));
if (superRef != null && superRef.isEmpty()) {
return deltas;
}

Collection<ItemDelta<PrismValue, ItemDefinition<?>>> processedDeltas = new ArrayList<>();

for (ItemDelta<PrismValue, ItemDefinition<?>> delta : deltas) {
Expand Down Expand Up @@ -225,18 +231,19 @@ private PrismContainerValue<?> createParentValueForAddDelta(
if (!subPath.isEmpty() && ItemPath.isId(subPath.last())) {
subPath = subPath.allExceptLast();
}
if (valueOfExistingDelta.find(subPath) != null) {
if (subPath.isEmpty()) {
newValue = valueOfExistingDelta;
} else if (valueOfExistingDelta.find(subPath) != null) {
isItemFound = true;
newContainer = (PrismContainer) valueOfExistingDelta.find(subPath);
newValue = newContainer.getValue(origParentValue.getId());
}
}

if (newContainer == null) {
newContainer = origParentValue.getDefinition().instantiate();
}

if (newValue == null) {
if (newContainer == null) {
newContainer = origParentValue.getDefinition().instantiate();
}
newValue = newContainer.createNewValue();
newValue.setId(origParentValue.getId());
Class<?> typeClass = newValue.getComplexTypeDefinition().getTypeClass();
Expand Down Expand Up @@ -268,11 +275,13 @@ private PrismContainerValue<?> createParentValueForAddDelta(
return valueOfExistingDelta;
}

if (WebPrismUtil.isValueFromResourceTemplate(parentValue, getItem())) {
return createParentValueForAddDelta(parentValue, newContainer, valueOfExistingDelta);
}
if (newContainer != null) {
if (WebPrismUtil.isValueFromResourceTemplate(parentValue, getItem())) {
return createParentValueForAddDelta(parentValue, newContainer, valueOfExistingDelta);
}

newContainer.setParent(parentValue);
newContainer.setParent(parentValue);
}
return newValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ public static <C extends ObjectType> List<IColumn<SelectableBean<C>, String>> ge
return getDefaultOrgColumns(pageBase);
} else if (ServiceType.class.equals(type)) {
return getDefaultServiceColumns();
} else if (ArchetypeType.class.equals(type)) {
return getDefaultArchetypeColumns();
} else if (type.equals(TaskType.class)) {
return getDefaultTaskColumns();
} else if (type.equals(ResourceType.class)) {
Expand Down Expand Up @@ -489,7 +491,7 @@ public boolean isEnabled() {
public static <T extends ObjectType> List<IColumn<SelectableBean<T>, String>> getDefaultArchetypeColumns() {
List<IColumn<SelectableBean<T>, String>> columns = new ArrayList<>();

columns.addAll((Collection) getDefaultAbstractRoleColumns(true));
columns.addAll((Collection) getDefaultAbstractRoleColumns(false));

return columns;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected String load() {
break;
case DELETE:
default:
count = delta.getModifications().size();
count = delta.getModifications().stream().filter(i -> !i.isOperational()).count();
}

return LocalizationUtil.translate("ProcessedObjectsPanel.progressMessage", new Object[] { msg, count });
Expand Down

0 comments on commit d64854c

Please sign in to comment.