Skip to content

Commit

Permalink
simulations - new delta viewer used (old one only if experimental fea…
Browse files Browse the repository at this point in the history
…tures are explicitly set to false)
  • Loading branch information
1azyman committed Mar 15, 2023
1 parent 7907ccf commit 05f8368
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
import java.util.List;
import java.util.Objects;

import com.evolveum.midpoint.authentication.api.util.AuthUtil;
import com.evolveum.midpoint.model.api.authentication.CompiledGuiProfile;
import com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseException;
Expand Down Expand Up @@ -370,14 +375,24 @@ protected String getPaginationCssClass() {

ChangesPanel changesNew = new ChangesPanel(ID_CHANGES_NEW, () -> Arrays.asList(objectModel.getObject().getDelta()), null);
changesNew.setShowOperationalItems(true);
changesNew.add(new VisibleBehaviour(() -> WebComponentUtil.isEnabledExperimentalFeatures()));
changesNew.add(new VisibleBehaviour(() -> !isExperimentalFeaturesDisabled()));
add(changesNew);

VisualizationPanel changes = new VisualizationPanel(ID_CHANGES, changesModel);
changes.add(new VisibleBehaviour(() -> changesModel.getObject() != null && !WebComponentUtil.isEnabledExperimentalFeatures()));
changes.add(new VisibleBehaviour(() -> changesModel.getObject() != null && isExperimentalFeaturesDisabled()));
add(changes);
}

private boolean isExperimentalFeaturesDisabled() {
GuiProfiledPrincipal principal = AuthUtil.getPrincipalUser();
if (principal == null) {
return false;
}

CompiledGuiProfile profile = principal.getCompiledGuiProfile();
return profile != null && BooleanUtils.isFalse(profile.isEnableExperimentalFeatures());
}

private List<IColumn<SelectableBean<SimulationResultProcessedObjectType>, String>> createColumns() {
List<IColumn<SelectableBean<SimulationResultProcessedObjectType>, String>> columns = new ArrayList<>();
columns.add(SimulationsGuiUtil.createProcessedObjectIconColumn());
Expand Down

0 comments on commit 05f8368

Please sign in to comment.