Skip to content

Commit

Permalink
MID-8329:adding breadcrumb for object type when open part of resource…
Browse files Browse the repository at this point in the history
… wizard from detail page
  • Loading branch information
skublik committed Mar 22, 2023
1 parent b1a2c10 commit 18edc1f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.api.util.WebPrismUtil;
import com.evolveum.midpoint.gui.impl.component.wizard.AbstractWizardPanel;
import com.evolveum.midpoint.gui.impl.component.wizard.WizardPanelHelper;
import com.evolveum.midpoint.gui.impl.page.admin.DetailsFragment;
import com.evolveum.midpoint.gui.impl.page.admin.TemplateChoicePanel;
Expand Down Expand Up @@ -254,7 +255,7 @@ public List<Breadcrumb> getWizardBreadcrumbs() {
return wizardBreadcrumbs;
}

protected <C extends Containerable, P extends BasePanel> P showWizard(
protected <C extends Containerable, P extends AbstractWizardPanel<C, AHDM>> P showWizard(
AjaxRequestTarget target,
ItemPath pathToValue,
Class<P> clazz) {
Expand Down Expand Up @@ -325,6 +326,7 @@ public void onExitPerformed(AjaxRequestTarget target) {
getObjectDetailsModels().reset();
getObjectDetailsModels().reloadPrismObjectModel(oldObject);
backToDetailsFromWizard(target);
getWizardBreadcrumbs().clear();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
package com.evolveum.midpoint.gui.impl.page.admin.resource;

import java.util.Collection;
import java.util.List;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
import com.evolveum.midpoint.gui.impl.component.wizard.AbstractWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.PageAssignmentHolderDetails;
import com.evolveum.midpoint.gui.impl.page.admin.component.ResourceOperationalButtonsPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.ResourceWizardPanel;
Expand All @@ -21,6 +24,8 @@
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.correlation.CorrelationWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.credentials.CredentialsWizardPanel;
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.synchronization.SynchronizationWizardPanel;
import com.evolveum.midpoint.gui.impl.util.GuiDisplayNameUtil;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
Expand All @@ -30,12 +35,15 @@

import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import com.evolveum.midpoint.gui.api.model.LoadableModel;
Expand Down Expand Up @@ -128,7 +136,8 @@ protected Collection<SelectorOptions<GetOperationOptions>> getOperationOptions()
}

public void showResourceObjectTypeBasicWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, ResourceObjectTypeBasicWizardPanel.class);
ResourceObjectTypeBasicWizardPanel wizardPanel = showWizard(target, pathToValue, ResourceObjectTypeBasicWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showResourceObjectTypePreviewWizard(AjaxRequestTarget target, ItemPath pathToValue) {
Expand All @@ -137,27 +146,33 @@ public void showResourceObjectTypePreviewWizard(AjaxRequestTarget target, ItemPa
}

public void showSynchronizationWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, SynchronizationWizardPanel.class);
SynchronizationWizardPanel wizardPanel = showWizard(target, pathToValue, SynchronizationWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showCorrelationWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, CorrelationWizardPanel.class);
CorrelationWizardPanel wizardPanel = showWizard(target, pathToValue, CorrelationWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showCapabilitiesWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, CapabilitiesWizardPanel.class);
CapabilitiesWizardPanel wizardPanel = showWizard(target, pathToValue, CapabilitiesWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showCredentialsWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, CredentialsWizardPanel.class);
CredentialsWizardPanel wizardPanel = showWizard(target, pathToValue, CredentialsWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showActivationsWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, ActivationsWizardPanel.class);
ActivationsWizardPanel wizardPanel = showWizard(target, pathToValue, ActivationsWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showAssociationsWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, AssociationsWizardPanel.class);
AssociationsWizardPanel wizardPanel = showWizard(target, pathToValue, AssociationsWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public ResourceObjectTypeWizardPanel showObjectTypeWizard(AjaxRequestTarget target, ItemPath pathToValue) {
Expand All @@ -167,6 +182,17 @@ public ResourceObjectTypeWizardPanel showObjectTypeWizard(AjaxRequestTarget targ
}

public void showAttributeMappingWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showWizard(target, pathToValue, AttributeMappingWizardPanel.class);
AttributeMappingWizardPanel wizardPanel = showWizard(target, pathToValue, AttributeMappingWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

private void addWizardBreadcrumbsForObjectType(
AbstractWizardPanel<ResourceObjectTypeDefinitionType, ResourceDetailsModel> wizardPanel) {
List<Breadcrumb> breadcrumbs = getWizardBreadcrumbs();
ResourceObjectTypeDefinitionType objectType = wizardPanel.getValueModel().getObject().getRealValue();
String displayName = GuiDisplayNameUtil.getDisplayName(objectType);
IModel<String> breadcrumbLabelModel = Model.of(displayName);

breadcrumbs.add(0, new Breadcrumb(breadcrumbLabelModel));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static String getDisplayName(ResourceObjectTypeDefinitionType objectType)
}
if (StringUtils.isNotEmpty(objectType.getIntent())) {
if (StringUtils.isNotEmpty(sb.toString())) {
sb.append("-");
sb.append("/");
}
sb.append(objectType.getIntent());
}
Expand Down

0 comments on commit 18edc1f

Please sign in to comment.