Skip to content
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

Support for Item categorization in Jenkins 2 #9

Merged
merged 4 commits into from Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,5 @@ work
/.project
/.settings
/.classpath
external-monitor-job.iml
.idea
33 changes: 33 additions & 0 deletions src/main/java/hudson/model/ExternalJob.java
Expand Up @@ -122,6 +122,39 @@ public String getDisplayName() {
return Messages.ExternalJob_displayName();
}

/**
* Needed if it wants External Monitor Jobs are categorized in Jenkins 2.x.
*
* TODO: Override when the baseline is upgraded to 2.x
*
* @return A string it represents a ItemCategory identifier.
*/
public String getCategoryId() {
return "standaloneprojects";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is this string and not any other should be documented somewhere IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect it to be available via Enum or a static variable from the Jenkins core 2.0. IMHO there should be a TODO for it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amuniz @oleg-nenashev

When this plugin upgrades his baseline, he will able to use something like that: StandaloneProjectsCategory.ID. By now, if we want that these plugins use ItemCategorization feature (provided by Jenkins 2.0) and additionally are compatible with Jenkins 1.x, this was the best option.

}

/**
* Needed if it wants External Monitor Jobs are categorized in Jenkins 2.x.
*
* TODO: Override when the baseline is upgraded to 2.x
*
* @return A string with the Item description.
*/
public String getDescription() {
return Messages.ExternalJob_Description();
}

/**
* Needed if it wants External Monitor Jobs are categorized in Jenkins 2.x.
*
* TODO: Override when the baseline is upgraded to 2.x
*
* @return A string it represents a URL pattern to get the Item icon in different sizes.
*/
public String getIconFilePathPattern() {
return "plugin/external-monitor-job/images/:size/externaljob.png";
}

public ExternalJob newInstance(ItemGroup parent, String name) {
return new ExternalJob(parent,name);
}
Expand Down
Expand Up @@ -23,6 +23,8 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<div>
${%body}
</div>
<j:out value="${it.description}"/>
</div>
</j:jelly>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.