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

Added skeleton for REST service implementation and page for choreography instances

parent 5b7a576e
......@@ -29,9 +29,9 @@ public class InstancePage extends AbstractExtPage {
public InstancePage(final PageParameters parameters) {
super(parameters);
String choreographyStringId = parameters.get("chor").toString();
long choreographyId = Long.parseLong(choreographyStringId);
body.add(new Label("header", getString("header_title") + " of Choreography " + choreographyStringId));
long choreographyId = parameters.get("chor").toLong();
String choreographyName = parameters.get("name").toString();
body.add(new Label("header", getString("header_title") + " of Choreography " + choreographyName));
WebMarkupContainer content = new WebMarkupContainer("content");
content.setOutputMarkupId(true);
......
/*
* 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 com.pingunaut.wicket.chartjs.chart.impl.Bar;
import com.pingunaut.wicket.chartjs.chart.impl.Doughnut;
import com.pingunaut.wicket.chartjs.core.panel.BarChartPanel;
import com.pingunaut.wicket.chartjs.core.panel.DoughnutChartPanel;
import com.pingunaut.wicket.chartjs.data.sets.BarDataSet;
import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.client.console.widget.StatsWidget;
import org.apache.syncope.client.console.widgets.LabeledDoughnutChartData;
//import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
public class InstanceStatsPage extends AbstractExtPage {
private static final long serialVersionUID = 3932245590233237182L;
public static final String PREF_STATS_PAGINATOR_ROWS = "stats.paginator.rows";
public InstanceStatsPage(final PageParameters parameters) {
super(parameters);
String instanceId = parameters.get("instance").toString();
String instanceName = parameters.get("name").toString();
body.add(new Label("header", getString("header_title") + " " + instanceName));
//WebMarkupContainer content = new WebMarkupContainer("content");
//content.setOutputMarkupId(true);
RepeatingView chartList = new RepeatingView("stats");
//Total overhead and total execution time per CD (+ mean)
chartList.add(new StatsWidget(chartList.newChildId()) {
@Override
public void create() {
List<String> labels = new ArrayList<>();
labels.add("CD 1");
labels.add("CD 2");
labels.add("CD 3");
labels.add("CD 4");
labels.add("CD 5");
labels.add("Mean");
List<Double> overheads = new ArrayList<>();
overheads.add(12d);
overheads.add(10d);
overheads.add(5d);
overheads.add(9d);
overheads.add(14d);
overheads.add(10d);
List<Double> execTimes = new ArrayList<>();
execTimes.add(20d);
execTimes.add(15d);
execTimes.add(19d);
execTimes.add(11d);
execTimes.add(20d);
execTimes.add(16d);
Bar bar = new Bar();
bar.getData().getLabels().addAll(labels);
BarDataSet overheadDataSet = new BarDataSet(overheads);
overheadDataSet.setFillColor("rgba(151,187,205,0.5)");
overheadDataSet.setStrokeColor("rgba(151,187,205,0.8)");
bar.getData().getDatasets().add(overheadDataSet);
bar.getData().getDatasets().add(new BarDataSet(execTimes));
add(new BarChartPanel("chart", Model.of(bar)));
add(new Label("title", getString("cd_overhead_title")));
}
});
//Operations executed and sent messages per CD
chartList.add(new StatsWidget(chartList.newChildId()) {
@Override
public void create() {
List<String> labels = new ArrayList<>();
labels.add("CD 1");
labels.add("CD 2");
labels.add("CD 3");
labels.add("CD 4");
labels.add("CD 5");
List<Double> operations = new ArrayList<>();
operations.add(2d);
operations.add(4d);
operations.add(1d);
operations.add(6d);
operations.add(1d);
List<Double> messages = new ArrayList<>();
messages.add(10d);
messages.add(7d);
messages.add(4d);
messages.add(13d);
messages.add(2d);
Bar bar = new Bar();
bar.getData().getLabels().addAll(labels);
BarDataSet operationsDataSet = new BarDataSet(operations);
operationsDataSet.setFillColor("rgba(151,187,205,0.5)");
operationsDataSet.setStrokeColor("rgba(151,187,205,0.8)");
bar.getData().getDatasets().add(operationsDataSet);
bar.getData().getDatasets().add(new BarDataSet(messages));
add(new BarChartPanel("chart", Model.of(bar)));
add(new Label("title", getString("cd_operations_title")));
}
});
//Total task execution time and total overhead
chartList.add(new StatsWidget(chartList.newChildId()) {
@Override
public void create() {
Doughnut doughnut = new Doughnut();
doughnut.getOptions().setResponsive(true);
doughnut.getOptions().setMaintainAspectRatio(true);
doughnut.getOptions().setTooltipTemplate("<%= label %>");
int totalExecution = 80;
int overhead = 50;
int execution = totalExecution - overhead;
doughnut.getData().add(
new LabeledDoughnutChartData(
execution, "FDB45C", getString("computation_time") + ": " + execution
));
doughnut.getData().add(
new LabeledDoughnutChartData(
overhead, "#F7464A", getString("overhead") + ": " + overhead
));
add(new DoughnutChartPanel("chart", Model.of(doughnut)));
add(new Label("title", getString("overhead_title")));
}
});
//Total executed operations and sent messages
chartList.add(new StatsWidget(chartList.newChildId()) {
@Override
public void create() {
Doughnut doughnut = new Doughnut();
doughnut.getOptions().setResponsive(true);
doughnut.getOptions().setMaintainAspectRatio(true);
doughnut.getOptions().setTooltipTemplate("<%= label %>");
int messages = 5;
int operations = 7;
doughnut.getData().add(
new LabeledDoughnutChartData(
messages, "FDB45C", getString("sent_messages") + ": " + messages
));
doughnut.getData().add(
new LabeledDoughnutChartData(
operations, "#F7464A", getString("executed_operations") + ": " + operations
));
add(new DoughnutChartPanel("chart", Model.of(doughnut)));
add(new Label("title", getString("message_op_title")));
}
});
body.add(chartList);
// Re-enable when entilements for this service will be defined
//MetaDataRoleAuthorizationStrategy.authorize(content, ENABLE, CamelEntitlement.ROUTE_LIST);
//body.add(content);
}
}
......@@ -118,6 +118,7 @@ public class ChoreographyPanel extends AbstractSearchResultPanel<
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
PageParameters param = new PageParameters();
param.add("chor", model.getObject().getKey());
param.add("name", model.getObject().getName());
setResponsePage(InstancePage.class, param);
}
}, ActionLink.ActionType.SEARCH);
......@@ -129,6 +130,14 @@ public class ChoreographyPanel extends AbstractSearchResultPanel<
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
}
}, ActionLink.ActionType.EDIT);
actionLinks.add(new ActionLink<Serializable>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
}
}, ActionLink.ActionType.EXECUTE);
item.add(actionLinks.build(componentId));
}
});
......
......@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.syncope.client.console.commons.SearchableDataProvider;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
import org.apache.syncope.client.console.pages.InstancePage;
import org.apache.syncope.client.console.pages.InstanceStatsPage;
import org.apache.syncope.client.console.panels.InstancePanel.InstanceProvider;
import org.apache.syncope.client.console.rest.ChoreographyRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
......@@ -41,6 +42,7 @@ import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
public class InstancePanel extends AbstractSearchResultPanel<
ChoreographyInstanceTO, ChoreographyInstanceTO, InstanceProvider, ChoreographyRestClient> {
......@@ -95,7 +97,7 @@ public class InstancePanel extends AbstractSearchResultPanel<
protected List<IColumn<ChoreographyInstanceTO, String>> getColumns() {
final List<IColumn<ChoreographyInstanceTO, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(new ResourceModel("key"), "key", "key"));
columns.add(new PropertyColumn<>(new ResourceModel("choreographyKey", "Choreography Id"), "choreographyKey"));
// columns.add(new PropertyColumn<>(new ResourceModel("choreographyKey", "Choreography Id"), "choreographyKey"));
columns.add(new PropertyColumn<>(new ResourceModel("name"), "name", "name"));
columns.add(new PropertyColumn<>(new ResourceModel("description"), "description", "description"));
columns.add(new AbstractColumn<ChoreographyInstanceTO, String>(new ResourceModel("actions", "")) {
......@@ -116,6 +118,18 @@ public class InstancePanel extends AbstractSearchResultPanel<
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
PageParameters param = new PageParameters();
param.add("instance", model.getObject().getKey());
param.add("name", model.getObject().getName());
setResponsePage(InstanceStatsPage.class, param);
}
}, ActionLink.ActionType.SEARCH);
actionLinks.add(new ActionLink<Serializable>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
}
......
/*
* 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.widget;
import org.apache.syncope.client.console.widgets.AbstractWidget;
public abstract class StatsWidget extends AbstractWidget {
public StatsWidget(final String id) {
super(id);
create();
}
public abstract void create();
}
<!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>
</section>
<section class="content">
<div class="row">
<div class="col-md-6" wicket:id="stats"/>
</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.
#
header_title=Stats for
description=Description
#
# 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.
#
header_title=Statistiche per
description=Descrizione
#
# 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.
#
header_title=Estatistica para
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>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title" wicket:id="title"></h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<div class="box-body">
<div class="chart" wicket:id="chart"/>
</div>
</div>
</wicket:panel>
</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.
#
title=Chart title
message_op_title=Executed operations & sent messages
executed_operations=Exectued operations
sent_messages=Sent messages
cd_overhead_title=Mean overhead & execution time per CD (in ms)
overhead_title=Total overhead & execution time (in ms)
cd_operations_title=Operations executed & sent messages per CD
execution_time=Execution time
overhead=Overhead
computation_time=Computation time
#
# 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.
#
title=Titolo del grafico
message_op_title=Operazioni eseguite e messaggi inviati
executed_operations=Operazioni eseguite
sent_messages=Messaggi inviati
cd_overhead_title=Overhead e tempo d'esecuzione medi per CD (in ms)
overhead_title=Overhead e tempo di esecuzione totali (in ms)
cd_operations_title=Operazioni eseguite e messaggi scambiati per CD
execution_time=Tempo di esecuzione
overhead=Overhead
computation_time=Tempo di esecuzione
#
# 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.
#
title=T\u00edtulo do gr\u00e1fico
message_op_title=Opera\u00e7\u00f5es executadas e mensagens enviadas
executed_operations=Opera\u00e7\u00f5es executadas
sent_messages=Mensagens enviadas
cd_overhead_title=Overhead e vesez de execu\u00e7\u00e3o m\u00e9dia para CD (em ms)
overhead_title=Overhead e vesez de execu\u00e7\u00e3o total (in ms)
cd_operations_title=Opera\u00e7\u00f5es executadas e mensagens enviadas para CD
execution_time=Vesez de execu\u00e7\u00e3o
overhead=Overhead
computation_time=Vesez de execu\u00e7\u00e3o
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.chorevolution.idm.ext</groupId>
<artifactId>syncope-ext-choreography</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<name>CHOReVOLUTION IdM Extensions: Choreography Common Lib</name>
<description>CHOReVOLUTION IdM Extensions: Choreography Common Lib</description>
<groupId>eu.chorevolution.idm.ext.choreography</groupId>
<artifactId>syncope-ext-choreography-common-lib</artifactId>
<packaging>jar</packaging>
<properties>
<rootpom.basedir>${basedir}/../../..</rootpom.basedir>
</properties>
<dependencies>
<dependency>
<groupId>eu.chorevolution.idm</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
/*
* 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.