Repository: syncope Updated Branches: refs/heads/2_0_X 3b24fd10f -> 3ab10dd44
Revert "[SYNCOPE-1190] Toggle menu header is now updated when elements get updated" This reverts commit 84a7b68e4f8a2ea9e3fd99f5b01266b16d99a3fd. Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3ab10dd4 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3ab10dd4 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3ab10dd4 Branch: refs/heads/2_0_X Commit: 3ab10dd447b5c110e96ffdc34e8e37cf0629df91 Parents: 3b24fd1 Author: skylark17 <matteo.alessandr...@tirasa.net> Authored: Fri Aug 11 11:48:13 2017 +0200 Committer: skylark17 <matteo.alessandr...@tirasa.net> Committed: Fri Aug 11 11:50:18 2017 +0200 ---------------------------------------------------------------------- .../console/panels/AbstractLogsPanel.java | 1 - .../panels/SecurityQuestionsModalPanel.java | 6 -- .../client/console/panels/TogglePanel.java | 105 ------------------- .../policies/PolicyModalPanelBuilder.java | 7 -- .../client/console/topology/Topology.java | 2 +- .../console/topology/TopologyTogglePanel.java | 18 +--- .../html/form/ActionLinksTogglePanel.java | 72 +++++++++++-- .../console/wizards/AjaxWizardBuilder.java | 5 - 8 files changed, 64 insertions(+), 152 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java index 5246509..fef5be5 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractLogsPanel.java @@ -74,7 +74,6 @@ public abstract class AbstractLogsPanel<T extends AbstractBaseBean> extends Pane loggerTOs.hideLabel(); loggerTOs.setChoices(Arrays.asList(LoggerLevel.values())); - loggerTOs.setNullValid(false); loggerTOs.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsModalPanel.java index 883325d..a639035 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsModalPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsModalPanel.java @@ -27,7 +27,6 @@ import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.Bas import org.apache.syncope.common.lib.to.SecurityQuestionTO; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.event.Broadcast; import org.apache.wicket.markup.html.form.Form; public class SecurityQuestionsModalPanel extends AbstractModalPanel<SecurityQuestionTO> { @@ -63,11 +62,6 @@ public class SecurityQuestionsModalPanel extends AbstractModalPanel<SecurityQues } SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); - - // [SYNCOPE-1190] - refresh toggle panel after update - send(pageRef.getPage(), Broadcast.BREADTH, - new TogglePanel.ActionLinkToggleUpdateEventPayload<>(target, securityQuestionTO)); - modal.close(target); } catch (Exception e) { LOG.error("While creating or updating {}", securityQuestionTO, e); http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java index ba9f9b1..62c2af4 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java @@ -21,29 +21,7 @@ package org.apache.syncope.client.console.panels; import java.io.Serializable; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.status.StatusBean; -import org.apache.syncope.client.console.policies.PolicyRuleDirectoryPanel; -import org.apache.syncope.client.console.reports.ReportletDirectoryPanel; import org.apache.syncope.client.console.wizards.WizardMgtPanel; -import org.apache.syncope.client.console.wizards.any.AnyWrapper; -import org.apache.syncope.client.console.wizards.any.GroupWrapper; -import org.apache.syncope.client.console.wizards.any.UserWrapper; -import org.apache.syncope.common.lib.policy.AbstractPolicyTO; -import org.apache.syncope.common.lib.to.AccessTokenTO; -import org.apache.syncope.common.lib.to.AnyObjectTO; -import org.apache.syncope.common.lib.to.AnyTO; -import org.apache.syncope.common.lib.to.AttrTO; -import org.apache.syncope.common.lib.to.ConnInstanceTO; -import org.apache.syncope.common.lib.to.EntityTO; -import org.apache.syncope.common.lib.to.ExecTO; -import org.apache.syncope.common.lib.to.GroupTO; -import org.apache.syncope.common.lib.to.JobTO; -import org.apache.syncope.common.lib.to.ReportTO; -import org.apache.syncope.common.lib.to.SchedTaskTO; -import org.apache.syncope.common.lib.to.SecurityQuestionTO; -import org.apache.syncope.common.lib.to.UserTO; -import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; -import org.apache.syncope.common.lib.to.WorkflowFormTO; import org.apache.wicket.Component; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxEventBehavior; @@ -51,7 +29,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.model.ResourceModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -175,86 +152,4 @@ public abstract class TogglePanel<T extends Serializable> extends WizardMgtPanel status = Status.INACTIVE; } } - - protected String getHeader(final T modelObject) { - final String headerValue; - if (modelObject == null) { - headerValue = new ResourceModel("actions", StringUtils.EMPTY).getObject(); - } else if (modelObject instanceof UserTO) { - headerValue = ((UserTO) modelObject).getUsername(); - } else if (modelObject instanceof GroupTO) { - headerValue = ((GroupTO) modelObject).getName(); - } else if (modelObject instanceof UserWrapper) { - headerValue = UserWrapper.class.cast(modelObject).getInnerObject().getUsername(); - } else if (modelObject instanceof GroupWrapper) { - headerValue = GroupWrapper.class.cast(modelObject).getInnerObject().getName(); - } else if (modelObject instanceof AnyWrapper) { - AnyTO anyWrapper = AnyWrapper.class.cast(modelObject).getInnerObject(); - if (anyWrapper instanceof AnyObjectTO) { - headerValue = ((AnyObjectTO) anyWrapper).getName(); - } else { - headerValue = new ResourceModel("actions", StringUtils.EMPTY).getObject(); - } - } else if (modelObject instanceof ConnInstanceTO) { - headerValue = ConnInstanceTO.class.cast(modelObject).getDisplayName(); - } else if (modelObject instanceof ReportTO) { - headerValue = ((ReportTO) modelObject).getName(); - } else if (modelObject instanceof AnyObjectTO) { - headerValue = ((AnyObjectTO) modelObject).getName(); - } else if (modelObject instanceof AttrTO) { - headerValue = ((AttrTO) modelObject).getSchema(); - } else if (modelObject instanceof AbstractPolicyTO) { - headerValue = ((AbstractPolicyTO) modelObject).getDescription(); - } else if (modelObject instanceof SecurityQuestionTO) { - headerValue = ((SecurityQuestionTO) modelObject).getContent(); - } else if (modelObject instanceof AccessTokenTO) { - headerValue = ((AccessTokenTO) modelObject).getOwner(); - } else if (modelObject instanceof ExecTO) { - headerValue = ((ExecTO) modelObject).getKey(); - } else if (modelObject instanceof WorkflowDefinitionTO) { - headerValue = ((WorkflowDefinitionTO) modelObject).getName(); - } else if (modelObject instanceof SchedTaskTO) { - headerValue = ((SchedTaskTO) modelObject).getName(); - } else if (modelObject instanceof WorkflowFormTO) { - headerValue = ((WorkflowFormTO) modelObject).getKey(); - } else if (modelObject instanceof EntityTO) { - headerValue = ((EntityTO) modelObject).getKey(); - } else if (modelObject instanceof StatusBean) { - headerValue = ((StatusBean) modelObject).getResource(); - } else if (modelObject instanceof PolicyRuleDirectoryPanel.PolicyRuleWrapper) { - headerValue = ((PolicyRuleDirectoryPanel.PolicyRuleWrapper) modelObject).getName(); - } else if (modelObject instanceof PolicyRuleDirectoryPanel.PolicyRuleWrapper) { - headerValue = ((PolicyRuleDirectoryPanel.PolicyRuleWrapper) modelObject).getName(); - } else if (modelObject instanceof ReportletDirectoryPanel.ReportletWrapper) { - headerValue = ((ReportletDirectoryPanel.ReportletWrapper) modelObject).getName(); - } else if (modelObject instanceof JobTO) { - headerValue = ((JobTO) modelObject).getRefKey() == null - ? ((JobTO) modelObject).getRefDesc() : ((JobTO) modelObject).getRefKey(); - } else { - headerValue = new ResourceModel("actions", StringUtils.EMPTY).getObject(); - } - - return headerValue; - } - - public static class ActionLinkToggleUpdateEventPayload<T> { - - private final AjaxRequestTarget target; - - private final T modelObj; - - public ActionLinkToggleUpdateEventPayload(final AjaxRequestTarget target, final T modelObj) { - this.target = target; - this.modelObj = modelObj; - } - - public AjaxRequestTarget getTarget() { - return target; - } - - public T getModelObj() { - return modelObj; - } - - } } http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java index 608dcca..7507d04 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java @@ -27,7 +27,6 @@ import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.panels.AbstractModalPanel; -import org.apache.syncope.client.console.panels.TogglePanel; import org.apache.syncope.client.console.panels.WizardModalPanel; import org.apache.syncope.client.console.rest.PolicyRestClient; import org.apache.syncope.client.console.rest.ResourceRestClient; @@ -46,7 +45,6 @@ import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.wicket.Component; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.event.Broadcast; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; @@ -163,11 +161,6 @@ public class PolicyModalPanelBuilder<T extends AbstractPolicyTO> extends Abstrac restClient.updatePolicy(policyTO); } SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); - - // [SYNCOPE-1190] - refresh toggle panel after update - send(pageRef.getPage(), Broadcast.BREADTH, - new TogglePanel.ActionLinkToggleUpdateEventPayload<>(target, policyTO)); - Profile.this.modal.close(target); } catch (Exception e) { LOG.error("While creating/updating policy", e); http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java index 99a80ba..606a32d 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java @@ -165,7 +165,7 @@ public class Topology extends BasePage { body.add(new TopologyWebSocketBehavior()); - togglePanel = new TopologyTogglePanel<>("toggle", getPageReference()); + togglePanel = new TopologyTogglePanel("toggle", getPageReference()); body.add(togglePanel); // ----------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java index 57afa04..8b6b1a5 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java @@ -53,7 +53,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; -import org.apache.wicket.event.IEvent; import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -64,7 +63,7 @@ import org.apache.wicket.model.Model; import org.apache.wicket.model.ResourceModel; import org.apache.wicket.model.StringResourceModel; -public class TopologyTogglePanel<T extends Serializable> extends TogglePanel<Serializable> { +public class TopologyTogglePanel extends TogglePanel<Serializable> { private static final long serialVersionUID = -2025535531121434056L; @@ -649,19 +648,4 @@ public class TopologyTogglePanel<T extends Serializable> extends TogglePanel<Ser } } - - @Override - @SuppressWarnings("unchecked") - public void onEvent(final IEvent<?> event) { - if (event.getPayload() instanceof ActionLinkToggleUpdateEventPayload) { - String header = getHeader((T) ActionLinkToggleUpdateEventPayload.class.cast(event. - getPayload()).getModelObj()); - if (StringUtils.isNotBlank(header)) { - setHeader(ActionLinkToggleUpdateEventPayload.class.cast(event.getPayload()). - getTarget(), StringUtils.abbreviate(header, 25)); - } - } - - super.onEvent(event); - } } http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java index 16b79f5..fb8ab83 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java @@ -22,13 +22,31 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; import java.io.Serializable; import java.util.UUID; import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.client.console.commons.status.StatusBean; import org.apache.syncope.client.console.panels.TogglePanel; +import org.apache.syncope.client.console.policies.PolicyRuleDirectoryPanel.PolicyRuleWrapper; +import org.apache.syncope.client.console.reports.ReportletDirectoryPanel.ReportletWrapper; +import org.apache.syncope.common.lib.to.AnyObjectTO; +import org.apache.syncope.common.lib.to.EntityTO; +import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.ReportTO; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.common.lib.to.SecurityQuestionTO; +import org.apache.syncope.common.lib.policy.AbstractPolicyTO; +import org.apache.syncope.common.lib.to.AccessTokenTO; +import org.apache.syncope.common.lib.to.ExecTO; +import org.apache.syncope.common.lib.to.JobTO; +import org.apache.syncope.common.lib.to.SchedTaskTO; +import org.apache.syncope.common.lib.to.WorkflowDefinitionTO; +import org.apache.syncope.common.lib.to.WorkflowFormTO; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.IEvent; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.model.ResourceModel; public class ActionLinksTogglePanel<T extends Serializable> extends TogglePanel<Serializable> { @@ -51,8 +69,50 @@ public class ActionLinksTogglePanel<T extends Serializable> extends TogglePanel< public void toggleWithContent( final AjaxRequestTarget target, final ActionsPanel<T> actionsPanel, final T modelObject) { - - setHeader(target, StringUtils.abbreviate(getHeader(modelObject), 25)); + final String header; + if (modelObject == null) { + header = new ResourceModel("actions", StringUtils.EMPTY).getObject(); + } else if (modelObject instanceof UserTO) { + header = ((UserTO) modelObject).getUsername(); + } else if (modelObject instanceof GroupTO) { + header = ((GroupTO) modelObject).getName(); + } else if (modelObject instanceof ReportTO) { + header = ((ReportTO) modelObject).getName(); + } else if (modelObject instanceof AnyObjectTO) { + header = ((AnyObjectTO) modelObject).getName(); + } else if (modelObject instanceof AttrTO) { + header = ((AttrTO) modelObject).getSchema(); + } else if (modelObject instanceof AbstractPolicyTO) { + header = ((AbstractPolicyTO) modelObject).getDescription(); + } else if (modelObject instanceof SecurityQuestionTO) { + header = ((SecurityQuestionTO) modelObject).getContent(); + } else if (modelObject instanceof AccessTokenTO) { + header = ((AccessTokenTO) modelObject).getOwner(); + } else if (modelObject instanceof ExecTO) { + header = ((ExecTO) modelObject).getKey(); + } else if (modelObject instanceof WorkflowDefinitionTO) { + header = ((WorkflowDefinitionTO) modelObject).getName(); + } else if (modelObject instanceof SchedTaskTO) { + header = ((SchedTaskTO) modelObject).getName(); + } else if (modelObject instanceof WorkflowFormTO) { + header = ((WorkflowFormTO) modelObject).getKey(); + } else if (modelObject instanceof EntityTO) { + header = ((EntityTO) modelObject).getKey(); + } else if (modelObject instanceof StatusBean) { + header = ((StatusBean) modelObject).getResource(); + } else if (modelObject instanceof PolicyRuleWrapper) { + header = ((PolicyRuleWrapper) modelObject).getName(); + } else if (modelObject instanceof PolicyRuleWrapper) { + header = ((PolicyRuleWrapper) modelObject).getName(); + } else if (modelObject instanceof ReportletWrapper) { + header = ((ReportletWrapper) modelObject).getName(); + } else if (modelObject instanceof JobTO) { + header = ((JobTO) modelObject).getRefKey() == null + ? ((JobTO) modelObject).getRefDesc() : ((JobTO) modelObject).getRefKey(); + } else { + header = new ResourceModel("actions", StringUtils.EMPTY).getObject(); + } + setHeader(target, StringUtils.abbreviate(header, 25)); modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { @@ -79,17 +139,9 @@ public class ActionLinksTogglePanel<T extends Serializable> extends TogglePanel< } @Override - @SuppressWarnings("unchecked") public void onEvent(final IEvent<?> event) { if (event.getPayload() instanceof ActionLinkToggleCloseEventPayload) { close(ActionLinkToggleCloseEventPayload.class.cast(event.getPayload()).getTarget()); - } else if (event.getPayload() instanceof ActionLinkToggleUpdateEventPayload) { - String header = getHeader((T) ActionLinkToggleUpdateEventPayload.class.cast(event. - getPayload()).getModelObj()); - if (StringUtils.isNotBlank(header)) { - setHeader(ActionLinkToggleUpdateEventPayload.class.cast(event.getPayload()).getTarget(), - StringUtils.abbreviate(header, 25)); - } } } http://git-wip-us.apache.org/repos/asf/syncope/blob/3ab10dd4/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java index f0896f1..32514ad 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java @@ -22,7 +22,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.syncope.client.console.panels.TogglePanel; import org.apache.wicket.Component; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -121,10 +120,6 @@ public abstract class AjaxWizardBuilder<T extends Serializable> extends Abstract send(pageRef.getPage(), Broadcast.BUBBLE, payload); } - // [SYNCOPE-1190] - refresh toggle panel after update - send(pageRef.getPage(), Broadcast.BREADTH, - new TogglePanel.ActionLinkToggleUpdateEventPayload<>(target, modelObject)); - return res; } }.setEventSink(eventSink).addOuterObject(outerObjects);