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

Modernize build status and weather icons #5065

Merged
merged 37 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4c27438
Inline icon-set lib
timja Nov 23, 2020
d556c74
Add @since 2.0
timja Nov 23, 2020
472804c
Merge branch 'master' into inline-icon-set-lib
timja Nov 27, 2020
8ea006f
Merge branch 'master' into inline-icon-set-lib
timja Nov 27, 2020
d4d40a1
Merge branch 'inline-icon-set-lib' of github.com:timja/jenkins into i…
timja Nov 27, 2020
7206870
Downgrade iconset to 1.0.5 version
timja Nov 27, 2020
913c52b
Fix javadoc
timja Nov 27, 2020
b07e165
Missed one javadoc error
timja Nov 28, 2020
43b1e7c
Add support for svg icons in actions
timja Nov 20, 2020
e128508
Change help icon
timja Nov 28, 2020
63763e2
Fix large SVG icons
timja Nov 28, 2020
61c3dec
Experiment with font awesome
timja Nov 28, 2020
6937e27
Add /manage support
timja Nov 29, 2020
b1a76e3
Merge branch 'master' into svg-icons
timja Dec 1, 2020
dd8ea43
Use material sprites (#30)
fqueiruga Dec 3, 2020
974fd7d
Merge branch 'master' into pr/5065
fqueiruga Jan 28, 2021
a9b7cc9
Convert status icons to sprite
fqueiruga Jan 28, 2021
8aa825d
Merge branch 'master' into pr/5065
fqueiruga Feb 5, 2021
8ae2e25
Apply suggestions from code review
fqueiruga Feb 5, 2021
080d1b5
Fix missing icons
timja Feb 6, 2021
4534757
Replace weather icons with SVGs
fqueiruga Feb 8, 2021
3ec7751
Update core/src/main/java/org/jenkins/ui/icon/WeatherIcon.java
fqueiruga Feb 8, 2021
787db98
Fix IconTest
timja Feb 9, 2021
b74d7ac
Merge branch 'svg-icons' of github.com:timja/jenkins into svg-icons
timja Feb 9, 2021
76679ff
Apply suggestions from code review
fqueiruga Feb 9, 2021
ef2865b
Merge branch 'master' into svg-icons
timja Feb 18, 2021
8cd47ac
Add class required for compat
timja Feb 20, 2021
ba286b6
Fix UpdateCenter
timja Feb 21, 2021
1d1cd44
Simplify API for plugins
timja Feb 21, 2021
f24d465
Merge branch 'master' into svg-icons
timja Feb 21, 2021
0864772
Remove unused icon types
timja Feb 23, 2021
ef6bc13
Remove other reference to unused code
timja Feb 23, 2021
0fe9659
Review comments
timja Feb 24, 2021
f0324e8
Bit more javadoc
timja Feb 24, 2021
03a6243
Change the build unstable status icon
fqueiruga Mar 3, 2021
b21f098
Revert sidebar changes and add license info
timja Mar 5, 2021
1a8cedc
Revert missed icon clipboard
timja Mar 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions core/src/main/java/org/jenkins/ui/icon/BuildStatusIcon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* The MIT License
*
* Copyright (c) 2021 CloudBees, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Felix created it, I just added the license header

*
* 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.jenkins.ui.icon;
timja marked this conversation as resolved.
Show resolved Hide resolved

import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

/**
* An icon used for build statuses
*/
@Restricted(NoExternalUse.class)
public class BuildStatusIcon extends Icon {
timja marked this conversation as resolved.
Show resolved Hide resolved
timja marked this conversation as resolved.
Show resolved Hide resolved
private boolean inProgress;

public BuildStatusIcon(String classSpec, String url, String style, boolean inProgress) {
super(classSpec, url, style, IconFormat.EXTERNAL_SVG_SPRITE);
this.inProgress = inProgress;
}

public BuildStatusIcon(String classSpec, String url, String style) {
this(classSpec, url, style, false);
}

@Override
public boolean isSvgSprite() {
return super.isSvgSprite();
}

public boolean isBuildStatus() {
return true;
}

public boolean isInProgress() {
return inProgress;
}
}
37 changes: 37 additions & 0 deletions core/src/main/java/org/jenkins/ui/icon/Icon.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
package org.jenkins.ui.icon;

import org.apache.commons.jelly.JellyContext;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -59,6 +61,7 @@ public class Icon {
private final String url;
private final String style;
private IconType iconType;
private IconFormat iconFormat;

/**
* Creates a {@link IconType#CORE core} icon.
Expand Down Expand Up @@ -97,11 +100,37 @@ public Icon(String classSpec, String url, String style) {
* @param iconType The icon type.
*/
public Icon(String classSpec, String url, String style, IconType iconType) {
this(classSpec, url, style, iconType, IconFormat.IMG);
}

/**
* Creates an icon.
*
* @param classSpec The icon class names.
* @param url The icon image url.
* @param style The icon style.
* @param iconFormat the {@link IconFormat}.
* @since TODO
*/
public Icon(String classSpec, String url, String style, IconFormat iconFormat) {
this(classSpec, url, style, IconType.CORE, iconFormat);
if (url != null) {
if (url.startsWith("images/")) {
this.iconType = IconType.CORE;
} else if (url.startsWith("plugin/")) {
this.iconType = IconType.PLUGIN;
}
}
}

@Restricted(NoExternalUse.class)
public Icon(String classSpec, String url, String style, IconType iconType, IconFormat iconFormat) {
timja marked this conversation as resolved.
Show resolved Hide resolved
this.classSpec = classSpec;
this.normalizedSelector = toNormalizedCSSSelector(classSpec);
this.url = toNormalizedIconUrl(url);
this.style = style;
this.iconType = iconType;
this.iconFormat = iconFormat;
}

/**
Expand All @@ -112,6 +141,14 @@ public String getClassSpec() {
return classSpec;
}

/**
* Is the Icon an SVG?
* @since TODO
*/
timja marked this conversation as resolved.
Show resolved Hide resolved
public boolean isSvgSprite() {
return iconFormat == IconFormat.EXTERNAL_SVG_SPRITE;
}

/**
* Get the icon's normalized CSS selector.
*
Expand Down
34 changes: 34 additions & 0 deletions core/src/main/java/org/jenkins/ui/icon/IconFormat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* The MIT License
*
* Copyright (c) 2021 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.jenkins.ui.icon;
timja marked this conversation as resolved.
Show resolved Hide resolved

/**
* Format for the icon.
* @since TODO
*/
public enum IconFormat {
timja marked this conversation as resolved.
Show resolved Hide resolved
IMG,
EXTERNAL_SVG_SPRITE,
}
Loading