Skip to content

Commit

Permalink
0005876: Added job history dialog to Manage Jobs screen
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-miller-jumpmind committed Jun 16, 2023
1 parent 53e3d70 commit 3315e15
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
Expand Up @@ -125,6 +125,8 @@ public void addRouterStats(long startDataId, long endDataId, long dataReadCount,

public Map<String, ChannelStats> getWorkingChannelStats();

public List<JobStats> getWorkingJobStats();

public HostStats getWorkingHostStats();

public TreeMap<Date, Map<String, ChannelStats>> getNodeStatsForPeriod(Date start, Date end, String nodeId, int periodSizeInMinutes);
Expand Down
Expand Up @@ -59,6 +59,16 @@ public JobStats(String jobName, long startTime, long endTime, long processedCoun
this.errorMessage = e.getClass().getName() + ": " + e.getMessage() + "\r\n" + AppUtils.formatStackTrace(e.getStackTrace(), 50, false);
}

public JobStats(JobStats source) {
super(source.getNodeId(), source.getHostName(), source.getStartTime(), source.getEndTime());
this.jobName = source.getJobName();
this.processedCount = source.getProcessedCount();
this.targetNodeId = source.getTargetNodeId();
this.targetNodeCount = source.getTargetNodeCount();
this.errorFlag = source.isErrorFlag();
this.errorMessage = source.getErrorMessage();
}

public String getJobName() {
return jobName;
}
Expand Down
@@ -0,0 +1,22 @@
package org.jumpmind.symmetric.statistic;

import java.util.Date;
import java.util.List;

public class JobStatsByPeriodMap extends AbstractStatsByPeriodMap<JobStats, JobStats> {
private static final long serialVersionUID = 1L;

public JobStatsByPeriodMap(Date start, Date end, List<JobStats> list, int periodSizeInMinutes) {
super(start, end, list, periodSizeInMinutes);
}

@Override
protected void add(Date periodStart, JobStats stat) {
put(periodStart, stat);
}

@Override
protected void addBlank(Date periodStart) {
put(periodStart, new JobStats());
}
}
Expand Up @@ -599,6 +599,17 @@ public Map<String, ChannelStats> getWorkingChannelStats() {
}
}

public List<JobStats> getWorkingJobStats() {
if (jobStats != null) {
List<JobStats> stats = new ArrayList<JobStats>();
for (JobStats stat : jobStats) {
stats.add(new JobStats(stat));
}
return stats;
}
return new ArrayList<JobStats>();
}

public HostStats getWorkingHostStats() {
if (this.hostStats != null) {
return new HostStats(this.hostStats);
Expand Down
Expand Up @@ -34,6 +34,8 @@
import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.icon.Icon;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;

Expand All @@ -53,6 +55,10 @@ public ResizableDialog(String caption) {
}

public ResizableDialog(String caption, boolean addEscapeShortcut) {
this(caption, addEscapeShortcut, false);
}

public ResizableDialog(String caption, boolean addEscapeShortcut, boolean addCloseIcon) {
setModal(true);
setResizable(true);
VerticalLayout content = new VerticalLayout();
Expand All @@ -63,7 +69,20 @@ public ResizableDialog(String caption, boolean addEscapeShortcut) {
captionLabel = new Label(caption + "<hr>");
captionLabel.setWidthFull();
captionLabel.getStyle().set("margin", null);
content.add(captionLabel);
if (addCloseIcon) {
HorizontalLayout captionLayout = new HorizontalLayout(captionLabel, buildCloseIcon());
captionLayout.setWidthFull();
captionLayout.expand(captionLabel);
content.add(captionLayout);
} else {
content.add(captionLabel);
}
} else if (addCloseIcon) {
HorizontalLayout closeIconLayout = new HorizontalLayout();
closeIconLayout.setWidthFull();
closeIconLayout.addAndExpand(new Span());
closeIconLayout.add(buildCloseIcon());
content.add(closeIconLayout);
}
innerContent = new VerticalLayout();
innerContent.setWidthFull();
Expand Down Expand Up @@ -99,6 +118,15 @@ protected void addComponents(Component... components) {
}
}

protected Icon buildCloseIcon() {
Icon closeIcon = new Icon(VaadinIcon.CLOSE);
closeIcon.setSize("36px");
closeIcon.getStyle().set("min-width", "36px");
closeIcon.setClassName("mouse_pointer");
closeIcon.addClickListener(event -> close());
return closeIcon;
}

protected Button buildCloseButton() {
Button closeButton = new Button("Close");
closeButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
Expand Down

0 comments on commit 3315e15

Please sign in to comment.