forked from jenkinsci/jenkins
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Init #192
Draft
timja
wants to merge
20
commits into
master
Choose a base branch
from
experimental-details-widget
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Init #192
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1c71f4c
Init
janfaracik 991f787
Update DurationDetail.java
janfaracik f4f8ec9
Sorting out stuff
janfaracik 701e7a7
Update Functions.java
janfaracik 959a43b
Use passed in run
janfaracik 4deafbd
Cleanup
janfaracik 1a7bd33
Update DetailFactory.java
janfaracik abf4d00
Update Functions.java
janfaracik 73a48c0
Make group of() private
janfaracik 5d13a62
Update DetailGroup.java
janfaracik 0da339b
Tidy up
janfaracik 8886cd9
Push
janfaracik 6fd6b1b
Update Detail.java
janfaracik 8cdc3a6
Update Functions.java
janfaracik 538ba93
Update DetailFactory.java
janfaracik c1cbb0d
Update DetailFactory.java
janfaracik cac4625
Update DetailGroup.java
janfaracik c649255
Add isApplicable
janfaracik b4b01ee
Update DetailGroup.java
janfaracik 64babad
Update grid
janfaracik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
core/src/main/java/hudson/model/details/DurationDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package hudson.model.details; | ||
|
||
import hudson.model.Run; | ||
import jenkins.model.Detail; | ||
|
||
/** | ||
* Displays the duration of the given run, or, if the run has completed, shows the total time it took to execute | ||
* @implNote This will render Jelly, hence the fields return null | ||
*/ | ||
public class DurationDetail extends Detail { | ||
|
||
public DurationDetail(Run<?, ?> run) { | ||
super(run); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
core/src/main/java/hudson/model/details/TimestampDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package hudson.model.details; | ||
|
||
import hudson.model.Run; | ||
import jenkins.model.Detail; | ||
|
||
/** | ||
* Displays the start time of the given run | ||
* @implNote This will render Jelly, hence the fields return null | ||
*/ | ||
public class TimestampDetail extends Detail { | ||
|
||
public TimestampDetail(Run<?, ?> run) { | ||
super(run); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package jenkins.model; | ||
|
||
import edu.umd.cs.findbugs.annotations.Nullable; | ||
import hudson.model.Actionable; | ||
import hudson.model.ModelObject; | ||
import hudson.model.Run; | ||
import org.jenkins.ui.icon.IconSpec; | ||
|
||
/** | ||
* {@link Detail} represents a piece of information about a {@link Run}. | ||
* Such information could include: | ||
* <ul> | ||
* <li>the date and time the run started</li> | ||
* <li>the amount of time the run took to complete</li> | ||
* <li>SCM information for the build</li> | ||
* <li>who kicked the build off</li> | ||
* </ul> | ||
* @since TODO | ||
*/ | ||
public abstract class Detail implements ModelObject, IconSpec { | ||
|
||
private final Actionable object; | ||
|
||
public Detail(Actionable object) { | ||
this.object = object; | ||
} | ||
|
||
public Actionable getObject() { | ||
return object; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public @Nullable String getIconClassName() { | ||
return null; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public @Nullable String getDisplayName() { | ||
return null; | ||
} | ||
|
||
/** | ||
* Returns true if this detail is applicable to the given Actionable object | ||
*/ | ||
public boolean isApplicable() { | ||
return true; | ||
} | ||
|
||
/** | ||
* @return the grouping of the detail | ||
*/ | ||
public DetailGroup getGroup() { | ||
return DetailGroup.GENERAL; | ||
} | ||
|
||
/** | ||
* @return order in the group, zero is first, MAX_VALUE is any order | ||
*/ | ||
public int getOrder() { | ||
return Integer.MAX_VALUE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2025 Jan Faracik | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package jenkins.model; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import hudson.ExtensionList; | ||
import hudson.ExtensionPoint; | ||
import hudson.model.Actionable; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
|
||
/** | ||
* Allows you to add multiple details to an Actionable object at once. | ||
* @param <T> the type of object to add to; typically an {@link Actionable} subtype | ||
* @since TODO | ||
*/ | ||
public abstract class DetailFactory<T extends Actionable> implements ExtensionPoint { | ||
|
||
public abstract Class<T> type(); | ||
|
||
public abstract @NonNull Collection<? extends Detail> createFor(@NonNull T target); | ||
|
||
@Restricted(NoExternalUse.class) | ||
public static <T extends Actionable> Iterable<DetailFactory<T>> factoriesFor(Class<T> type) { | ||
List<DetailFactory<T>> result = new ArrayList<>(); | ||
for (DetailFactory<T> wf : ExtensionList.lookup(DetailFactory.class)) { | ||
if (wf.type().isAssignableFrom(type)) { | ||
result.add(wf); | ||
} | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package jenkins.model; | ||
|
||
/** | ||
* Represents a group for categorizing {@link Detail}, each with an associated order. | ||
*/ | ||
public class DetailGroup { | ||
|
||
private final int order; | ||
|
||
private DetailGroup(int order) { | ||
if (order < 0) { | ||
throw new RuntimeException("Orders cannot be less than 0"); | ||
} | ||
|
||
this.order = order; | ||
} | ||
|
||
public static DetailGroup SCM = new DetailGroup(0); | ||
|
||
public static DetailGroup GENERAL = new DetailGroup(Integer.MAX_VALUE); | ||
|
||
public int getOrder() { | ||
return order; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
not sure if this is needed, no null fields anymore
maybe