-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add job start and duration time to job page #458
Changes from 2 commits
3a508f8
ffc15f7
f9aa42b
7ade9ef
ca20269
5cd73d9
254e43c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
export interface RunInfo { | ||
id: string; | ||
displayName: string; | ||
duration: string; | ||
result: string; | ||
startTime: string; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
package io.jenkins.plugins.pipelinegraphview.multipipelinegraphview; | ||
|
||
import hudson.Util; | ||
import hudson.model.Result; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.Locale; | ||
import java.util.TimeZone; | ||
import org.jenkinsci.plugins.workflow.job.WorkflowRun; | ||
|
||
public class PipelineRun { | ||
|
||
private String id; | ||
private String displayName; | ||
private final String id; | ||
private final String displayName; | ||
private final String duration; | ||
private final String result; | ||
private final String startTime; | ||
|
||
public PipelineRun(WorkflowRun run) { | ||
this.id = run.getId(); | ||
this.displayName = run.getDisplayName(); | ||
this.duration = Util.getTimeSpanString(run.getDuration()); | ||
|
||
Result buildResult = run.getResult(); | ||
this.result = (buildResult != null) ? buildResult.toString() : "IN_PROGRESS"; | ||
|
||
SimpleDateFormat sdf = new SimpleDateFormat("d MMM, hh:mm", Locale.getDefault()); | ||
// TODO support user timezones from UserProperty | ||
sdf.setTimeZone(TimeZone.getDefault()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Users are able to set their own timezone in their user configuration, it would be good to support this, and also the Jenkins timezone property won't be supported by this core Java feature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed I would have much rather passed epoch into |
||
// TODO display full duration on hover but continue shortened for display | ||
this.startTime = sdf.format(new Date(run.getStartTimeInMillis())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there was too much info there before, I've shortened it but it would be good to show the full version on hover (ideally client side formatted I just didn't have much time) |
||
} | ||
|
||
public String getId() { | ||
|
@@ -19,4 +38,16 @@ | |
public String getDisplayName() { | ||
return displayName; | ||
} | ||
|
||
public String getDuration() { | ||
return duration; | ||
} | ||
|
||
public String getResult() { | ||
return result; | ||
} | ||
|
||
public String getStartTime() { | ||
return startTime; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to move this out to its own 'chip' but I wasn't able to make it work in the 10mins or so I had (the display flex column wants each on their own line)
this is probably ok though