Commit 938cfe7e authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Added modal panel for new Enactment Engine and EE detail page

parent 958578b0
/*
* Copyright 2016 The CHOReVOLUTION project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.syncope.client.console.pages;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.rest.AnyObjectRestClient;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.request.mapper.parameter.PageParameters;
public class EnactmentEngineDetailPage extends BaseExtPage {
private static final long serialVersionUID = 1092769178017851238L;
private final AnyObjectRestClient restClient;
private final String enactmentEngineKey;
private final AnyObjectTO enactmentEngine;
public EnactmentEngineDetailPage(final PageParameters parameters) {
super(parameters);
restClient = new AnyObjectRestClient();
enactmentEngineKey = parameters.get("ee").toString();
enactmentEngine = restClient.read(enactmentEngineKey);
// Set page title
body.add(new Label("header", getString("ee") + " " + enactmentEngine.getName()));
body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
body.add(BookmarkablePageLinkBuilder.build("enactmentEnginesBr", EnactmentEnginePage.class));
body.add(new Label("enactmentEngineName", enactmentEngine.getName()));
WebMarkupContainer content = new WebMarkupContainer("content");
content.add(new Label("enactmentEngineDetailsPageContent", "PAGE CONTENT"));
content.setOutputMarkupId(true);
// Re-enable when entilements for this service will be defined
//MetaDataRoleAuthorizationStrategy.authorize(content, ENABLE, CamelEntitlement.ROUTE_LIST);
body.add(content);
}
}
......@@ -15,11 +15,19 @@
*/
package org.apache.syncope.client.console.pages;
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import eu.chorevolution.idm.common.ChorevolutionEntitlement;
import java.io.Serializable;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.annotations.ExtPage;
import org.apache.syncope.client.console.panels.AddEnactmentEngineModalPanel;
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.WindowClosedCallback;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@ExtPage(label = "Enactment Engines", icon = "fa-cogs",
......@@ -30,6 +38,8 @@ public class EnactmentEnginePage extends BaseExtPage {
public static final String PREF_EE_PAGINATOR_ROWS = "ee.paginator.rows";
private final BaseModal<Serializable> utilityModal = new BaseModal<>("addEnactmentModal");
public EnactmentEnginePage(final PageParameters parameters) {
super(parameters);
......@@ -40,7 +50,35 @@ public class EnactmentEnginePage extends BaseExtPage {
content.add(new EnactmentEngineDirectoryPanel("enactmentengines", getPageReference()));
utilityModal.size(Modal.Size.Large);
utilityModal.addSubmitButton();
utilityModal.setWindowClosedCallback(new WindowClosedCallback() {
private static final long serialVersionUID = 2372096723782367810L;
@Override
public void onClose(final AjaxRequestTarget target) {
target.add(content);
utilityModal.show(false);
}
});
content.add(new AjaxLink("addLink") {
private static final long serialVersionUID = 4879178530891785513L;
@Override
public void onClick(final AjaxRequestTarget target) {
utilityModal.header(Model.of("New Enactment Engine"));
utilityModal.setContent(new AddEnactmentEngineModalPanel(utilityModal, getPageReference()));
utilityModal.show(true);
target.add(utilityModal);
}
});
body.add(utilityModal);
body.add(content);
}
}
/*
* Copyright 2016 The CHOReVOLUTION project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.syncope.client.console.panels;
import java.io.Serializable;
import org.apache.commons.lang3.StringUtils;
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.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.Model;
public class AddEnactmentEngineModalPanel extends AbstractModalPanel<Serializable> {
private static final long serialVersionUID = 1570261203472359825L;
private final BaseModal<Serializable> addEEModal;
private final FieldPanel<String> usernameInput;
private final FieldPanel<String> passwordInput;
private final FieldPanel<String> urlInput;
public AddEnactmentEngineModalPanel(
final BaseModal<Serializable> modal,
final PageReference pageRef) {
super(modal, pageRef);
this.addEEModal = modal;
final WebMarkupContainer container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
add(container);
final Form<String> form = new Form<>("AddEEForm");
form.setMarkupId("AddEEForm");
form.setOutputMarkupId(true);
container.add(form);
this.usernameInput = new AjaxTextFieldPanel("username", "Username", new Model<>(), true);
usernameInput.setRequired(true);
usernameInput.addRequiredLabel();
form.add(usernameInput);
this.passwordInput = new AjaxPasswordFieldPanel("password", "Password", new Model<>(), true);
passwordInput.setRequired(true);
passwordInput.addRequiredLabel();
form.add(passwordInput);
this.urlInput = new AjaxTextFieldPanel("url", "Base URL", new Model<>(), true);
urlInput.setRequired(true);
urlInput.addRequiredLabel();
form.add(urlInput);
}
@Override
public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
try {
//Define action!
addEEModal.close(target);
SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientException e) {
LOG.error("While creating new Enactment Engine", e);
SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
? e.getClass().getName() : e.getMessage());
}
((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}
......@@ -16,11 +16,11 @@
package org.apache.syncope.client.console.panels;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.syncope.client.console.commons.AnyDataProvider;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.EnactmentEngineDataProvider;
import org.apache.syncope.client.console.pages.EnactmentEngineDetailPage;
import org.apache.syncope.client.console.pages.EnactmentEnginePage;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder;
......@@ -36,6 +36,7 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.springframework.util.ReflectionUtils;
public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
......@@ -45,7 +46,7 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
public EnactmentEngineDirectoryPanel(final String id, final PageReference pageRef) {
super(id, new Builder(AnyTypeKind.ANY_OBJECT.name(), pageRef), false);
}
@Override
protected String paginatorRowsKey() {
return EnactmentEnginePage.PREF_EE_PAGINATOR_ROWS;
......@@ -67,33 +68,7 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
addPropertyColumn(name, ReflectionUtils.findField(AnyObjectTO.class, name), columns);
}
for (String name : prefMan.getList(
getRequest(), String.format(Constants.PREF_ANY_OBJECT_PLAIN_ATTRS_VIEW, type))) {
if (pSchemaNames.contains(name)) {
columns.add(new AttrColumn<AnyObjectTO>(name, SchemaType.PLAIN));
}
}
for (String name : prefMan.getList(
getRequest(), String.format(Constants.PREF_ANY_OBJECT_DER_ATTRS_VIEW, type))) {
if (dSchemaNames.contains(name)) {
columns.add(new AttrColumn<AnyObjectTO>(name, SchemaType.DERIVED));
}
}
// Add defaults in case of no selection
if (columns.isEmpty()) {
for (String name : AnyObjectDisplayAttributesModalPanel.DEFAULT_SELECTION) {
addPropertyColumn(name, ReflectionUtils.findField(AnyObjectTO.class, name), columns);
}
prefMan.setList(getRequest(), getResponse(),
String.format(Constants.PREF_ANY_OBJECT_DETAILS_VIEW, type),
Arrays.asList(AnyObjectDisplayAttributesModalPanel.DEFAULT_SELECTION));
}
columns.add(new AttrColumn<>("enactmentEngineBaseURL", SchemaType.PLAIN));
columns.add(new AbstractColumn<AnyObjectTO, String>(new ResourceModel("actions", "")) {
......@@ -113,9 +88,14 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
EnactmentEngineActionsPanel enactmentEngineActionsPanel = new EnactmentEngineActionsPanel(componentId);
enactmentEngineActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = 9203736181047160675L;
@Override
public void onClick(final AjaxRequestTarget art) {
//Define action!
PageParameters param = new PageParameters();
param.add("ee", model.getObject().getKey());
setResponsePage(EnactmentEngineDetailPage.class, param);
}
}, EnactmentEngineActionsPanel.EnactmentEngineActionType.SHOW);
item.add(enactmentEngineActionsPanel);
......
<!DOCTYPE html>
<!--
Copyright 2016 The CHOReVOLUTION project
*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
*
http://www.apache.org/licenses/LICENSE-2.0
*
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:extend>
<section class="content-header">
<h1>
<span wicket:id="header"></span>
</h1>
<ol class="breadcrumb">
<li><a wicket:id="dashboardBr"><i class="fa fa-dashboard"></i> <wicket:message key="dashboard"/></a></li>
<li><a wicket:id="enactmentEnginesBr"><wicket:message key="enactmentEngines"/></a></li>
<li class="active"><span wicket:id="enactmentEngineName"></span></li>
</ol>
</section>
<section class="content" wicket:id="content">
<div class="box">
<div class="box-body" wicket:id="enactmentEngineDetailsPageContent"/>
</div>
</section>
</wicket:extend>
</html>
\ No newline at end of file
#
# Copyright 2016 The CHOReVOLUTION project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ee=Enactment Engine
enactmentEngines=Enactment Engines
#
# Copyright 2016 The CHOReVOLUTION project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ee=Enactment Engine
enactmentEngines=Enactment Engines
#
# Copyright 2016 The CHOReVOLUTION project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ee=Enactment Engine
enactmentEngines=Enactment Engines
......@@ -28,8 +28,17 @@ limitations under the License.
<section class="content" wicket:id="content">
<div class="box">
<div class="box-body" wicket:id="enactmentengines"/>
<div class="box-body">
<div wicket:id="enactmentengines"></div>
<div class="modal-footer" style="text-align: right">
<a haref="#" class="btn btn-primary btn-circle btn-lg" wicket:id="addLink">
<i class="glyphicon glyphicon-plus"></i>
</a>
</div>
</div>
</div>
</section>
<div wicket:id="addEnactmentModal"></div>
</wicket:extend>
</html>
\ No newline at end of file
......@@ -14,4 +14,3 @@
# limitations under the License.
#
header_title=Enactment Engines
description=Description
......@@ -14,4 +14,3 @@
# limitations under the License.
#
header_title=Enactment Engines
description=Descrizione
......@@ -14,4 +14,3 @@
# limitations under the License.
#
header_title=Enactment Engines
description=Descri\u00e7\u00e3o
<!DOCTYPE html>
<!--
Copyright 2016 The CHOReVOLUTION project
*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
*
http://www.apache.org/licenses/LICENSE-2.0
*
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<span wicket:id="container">
<div class="form-group">
<form wicket:id="AddEEForm">
<div class="form-group">
<span wicket:id="username"/>
</div>
<div class="form-group">
<span wicket:id="password"/>
</div>
<div class="form-group">
<span wicket:id="url"/>
</div>
</form>
</div>
</span>
</wicket:panel>
</html>
\ No newline at end of file
Supports Markdown
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