Skip to content

Commit

Permalink
Merge pull request #28 from oleg-nenashev/docker-icons
Browse files Browse the repository at this point in the history
[FIXED JENKINS-28776] Add docker icons for actions.
  • Loading branch information
oleg-nenashev committed Feb 8, 2016
2 parents e53ebf8 + d5f4d00 commit fb6296a
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -61,6 +61,11 @@
<version>1.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.icon-shim</groupId>
<artifactId>icon-shim</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
Expand Down
@@ -0,0 +1,49 @@
/*
* The MIT License
*
* Copyright (c) 2015 CloudBees, Inc.
*
* 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 org.jenkinsci.plugins.docker.commons;

import hudson.Plugin;
import org.jenkins.ui.icon.Icon;
import org.jenkins.ui.icon.IconSet;
import org.jenkins.ui.icon.IconType;

/**
* Plugin class for Docker commons plugin.
* @author Oleg Nenashev
*/
public class DockerCommonsPlugin extends Plugin {

@Override
public void start() throws Exception {
super.start();
registerIcons();
}

private void registerIcons() {
IconSet.icons.addIcon(new Icon("icon-docker-logo icon-sm", "docker-commons/images/16x16/docker.png", Icon.ICON_SMALL_STYLE, IconType.PLUGIN));
IconSet.icons.addIcon(new Icon("icon-docker-logo icon-md", "docker-commons/images/24x24/docker.png", Icon.ICON_MEDIUM_STYLE, IconType.PLUGIN));
IconSet.icons.addIcon(new Icon("icon-docker-logo icon-lg", "docker-commons/images/32x32/docker.png", Icon.ICON_LARGE_STYLE, IconType.PLUGIN));
IconSet.icons.addIcon(new Icon("icon-docker-logo icon-xlg", "docker-commons/images/48x48/docker.png", Icon.ICON_XLARGE_STYLE, IconType.PLUGIN));
}
}
Expand Up @@ -45,7 +45,7 @@
*
* @author Oleg Nenashev
*/
public class DockerFingerprintAction implements RunAction2 {
public class DockerFingerprintAction implements RunAction2, org.jenkins.ui.icon.IconSpec {

private final Set<String> imageIDs;
transient Run<?, ?> run;
Expand All @@ -70,7 +70,7 @@ public void onLoad(Run<?, ?> r) {

@Override
public String getIconFileName() {
return "fingerprint.png";
return "/plugin/docker-commons/images/24x24/docker.png";
}

@Override
Expand Down Expand Up @@ -146,4 +146,8 @@ static void addToRun(Fingerprint fp, String imageId, Run run) throws IOException
} // else no need to save updates
}
}

public String getIconClassName() {
return "icon-docker-logo icon-lg";
}
}
Expand Up @@ -23,12 +23,13 @@ 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" xmlns:i="jelly:fmt">
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt"
xmlns:lsi="/shim/layout/icon">
<l:layout title="${%title(it.run.fullDisplayName)}">
<st:include it="${it.run}" page="sidepanel.jelly"/>
<l:main-panel>
<h1>
<l:icon class="icon-fingerprint icon-xlg"/>
<lsi:icon class="icon-docker-logo icon-xlg"/>
${%title(it.run.fullDisplayName)}
</h1>
<table class="sortable bigtable pane">
Expand Down
Binary file added src/main/webapp/images/16x16/docker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/24x24/docker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/32x32/docker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/48x48/docker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb6296a

Please sign in to comment.