borgbutler-core/src/main/java/de/micromata/borgbutler/BorgJob.java
@@ -130,6 +130,9 @@ if (progressInfo != null) { clone.setProgressInfo(progressInfo.clone()); } clone.setCreateTime(getCreateTime()); clone.setStartTime(getStartTime()); clone.setStopTime(getStopTime()); return clone; } borgbutler-core/src/main/java/de/micromata/borgbutler/jobs/AbstractJob.java
@@ -1,11 +1,13 @@ package de.micromata.borgbutler.jobs; import de.micromata.borgbutler.utils.DateUtils; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.time.LocalDateTime; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -18,7 +20,6 @@ @Setter private boolean cancellationRequested; @Getter @Setter(AccessLevel.PROTECTED) private Status status; @Getter @Setter @@ -29,17 +30,36 @@ @Getter @Setter(AccessLevel.PROTECTED) private long uniqueJobNumber = -1; @Getter @Setter private String createTime; @Getter @Setter private String startTime; @Getter @Setter private String stopTime; protected AbstractJob<T> setStatus(Status status) { if (status == Status.RUNNING && this.status != Status.RUNNING) { this.startTime = DateUtils.format(LocalDateTime.now()); } else if (status != Status.RUNNING && this.status == Status.RUNNING) { this.stopTime = DateUtils.format(LocalDateTime.now()); } this.status = status; return this; } public void cancel() { if (this.getStatus() == Status.QUEUED) { this.status = Status.CANCELLED; setStatus(Status.CANCELLED); } this.cancellationRequested = true; cancelRunningProcess(); } protected void setCancelled() { this.status = Status.CANCELLED; setStatus(Status.CANCELLED); } /** @@ -74,7 +94,7 @@ if (this.status != Status.RUNNING) { logger.error("Internal error, illegal state! You shouldn't set the job status to FAILED if not in status RUNNING: " + this.status); } this.status = Status.FAILED; setStatus(Status.FAILED); } /** @@ -96,4 +116,8 @@ * @return */ public abstract Object getId(); protected AbstractJob() { this.createTime = DateUtils.format(LocalDateTime.now()); } } borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/queue/JsonJob.java
@@ -38,6 +38,15 @@ @Getter @Setter private String[] environmentVariables; @Getter @Setter private String createTime; @Getter @Setter private String startTime; @Getter @Setter private String stopTime; public JsonJob() { } @@ -55,6 +64,9 @@ this.commandLineAsString = borgJob.getCommandLineAsString(); this.description = borgJob.getDescription(); environmentVariables = borgJob.getCommand().getRepoConfig().getEnvironmentVariables(); this.createTime = borgJob.getCreateTime(); this.startTime = borgJob.getStartTime(); this.stopTime = borgJob.getStopTime(); } /** borgbutler-webapp/src/components/views/jobs/Job.jsx
@@ -40,6 +40,14 @@ let content = undefined; let job = this.props.job; let cancelDisabled = undefined; let times = ' (created: ' + job.createTime; if (job.startTime) { times += ', started: ' + job.startTime; } if (job.stopTime) { times += ', stopped: ' + job.stopTime; } times += ')'; if ((job.status !== 'RUNNING' && job.status !== 'QUEUED') || job.cancellationRequested) { cancelDisabled = true; } @@ -89,7 +97,7 @@ <tbody> <tr> <th>Status</th> <td>{job.status}</td> <td>{job.status} {times}</td> </tr> <tr> <th>Command line</th>