Skip to content
Permalink
Browse files
[JENKINS-28881] - Display Ownership summary boxes for Folders
  • Loading branch information
oleg-nenashev committed Jan 5, 2016
1 parent cd1568f commit f5357c99c4f98e553d63d9f98b920cf833abbd76
Showing 2 changed files with 40 additions and 0 deletions.
@@ -30,7 +30,9 @@
import com.synopsys.arc.jenkins.plugins.ownership.OwnershipDescription;
import com.synopsys.arc.jenkins.plugins.ownership.OwnershipPlugin;
import com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerHelper;
import com.synopsys.arc.jenkins.plugins.ownership.util.ui.OwnershipLayoutFormatter;
import hudson.model.Descriptor;
import hudson.model.Job;
import hudson.security.Permission;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -49,6 +51,10 @@
*/
public class FolderOwnershipAction extends ItemOwnershipAction<AbstractFolder<?>> {

//TODO: May become a problem once we need to make it flexible (not implemented). Move to helper?
private static final OwnershipLayoutFormatter<AbstractFolder<?>> DEFAULT_FOLDER_FORMATTER
= new OwnershipLayoutFormatter.DefaultJobFormatter<AbstractFolder<?>>();

public FolderOwnershipAction(@Nonnull Folder folder) {
super(folder);
}
@@ -73,6 +79,10 @@ public IOwnershipHelper<AbstractFolder<?>> helper() {
return FolderOwnershipHelper.getInstance();
}

public OwnershipLayoutFormatter<AbstractFolder<?>> getLayoutFormatter() {
return DEFAULT_FOLDER_FORMATTER;
}

public HttpResponse doOwnersSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, UnsupportedEncodingException, ServletException, Descriptor.FormException {
getDescribedItem().checkPermission(OwnershipPlugin.MANAGE_ITEMS_OWNERSHIP);

@@ -0,0 +1,30 @@
<!--
* The MIT License
*
* Copyright 2016 Oleg Nenashev
*
* 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.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:set var="item" value="${it.getDescribedItem()}"/>
<j:set var="helper" value="${it.helper()}"/>
<j:set var="itemType" value="Folder"/>
<st:include page="floatingBoxTemplate.jelly" class="com.synopsys.arc.jenkins.plugins.ownership.OwnershipPlugin" optional="false"/>
</j:jelly>

0 comments on commit f5357c9

Please sign in to comment.