Commit fdaf7bb5 authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Completed EE detail page

parent cacba4f9
...@@ -18,25 +18,26 @@ package org.apache.syncope.client.console.panels; ...@@ -18,25 +18,26 @@ package org.apache.syncope.client.console.panels;
import eu.chorevolution.idm.common.to.ChoreographyTO; import eu.chorevolution.idm.common.to.ChoreographyTO;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.ChoreographyPage; import org.apache.syncope.client.console.pages.ChoreographyPage;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder; import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference; import org.apache.wicket.PageReference;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.springframework.util.ReflectionUtils;
public class ChoreographyServiceDirectoryPanel extends AnyObjectDirectoryPanel { public class ChoreographyServiceDirectoryPanel extends AnyObjectDirectoryPanel {
private static final long serialVersionUID = 7303610381539502741L; private static final long serialVersionUID = 7303610381539502741L;
private final ChoreographyTO choreography;
public ChoreographyServiceDirectoryPanel(final String id, public ChoreographyServiceDirectoryPanel(final String id,
final PageReference pageRef, final PageReference pageRef,
final ChoreographyTO choreography) { final ChoreographyTO choreography) {
super(id, new Builder(AnyTypeKind.ANY_OBJECT.name(), pageRef), false); super(id, new Builder(AnyTypeKind.ANY_OBJECT.name(), pageRef), false);
this.choreography = choreography; this.fiql = new AnyObjectFiqlSearchConditionBuilder("SERVICE")
this.fiql = new AnyObjectFiqlSearchConditionBuilder("ENACTMENT ENGINE")
.inGroups(choreography.getGroupKey()).query(); .inGroups(choreography.getGroupKey()).query();
dataProvider.setFIQL(fiql); dataProvider.setFIQL(fiql);
} }
...@@ -48,7 +49,17 @@ public class ChoreographyServiceDirectoryPanel extends AnyObjectDirectoryPanel { ...@@ -48,7 +49,17 @@ public class ChoreographyServiceDirectoryPanel extends AnyObjectDirectoryPanel {
@Override @Override
protected List<IColumn<AnyObjectTO, String>> getColumns() { protected List<IColumn<AnyObjectTO, String>> getColumns() {
return super.getColumns(); final List<IColumn<AnyObjectTO, String>> columns = new ArrayList<>();
for (String name : prefMan.getList(
getRequest(), String.format(Constants.PREF_ANY_OBJECT_DETAILS_VIEW, type))) {
addPropertyColumn(name, ReflectionUtils.findField(AnyObjectTO.class, name), columns);
}
columns.add(new AttrColumn<>("Service Location", SchemaType.PLAIN));
return columns;
} }
public static class Builder extends AnyObjectDirectoryPanel.Builder { public static class Builder extends AnyObjectDirectoryPanel.Builder {
......
...@@ -45,6 +45,12 @@ limitations under the License. ...@@ -45,6 +45,12 @@ limitations under the License.
<groupId>org.apache.syncope.client</groupId> <groupId>org.apache.syncope.client</groupId>
<artifactId>syncope-client-console</artifactId> <artifactId>syncope-client-console</artifactId>
</dependency> </dependency>
<dependency>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-client-console</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -15,11 +15,18 @@ ...@@ -15,11 +15,18 @@
*/ */
package org.apache.syncope.client.console.pages; package org.apache.syncope.client.console.pages;
import eu.chorevolution.idm.common.to.VirtualMachineInfoTO;
import java.io.Serializable;
import java.util.List;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder; import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.panels.VirtualMachinesDirectoryPanel;
import org.apache.syncope.client.console.rest.AnyObjectRestClient; import org.apache.syncope.client.console.rest.AnyObjectRestClient;
import org.apache.syncope.client.console.rest.ChoreographyRestClient;
import org.apache.syncope.client.console.widgets.ResourceWidget;
import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.request.mapper.parameter.PageParameters;
public class EnactmentEngineDetailPage extends BaseExtPage { public class EnactmentEngineDetailPage extends BaseExtPage {
...@@ -32,6 +39,8 @@ public class EnactmentEngineDetailPage extends BaseExtPage { ...@@ -32,6 +39,8 @@ public class EnactmentEngineDetailPage extends BaseExtPage {
private final AnyObjectTO enactmentEngine; private final AnyObjectTO enactmentEngine;
private final EEStatisticBundle bundle;
public EnactmentEngineDetailPage(final PageParameters parameters) { public EnactmentEngineDetailPage(final PageParameters parameters) {
super(parameters); super(parameters);
...@@ -40,6 +49,10 @@ public class EnactmentEngineDetailPage extends BaseExtPage { ...@@ -40,6 +49,10 @@ public class EnactmentEngineDetailPage extends BaseExtPage {
enactmentEngine = restClient.read(enactmentEngineKey); enactmentEngine = restClient.read(enactmentEngineKey);
ChoreographyRestClient choreographyRestClient = new ChoreographyRestClient();
this.bundle = new EEStatisticBundle(choreographyRestClient.getEEVmList(enactmentEngine.getKey()));
// Set page title // Set page title
body.add(new Label("header", getString("ee") + " " + enactmentEngine.getName())); body.add(new Label("header", getString("ee") + " " + enactmentEngine.getName()));
...@@ -51,9 +64,51 @@ public class EnactmentEngineDetailPage extends BaseExtPage { ...@@ -51,9 +64,51 @@ public class EnactmentEngineDetailPage extends BaseExtPage {
content.add(new Label("enactmentEngineDetailsPageContent", "PAGE CONTENT")); content.add(new Label("enactmentEngineDetailsPageContent", "PAGE CONTENT"));
content.setOutputMarkupId(true); content.setOutputMarkupId(true);
RepeatingView resourcesOverview = new RepeatingView("resourceWidget");
resourcesOverview.add(new ResourceWidget(
resourcesOverview.newChildId(),
"bg-yellow", bundle.virtualMachines, "Virtual Machines", "fa fa-cube"));
resourcesOverview.add(new ResourceWidget(
resourcesOverview.newChildId(), "bg-red", bundle.cpus, "CPU", "fa fa-cogs"));
resourcesOverview.add(new ResourceWidget(
resourcesOverview.newChildId(), "bg-green", bundle.ram, "RAM", "MB", ""));
resourcesOverview.add(new ResourceWidget(
resourcesOverview.newChildId(), "bg-aqua", bundle.storage, "Storage", "GB", "fa fa-database"));
content.add(resourcesOverview);
content.add(new VirtualMachinesDirectoryPanel("virtualMachinesList", getPageReference(), enactmentEngineKey));
// Re-enable when entilements for this service will be defined // Re-enable when entilements for this service will be defined
//MetaDataRoleAuthorizationStrategy.authorize(content, ENABLE, CamelEntitlement.ROUTE_LIST); //MetaDataRoleAuthorizationStrategy.authorize(content, ENABLE, CamelEntitlement.ROUTE_LIST);
body.add(content); body.add(content);
} }
private class EEStatisticBundle implements Serializable {
private static final long serialVersionUID = 8740173619471549262L;
private int virtualMachines;
private int cpus;
private int ram;
private int storage;
EEStatisticBundle(final List<VirtualMachineInfoTO> vms) {
this.virtualMachines = 0;
this.cpus = 0;
this.ram = 0;
this.storage = 0;
for (VirtualMachineInfoTO vm: vms) {
this.virtualMachines ++;
this.cpus += vm.getCpuNumber();
this.ram += vm.getRam();
this.storage += vm.getStorage();
}
}
}
} }
...@@ -22,17 +22,16 @@ import org.apache.syncope.client.console.commons.Constants; ...@@ -22,17 +22,16 @@ import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.EnactmentEngineDataProvider; import org.apache.syncope.client.console.commons.EnactmentEngineDataProvider;
import org.apache.syncope.client.console.pages.EnactmentEngineDetailPage; import org.apache.syncope.client.console.pages.EnactmentEngineDetailPage;
import org.apache.syncope.client.console.pages.EnactmentEnginePage; 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; import org.apache.syncope.common.lib.search.AnyObjectFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference; import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; 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.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.Item; import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel; import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel; import org.apache.wicket.model.ResourceModel;
...@@ -68,7 +67,19 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel { ...@@ -68,7 +67,19 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
addPropertyColumn(name, ReflectionUtils.findField(AnyObjectTO.class, name), columns); addPropertyColumn(name, ReflectionUtils.findField(AnyObjectTO.class, name), columns);
} }
columns.add(new AttrColumn<>("enactmentEngineBaseURL", SchemaType.PLAIN));
columns.add(new AbstractColumn<AnyObjectTO, String>(new ResourceModel("", "Base URL")) {
@Override
public void populateItem(
final Item<ICellPopulator<AnyObjectTO>> item,
final String componentId,
final IModel<AnyObjectTO> model) {
Label label = new Label(
componentId, model.getObject().getPlainAttrMap().get("enactmentEngineBaseURL")
.getValues().iterator().next());
item.add(label);
}
});
columns.add(new AbstractColumn<AnyObjectTO, String>(new ResourceModel("actions", "")) { columns.add(new AbstractColumn<AnyObjectTO, String>(new ResourceModel("actions", "")) {
......
...@@ -28,8 +28,12 @@ limitations under the License. ...@@ -28,8 +28,12 @@ limitations under the License.
</section> </section>
<section class="content" wicket:id="content"> <section class="content" wicket:id="content">
<div class="box"> <div class="box box-body">
<div class="box-body" wicket:id="enactmentEngineDetailsPageContent"/> <div class="row">
<span wicket:id="resourceWidget"/>
</div>
<h3><wicket:message key="virtualMachines"/></h3>
<div wicket:id="virtualMachinesList"/>
</div> </div>
</section> </section>
</wicket:extend> </wicket:extend>
......
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
# #
ee=Enactment Engine ee=Enactment Engine
enactmentEngines=Enactment Engines enactmentEngines=Enactment Engines
virtualMachines=Virtual Machines
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
# #
ee=Enactment Engine ee=Enactment Engine
enactmentEngines=Enactment Engines enactmentEngines=Enactment Engines
virtualMachines=Macchine Virtuali
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
# #
ee=Enactment Engine ee=Enactment Engine
enactmentEngines=Enactment Engines enactmentEngines=Enactment Engines
virtualMachines=M\u00e1quinas virtuais
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