Skip to content

Commit

Permalink
Fix displaying role analysis on generic repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tchrapovic committed Oct 3, 2023
1 parent e5983c3 commit f62c1d8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class PageRoleAnalysis extends PageAdmin {
private static final String DOT_CLASS = PageRoleAnalysis.class.getName() + ".";
private static final String OP_DELETE_SESSION = DOT_CLASS + "deleteSession";
private static final String ID_MAIN_FORM = "mainForm";
private static final String ID_CHART_PANEL = "chartPanel";
private static final String ID_TABLE = "table";

public PageRoleAnalysis(PageParameters params) {
Expand All @@ -91,10 +92,6 @@ public PageRoleAnalysis(PageParameters params) {
protected void onInitialize() {
super.onInitialize();
initLayout();

RoleAnalysisChartPanel roleAnalysisChartPanel = new RoleAnalysisChartPanel("chartPanel");
roleAnalysisChartPanel.setOutputMarkupId(true);
add(roleAnalysisChartPanel);
}

private InlineMenuItem createDeleteInlineMenu() {
Expand Down Expand Up @@ -154,15 +151,19 @@ public IModel<String> getConfirmationMessageModel() {
}

protected void initLayout() {

Form<?> mainForm = new MidpointForm<>(ID_MAIN_FORM);
add(mainForm);

if (!isNativeRepo()) {
mainForm.add(new ErrorPanel(ID_TABLE,
() -> getString("PageRoleAnalysis.menu.nonNativeRepositoryWarning")));
mainForm.add(new ErrorPanel(ID_TABLE, createStringResource("RoleAnalysis.menu.nonNativeRepositoryWarning")));
add(new EmptyPanel(ID_CHART_PANEL));
return;
}

RoleAnalysisChartPanel roleAnalysisChartPanel = new RoleAnalysisChartPanel(ID_CHART_PANEL);
roleAnalysisChartPanel.setOutputMarkupId(true);
add(roleAnalysisChartPanel);

MainObjectListPanel<RoleAnalysisSessionType> table = new MainObjectListPanel<>(ID_TABLE, RoleAnalysisSessionType.class) {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.util.string.StringValue;

import com.evolveum.midpoint.authentication.api.authorization.AuthorizationAction;
import com.evolveum.midpoint.authentication.api.authorization.PageDescriptor;
Expand All @@ -30,6 +31,7 @@
import com.evolveum.midpoint.gui.impl.component.icon.LayeredIconCssStyle;
import com.evolveum.midpoint.gui.impl.component.wizard.AbstractWizardPanel;
import com.evolveum.midpoint.gui.impl.component.wizard.WizardPanelHelper;
import com.evolveum.midpoint.gui.impl.error.ErrorPanel;
import com.evolveum.midpoint.gui.impl.page.admin.DetailsFragment;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.PageAssignmentHolderDetails;
Expand All @@ -45,8 +47,6 @@
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.util.string.StringValue;

//TODO correct authorizations
@PageDescriptor(
urls = {
Expand Down Expand Up @@ -212,6 +212,15 @@ private boolean canShowWizard() {
}

protected DetailsFragment createDetailsFragment() {
if (!isNativeRepo()) {
return new DetailsFragment(ID_DETAILS_VIEW, ID_TEMPLATE_VIEW, PageRoleAnalysisSession.this) {
@Override
protected void initFragmentLayout() {
add(new ErrorPanel(ID_TEMPLATE,
createStringResource("RoleAnalysis.menu.nonNativeRepositoryWarning")));
}
};
}

if (canShowWizard()) {
setShowedByWizard(true);
Expand Down Expand Up @@ -271,7 +280,7 @@ protected void initFragmentLayout() {
Constructor<? extends AbstractWizardPanel> constructor = clazz.getConstructor(String.class, WizardPanelHelper.class);
AbstractWizardPanel wizard = constructor.newInstance(ID_TEMPLATE, createObjectWizardPanelHelper());
add(wizard);
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ignored) {

}
}
Expand Down

0 comments on commit f62c1d8

Please sign in to comment.