Commit 7fb4ffd1 authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Fixed error in instances tab of new choreographies

parent 8936b9db
......@@ -21,6 +21,7 @@ import org.apache.syncope.client.console.rest.MonitorRestClient;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
......@@ -29,34 +30,64 @@ public class InstancesOverviewPanel extends Panel {
private static final long serialVersionUID = -5092782537953795789L;
private final MonitorRestClient restClient;
public InstancesOverviewPanel(final String id,
final PageReference pageReference,
final ChoreographyTO choreography) {
super(id);
this.restClient = new MonitorRestClient();
MonitorRestClient restClient = new MonitorRestClient();
Boolean availableInstances = false;
if (choreography.getChoreographyId() != null) {
availableInstances = !restClient.instanceList(choreography.getChoreographyId()).isEmpty();
}
if (availableInstances) {
WebMarkupContainer container = new WebMarkupContainer("container");
add(container);
container.add(new InstanceDirectoryPanel("instances", pageReference, choreography.getChoreographyId()));
Double averageInstanceExecutionTime
= restClient.getAverageInstanceExecutionTime(choreography.getChoreographyId());
container.add(new Label(
"avg_instances", getString("average") + ": " + averageInstanceExecutionTime + " ms"));
ChoreographyActionsPanel averageDetailsLink = new ChoreographyActionsPanel("avg_details");
averageDetailsLink.addAction(new IndicatingAjaxLink<Void>("link") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget request) {
PageParameters parameters = new PageParameters();
parameters.add("chorId", choreography.getChoreographyId());
setResponsePage(AVGInstanceStatsPage.class, parameters);
}
}, ChoreographyActionsPanel.ChoreographyActionType.SHOW);
container.add(averageDetailsLink);
add(new WebMarkupContainer("message") {
add(new InstanceDirectoryPanel("instances", pageReference, choreography.getChoreographyId()));
private static final long serialVersionUID = 9169935715713553356L;
Double averageInstanceExecutionTime
= restClient.getAverageInstanceExecutionTime(choreography.getChoreographyId());
add(new Label("avg_instances", getString("average") + ": " + averageInstanceExecutionTime + " ms"));
@Override
public boolean isVisible() {
return false;
}
});
ChoreographyActionsPanel averageDetailsLink = new ChoreographyActionsPanel("avg_details");
averageDetailsLink.addAction(new IndicatingAjaxLink<Void>("link") {
} else {
add(new WebMarkupContainer("container") {
private static final long serialVersionUID = -7978723352517770644L;
private static final long serialVersionUID = 9169935715713553356L;
@Override
public void onClick(final AjaxRequestTarget request) {
PageParameters parameters = new PageParameters();
parameters.add("chorId", choreography.getChoreographyId());
setResponsePage(AVGInstanceStatsPage.class, parameters);
}
}, ChoreographyActionsPanel.ChoreographyActionType.SHOW);
super.add(averageDetailsLink);
@Override
public boolean isVisible() {
return false;
}
});
add(new WebMarkupContainer("message"));
}
}
}
......@@ -16,10 +16,15 @@ limitations under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="instances"/>
<h4>
<span wicket:id="avg_instances"></span>
<span wicket:id="avg_details"></span>
</h4>
<div wicket:id="container">
<div wicket:id="instances"/>
<h4>
<span wicket:id="avg_instances"></span>
<span wicket:id="avg_details"></span>
</h4>
</div>
<div wicket:id="message">
<label><wicket:message key="no_instances"/></label>
</div>
</wicket:panel>
</html>
\ No newline at end of file
......@@ -14,3 +14,4 @@
# limitations under the License.
#
average=Average overall execution time
no_instances=There are no available instances
......@@ -14,3 +14,4 @@
# limitations under the License.
#
average=Tempo di esecuzione medio
no_instances=Non ci sono istanze disponibili
......@@ -14,3 +14,4 @@
# limitations under the License.
#
average=Tempo medio de execu\u00e7ao
no_instances=N\u00e3o existem inst\u00e2ncias dispon\u00edveis
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