mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 04:22:16 +00:00
[FIXED JENKINS-24407] Restore icon class name during deserialization
This commit is contained in:
1 parent
9b7b1364c0
commit
990a84f753
1 file changed
+15
@@ -34,7 +34,9 @@ import org.kohsuke.stapler.export.ExportedBean;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents health of something (typically project).
|
||||
@@ -60,6 +62,15 @@ public class HealthReport implements Serializable, Comparable<HealthReport> {
|
||||
private static final String HEALTH_0_TO_20_IMG = "health-00to19.png";
|
||||
private static final String HEALTH_UNKNOWN_IMG = "empty.png";
|
||||
|
||||
private static final Map<String, String> iconIMGToClassMap = new HashMap<String, String>();
|
||||
static {
|
||||
iconIMGToClassMap.put(HEALTH_OVER_80_IMG, HEALTH_OVER_80);
|
||||
iconIMGToClassMap.put(HEALTH_61_TO_80_IMG, HEALTH_61_TO_80);
|
||||
iconIMGToClassMap.put(HEALTH_41_TO_60_IMG, HEALTH_41_TO_60);
|
||||
iconIMGToClassMap.put(HEALTH_21_TO_40_IMG, HEALTH_21_TO_40);
|
||||
iconIMGToClassMap.put(HEALTH_0_TO_20_IMG, HEALTH_0_TO_20);
|
||||
}
|
||||
|
||||
/**
|
||||
* The percentage health score (from 0 to 100 inclusive).
|
||||
*/
|
||||
@@ -351,6 +362,10 @@ public class HealthReport implements Serializable, Comparable<HealthReport> {
|
||||
hr.localizibleDescription = new NonLocalizable(hr.description == null ? "" : hr.description);
|
||||
OldDataMonitor.report(context, "1.256");
|
||||
}
|
||||
|
||||
if (hr.iconClassName == null && hr.iconUrl != null && iconIMGToClassMap.containsKey(hr.iconUrl)) {
|
||||
hr.iconClassName = iconIMGToClassMap.get(hr.iconUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user