Skip to content
Permalink
Browse files

Merge pull request #21 from jenkinsci/JENKINS-36320

JENKINS-36320 & JENKINS-33645
  • Loading branch information
batmat committed Nov 5, 2016
2 parents 77312cd + c6d466d commit b01fb49633bd986c600a6e9f5d5d6140289aed30
Showing with 50 additions and 34 deletions.
  1. +20 −16 pom.xml
  2. +4 −3 src/main/java/hudson/model/JobViewEntry.java
  3. +26 −15 src/main/java/hudson/model/RadiatorView.java
36 pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.1</version>
<version>2.16</version>
<relativePath />
</parent>

@@ -15,7 +15,7 @@
<description>Adds a new high visibility view of project status.</description>

<properties>
<jenkins.version>1.554.1</jenkins.version>
<jenkins.version>1.642.3</jenkins.version>
<hpi-plugin.version>1.115</hpi-plugin.version>
<jenkins-test-harness.version>${jenkins.version}</jenkins-test-harness.version>
</properties>
@@ -29,8 +29,8 @@
<connection>scm:git:git://github.com/jenkinsci/radiatorview-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/radiatorview-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/radiatorview-plugin</url>
<tag>HEAD</tag>
</scm>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>batmat</id>
@@ -63,24 +63,28 @@
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/releases/</url>
</repository>
<snapshotRepository>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/snapshots/</url>
</snapshotRepository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>5.13</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>claim</artifactId>
<version>1.7</version>
<optional>true</optional>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>

@@ -13,6 +13,7 @@
import java.util.List;
import java.util.Set;

import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;

/**
@@ -68,7 +69,7 @@ public JobViewEntry(RadiatorView radiatorView, Job<?, ?> job) {
* @see hudson.model.IViewEntry#getName()
*/
public String getName() {
return job.getName();
return job.getFullName();
}

/*
@@ -432,7 +433,7 @@ public boolean isNotBuilt() {
*/
public String getClaim() {
// check we have claim plugin
if (Hudson.getInstance().getPlugin("claim") == null) {
if (Jenkins.getActiveInstance().getPlugin("claim") == null) {
return null;
}
Run<?, ?> lastBuild = getLastCompletedRun();
@@ -463,7 +464,7 @@ public String getClaim() {
}

public String getUnclaimedMatrixBuilds() {
if (Hudson.getInstance().getPlugin("claim") == null) {
if (Jenkins.getActiveInstance().getPlugin("claim") == null) {
return "";
}
Run<?, ?> lastBuild = getLastCompletedRun();
@@ -1,27 +1,27 @@
package hudson.model;

import com.cloudbees.hudson.plugins.folder.AbstractFolder;
import hudson.Extension;
import hudson.Util;
import hudson.model.Descriptor.FormException;
import hudson.util.FormValidation;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

import javax.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

import javax.servlet.ServletException;

import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;

/**
* A configurable Radiator-Style job view suitable for use in extreme feedback
* systems - ideal for running on a spare PC in the office. Many thanks to
@@ -34,6 +34,8 @@

private static final int DEFAULT_CAPTION_SIZE = 36;

private static final Logger LOGGER = Logger.getLogger(RadiatorView.class.getName());

/**
* Entries to be shown in the view.
*/
@@ -112,22 +114,31 @@ public ViewEntryColors getColors() {
}

public ProjectViewEntry getContents() {
ProjectViewEntry contents = new ProjectViewEntry();
ProjectViewEntry content = new ProjectViewEntry();

placeInQueue = new HashMap<hudson.model.Queue.Item, Integer>();
int j = 1;
for (hudson.model.Queue.Item i : Hudson.getInstance().getQueue()
for (hudson.model.Queue.Item i : Jenkins.getActiveInstance().getQueue()
.getItems()) {
placeInQueue.put(i, j++);
}

for (TopLevelItem item : super.getItems()) {
if(item instanceof Job && !isDisabled(item)) {
LOGGER.fine("Collecting items for view " + getViewName());
addItems(getItems(), content);
return content;
}

private void addItems(Collection<TopLevelItem> items, ProjectViewEntry content) {
for (TopLevelItem item : items) {
LOGGER.fine(item.getName() + " (" + item.getClass() + ")");
if (item instanceof AbstractFolder) {
addItems(((AbstractFolder) item).getItems(), content);
}
if (item instanceof Job && !isDisabled(item)) {
IViewEntry entry = new JobViewEntry(this, (Job<?, ?>) item);
contents.addBuild(entry);
content.addBuild(entry);
}
}
return contents;
}

private boolean isDisabled(TopLevelItem item) {

0 comments on commit b01fb49

Please sign in to comment.
You can’t perform that action at this time.