Commit 8a1d2cff authored by Amleto Di Salle's avatar Amleto Di Salle
Browse files
parents b12d7595 12f5bc84
......@@ -25,6 +25,7 @@ import org.apache.syncope.client.console.panels.EnactmentEngineDirectoryPanel;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
......@@ -39,19 +40,18 @@ public class EnactmentEnginePage extends BaseExtPage {
private final BaseModal<Serializable> utilityModal = new BaseModal<>("addEnactmentModal");
private final WebMarkupContainer content;
public EnactmentEnginePage(final PageParameters parameters) {
super(parameters);
body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
WebMarkupContainer content = new WebMarkupContainer("content");
content = new WebMarkupContainer("content");
content.setOutputMarkupId(true);
content.add(new EnactmentEngineDirectoryPanel("enactmentengines", getPageReference()));
utilityModal.size(Modal.Size.Large);
utilityModal.addSubmitButton();
content.add(new AjaxLink("addLink") {
private static final long serialVersionUID = 4879178530891785513L;
......@@ -65,15 +65,28 @@ public class EnactmentEnginePage extends BaseExtPage {
}
});
body.add(utilityModal);
utilityModal.size(Modal.Size.Large);
utilityModal.addSubmitButton();
body.add(content);
}
utilityModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
private static final long serialVersionUID = -4920274615194015386L;
@Override
public void setWindowClosedCallback(final BaseModal<?> modal, final WebMarkupContainer container) {
this.renderPage();
public void onClose(final AjaxRequestTarget target) {
target.add(getEEDirectoryPanel());
target.add(content);
utilityModal.show(false);
}
});
body.add(utilityModal);
body.add(content);
body.setOutputMarkupId(true);
}
private EnactmentEngineDirectoryPanel getEEDirectoryPanel() {
return new EnactmentEngineDirectoryPanel("enactmentengines", getPageReference());
}
}
......@@ -22,6 +22,7 @@ import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.BasePage;
import static org.apache.syncope.client.console.panels.AbstractModalPanel.LOG;
import org.apache.syncope.client.console.rest.EnactmentEngineRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyObjectTO;
......@@ -33,12 +34,15 @@ public class EditEnactmentEngineModalPanel extends AbstractEnactmentEngineModalP
private final AnyObjectTO enactmentEngine;
private final EnactmentEngineRestClient restClient;
public EditEnactmentEngineModalPanel(
final BaseModal<Serializable> modal,
final PageReference pageRef,
final AnyObjectTO enactmentEngine) {
super(modal, pageRef);
this.enactmentEngine = enactmentEngine;
this.restClient = new EnactmentEngineRestClient();
nameInput.setModelObject(enactmentEngine.getName());
urlInput.setModelObject(enactmentEngine.getPlainAttrMap().get("enactmentEngineBaseURL").getValues().get(0));
......@@ -59,6 +63,7 @@ public class EditEnactmentEngineModalPanel extends AbstractEnactmentEngineModalP
enactmentEngineTO.setBaseUrl(urlInput.getModelObject());
enactmentEngineTO.setUsername(usernameInput.getModelObject());
enactmentEngineTO.setPassword(passwordInput.getModelObject());
restClient.update(enactmentEngineTO);
modal.close(target);
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientException e) {
......
......@@ -30,6 +30,7 @@ import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
......@@ -53,6 +54,14 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
utilityModal.addSubmitButton();
utilityModal.size(Modal.Size.Medium);
addOuterObject(utilityModal);
utilityModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
@Override
public void onClose(final AjaxRequestTarget target) {
target.add(container);
utilityModal.show(false);
}
});
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment