-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better support for configuring shadow panels
- Loading branch information
Showing
22 changed files
with
723 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...dmin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/resource/PageShadow.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- | ||
~ Copyright (c) 2021 Evolveum | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
<!DOCTYPE html> | ||
<html xmlns:wicket="http://wicket.apache.org"> | ||
<body> | ||
<wicket:extend> | ||
<wicket:child /> | ||
</wicket:extend> | ||
</body> | ||
</html> |
127 changes: 127 additions & 0 deletions
127
...dmin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/resource/PageShadow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
* Copyright (c) 2010-2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.gui.impl.page.admin.resource; | ||
|
||
import com.evolveum.midpoint.gui.api.component.tabs.PanelTab; | ||
import com.evolveum.midpoint.gui.api.factory.wrapper.PrismObjectWrapperFactory; | ||
import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext; | ||
import com.evolveum.midpoint.gui.api.model.LoadableModel; | ||
import com.evolveum.midpoint.gui.api.prism.ItemStatus; | ||
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper; | ||
import com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils; | ||
import com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails; | ||
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; | ||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.prism.delta.ObjectDelta; | ||
import com.evolveum.midpoint.schema.GetOperationOptions; | ||
import com.evolveum.midpoint.schema.SelectorOptions; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.security.api.AuthorizationConstants; | ||
import com.evolveum.midpoint.task.api.Task; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
import com.evolveum.midpoint.util.logging.LoggingUtils; | ||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
import com.evolveum.midpoint.web.application.AuthorizationAction; | ||
import com.evolveum.midpoint.web.application.PageDescriptor; | ||
import com.evolveum.midpoint.web.application.Url; | ||
import com.evolveum.midpoint.web.component.AjaxButton; | ||
import com.evolveum.midpoint.web.component.AjaxSubmitButton; | ||
import com.evolveum.midpoint.web.component.AjaxTabbedPanel; | ||
import com.evolveum.midpoint.web.component.dialog.ConfirmationPanel; | ||
import com.evolveum.midpoint.web.component.form.MidpointForm; | ||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
import com.evolveum.midpoint.web.page.admin.PageAdmin; | ||
import com.evolveum.midpoint.web.page.admin.configuration.PageDebugView; | ||
import com.evolveum.midpoint.web.page.admin.resources.PageResources; | ||
import com.evolveum.midpoint.web.page.admin.resources.ShadowDetailsTabPanel; | ||
import com.evolveum.midpoint.web.page.admin.resources.ShadowSummaryPanel; | ||
import com.evolveum.midpoint.web.util.OnePageParameterEncoder; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; | ||
|
||
import org.apache.wicket.RestartResponseException; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.extensions.markup.html.tabs.ITab; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.form.Form; | ||
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 org.apache.wicket.util.string.StringValue; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
/** | ||
* @author lazyman | ||
*/ | ||
//TODO unify with PageAdminObjectDetails! | ||
@PageDescriptor( | ||
urls = { | ||
@Url(mountUrl = "/admin/resources/shadow") | ||
}, | ||
encoder = OnePageParameterEncoder.class, action = { | ||
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_RESOURCES_ALL_URL, | ||
label = "PageAdminResources.auth.resourcesAll.label", | ||
description = "PageAdminResources.auth.resourcesAll.description"), | ||
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_RESOURCES_ACCOUNT_URL, | ||
label = "PageAccount.auth.resourcesAccount.label", | ||
description = "PageAccount.auth.resourcesAccount.description")}) | ||
public class PageShadow extends AbstractPageObjectDetails<ShadowType, ShadowDetailsModel> { | ||
|
||
public PageShadow(PageParameters parameters) { | ||
super(parameters); | ||
} | ||
|
||
@Override | ||
protected Collection<SelectorOptions<GetOperationOptions>> getOperationOptions() { | ||
return getOperationOptionsBuilder() | ||
.item(ShadowType.F_RESOURCE_REF).resolve() | ||
.build(); | ||
} | ||
|
||
@Override | ||
protected Class<ShadowType> getType() { | ||
return ShadowType.class; | ||
} | ||
|
||
@Override | ||
protected Panel createSummaryPanel(String id, LoadableModel<ShadowType> summaryModel) { | ||
return new ShadowSummaryPanel(id, summaryModel, this); | ||
} | ||
|
||
@Override | ||
protected ShadowDetailsModel createObjectDetailsModels(PrismObject<ShadowType> object) { | ||
return new ShadowDetailsModel(createPrismObejctModel(object), this); | ||
} | ||
|
||
@Override | ||
protected IModel<String> createPageTitleModel() { | ||
return new LoadableModel<>(false) { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
protected String load() { | ||
ShadowType account = getObjectDetailsModels().getObjectType(); | ||
String accName = WebComponentUtil.getName(account); | ||
|
||
ResourceType resource = (ResourceType) account.getResourceRef().asReferenceValue().getObject().asObjectable(); | ||
String name = WebComponentUtil.getName(resource); | ||
|
||
//TODO: refactor | ||
return createStringResourceStatic(PageShadow.this, "PageAccount.title", accName, name).getString(); | ||
} | ||
}; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
.../src/main/java/com/evolveum/midpoint/gui/impl/page/admin/resource/ShadowDetailsModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.gui.impl.page.admin.resource; | ||
|
||
import com.evolveum.midpoint.gui.api.model.LoadableModel; | ||
import com.evolveum.midpoint.gui.api.util.ModelServiceLocator; | ||
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; | ||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.schema.ResourceShadowDiscriminator; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectDetailsPageType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; | ||
|
||
public class ShadowDetailsModel extends ObjectDetailsModels<ShadowType> { | ||
|
||
public ShadowDetailsModel(LoadableModel<PrismObject<ShadowType>> prismObjectModel, ModelServiceLocator serviceLocator) { | ||
super(prismObjectModel, serviceLocator); | ||
} | ||
|
||
protected GuiObjectDetailsPageType loadDetailsPageConfiguration(PrismObject<ShadowType> prismObject) { | ||
return getModelServiceLocator().getCompiledGuiProfile().findShadowDetailsConfiguration(createResourceShadowDiscriminator(prismObject.asObjectable())); | ||
} | ||
|
||
private ResourceShadowDiscriminator createResourceShadowDiscriminator(ShadowType shadow) { | ||
return new ResourceShadowDiscriminator(shadow.getResourceRef().getOid(), shadow.getKind(), shadow.getIntent(), null, false); | ||
} | ||
|
||
} |
Oops, something went wrong.