From 4e9dee7c6b26650d8f338b7575fba55ae66e487c Mon Sep 17 00:00:00 2001 From: Markus Winter Date: Sat, 24 Feb 2024 00:44:21 +0100 Subject: [PATCH 1/7] UI refresh Adjust all UI elements to use styling consistent with current Jenkins This affects all tables, input fields, checkboxes, icons, buttons, ... Follow guidelines from the design library and remove any backlinks in the sidebar Use ionicons where possible only use Jenkins defined color names to ensure compatibility with dark theme remove blockwrapper for compatibility with old Jenkins remove some validation methods for integer values that can be covered by using f:number instead of f:textbox reimplement the gerrit-server table with modern javascript (removes the old YUI related things). This requires to disable the jslint4jvava (10 year old version) as this doesn't understand modern js (e.g. no template literals, params with default values) extract inline style definitions to separate css remove inline javascript (onClick attribute of td) by using Behaviour.specify --- pom.xml | 16 +- .../gerrit/trigger/GerritManagement.java | 12 +- .../plugins/gerrit/trigger/GerritServer.java | 44 +- .../trigger/diagnostics/Diagnostics.java | 9 +- .../GerritTriggerDescriptor.java | 21 - .../META-INF/hudson.remoting.ClassFilter | 3 - .../trigger/GerritManagement/index.jelly | 148 +- .../trigger/GerritManagement/newServer.jelly | 6 - .../gerrit/trigger/GerritServer/index.jelly | 584 +- .../gerrit/trigger/GerritServer/remove.jelly | 2 - .../BuildMemoryReport/index.groovy | 117 +- .../BuildMemoryReport/index.properties | 4 +- .../diagnostics/Diagnostics/index.groovy | 7 +- .../EventListenersReport/index.groovy | 158 +- .../hudsontrigger/GerritTrigger/config.jelly | 463 +- .../ajaxTriggerMonitor.jelly | 43 +- .../manual/ManualTriggerAction/index.jelly | 366 +- .../plugins/gerrit/trigger/lib/enum.jelly | 47 - .../hudson/plugins/gerrit/trigger/lib/taglib | 0 src/main/resources/images/gear-error.svg | 336 - src/main/resources/images/gear-warning.svg | 400 - .../images/symbols/external-link.svg | 3 + .../gerrit-trigger/blockWrapperTable.jelly | 16 - .../blockWrapperTableWidth.jelly | 16 - .../lib/gerrit-trigger/blockWrapperTd.jelly | 16 - .../blockWrapperTdColspan.jelly | 16 - .../lib/gerrit-trigger/blockWrapperTr.jelly | 16 - .../blockWrapperTrValidationErrorArea.jelly | 16 - .../lib/gerrit-trigger/compareType.jelly | 17 + src/main/webapp/css/gerrit.css | 191 + .../help-allPatchSets.html | 0 .../help-allPatchSets_ja.html | 0 src/main/webapp/images/24x24/gear-error.png | Bin 1616 -> 0 bytes src/main/webapp/images/24x24/gear-warning.png | Bin 1589 -> 0 bytes src/main/webapp/images/collapsed.gif | Bin 197 -> 0 bytes src/main/webapp/images/expanded.gif | Bin 197 -> 0 bytes src/main/webapp/images/v.gif | Bin 152 -> 0 bytes src/main/webapp/images/x.gif | Bin 190 -> 0 bytes src/main/webapp/js/gerrit-search.js | 108 +- src/main/webapp/js/server-table.js | 281 +- .../yui/datatable/assets/datatable-core.css | 93 - .../js/yui/datatable/assets/datatable.css | 49 - .../assets/skins/sam/datatable-skin.css | 240 - .../datatable/assets/skins/sam/datatable.css | 8 - .../assets/skins/sam/dt-arrow-dn.png | Bin 116 -> 0 bytes .../assets/skins/sam/dt-arrow-up.png | Bin 116 -> 0 bytes .../js/yui/datatable/datatable-debug.js | 19320 ---------------- .../webapp/js/yui/datatable/datatable-min.js | 33 - src/main/webapp/js/yui/datatable/datatable.js | 19080 --------------- 49 files changed, 1232 insertions(+), 41073 deletions(-) delete mode 100644 src/main/resources/META-INF/hudson.remoting.ClassFilter delete mode 100644 src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/lib/enum.jelly delete mode 100644 src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/lib/taglib delete mode 100644 src/main/resources/images/gear-error.svg delete mode 100644 src/main/resources/images/gear-warning.svg create mode 100644 src/main/resources/images/symbols/external-link.svg delete mode 100644 src/main/resources/lib/gerrit-trigger/blockWrapperTable.jelly delete mode 100644 src/main/resources/lib/gerrit-trigger/blockWrapperTableWidth.jelly delete mode 100644 src/main/resources/lib/gerrit-trigger/blockWrapperTd.jelly delete mode 100644 src/main/resources/lib/gerrit-trigger/blockWrapperTdColspan.jelly delete mode 100644 src/main/resources/lib/gerrit-trigger/blockWrapperTr.jelly delete mode 100644 src/main/resources/lib/gerrit-trigger/blockWrapperTrValidationErrorArea.jelly create mode 100644 src/main/resources/lib/gerrit-trigger/compareType.jelly create mode 100644 src/main/webapp/css/gerrit.css rename src/main/{resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction => webapp}/help-allPatchSets.html (100%) rename src/main/{resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction => webapp}/help-allPatchSets_ja.html (100%) delete mode 100644 src/main/webapp/images/24x24/gear-error.png delete mode 100644 src/main/webapp/images/24x24/gear-warning.png delete mode 100644 src/main/webapp/images/collapsed.gif delete mode 100644 src/main/webapp/images/expanded.gif delete mode 100644 src/main/webapp/images/v.gif delete mode 100644 src/main/webapp/images/x.gif delete mode 100644 src/main/webapp/js/yui/datatable/assets/datatable-core.css delete mode 100644 src/main/webapp/js/yui/datatable/assets/datatable.css delete mode 100644 src/main/webapp/js/yui/datatable/assets/skins/sam/datatable-skin.css delete mode 100644 src/main/webapp/js/yui/datatable/assets/skins/sam/datatable.css delete mode 100644 src/main/webapp/js/yui/datatable/assets/skins/sam/dt-arrow-dn.png delete mode 100644 src/main/webapp/js/yui/datatable/assets/skins/sam/dt-arrow-up.png delete mode 100644 src/main/webapp/js/yui/datatable/datatable-debug.js delete mode 100644 src/main/webapp/js/yui/datatable/datatable-min.js delete mode 100644 src/main/webapp/js/yui/datatable/datatable.js diff --git a/pom.xml b/pom.xml index 985baa0a3..05446241b 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ - 2.414.3 + 2.426.3 2.39.5 -SNAPSHOT jenkinsci/${project.artifactId}-plugin @@ -115,6 +115,10 @@ org.jenkins-ci.plugins apache-httpcomponents-client-4-api + + io.jenkins.plugins + ionicons-api + org.jenkins-ci.plugins git @@ -271,8 +275,8 @@ io.jenkins.tools.bom - bom-2.414.x - 2675.v1515e14da_7a_6 + bom-2.426.x + 2815.vf5d6f093b_23e pom import @@ -334,7 +338,7 @@ - + diff --git a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement.java b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement.java index b38ace966..aec7ea2e9 100644 --- a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement.java +++ b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement.java @@ -32,7 +32,6 @@ import com.sonymobile.tools.gerrit.gerritevents.GerritSendCommandQueue; import hudson.DescriptorExtensionList; import hudson.Extension; -import hudson.Functions; import hudson.model.AdministrativeMonitor; import hudson.model.AutoCompletionCandidates; import hudson.model.Describable; @@ -117,15 +116,18 @@ public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse respons checkPermission(); Jenkins jenkins = Jenkins.get(); ContextMenu menu = new ContextMenu(); - menu.add("newServer", Functions.joinPath(jenkins.getRootUrl(), Functions.getResourcePath(), - "images", "24x24", "new-package.png"), Messages.AddNewServer()); + MenuItem item = new MenuItem() + .withUrl("newServer") + .withDisplayName(Messages.AddNewServer()) + .withIconClass("symbol-add-outline plugin-ionicons-api"); + menu.add(item); for (GerritServer server : getServers()) { menu.add(server); } - MenuItem item = new MenuItem() + item = new MenuItem() .withUrl("diagnostics") .withDisplayName(DIAGNOSTICS) - .withStockIcon("folder.png"); + .withIconClass("symbol-folder-outline plugin-ionicons-api"); item.subMenu = DIAGNOSTICS.getContextMenu("diagnostics"); menu.add(item); return menu; diff --git a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer.java b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer.java index 580c4ebdd..c0e2b5a33 100644 --- a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer.java +++ b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer.java @@ -1314,19 +1314,6 @@ public FormValidation doPositiveIntegerCheck( return FormValidation.validatePositiveInteger(value); } - /** - * Checks that the provided parameter is an integer and not negative, zero is accepted. - * - * @param value the value. - * @return {@link FormValidation#validateNonNegativeInteger(String)} - */ - public FormValidation doNonNegativeIntegerCheck( - @QueryParameter("value") - final String value) { - - return FormValidation.validateNonNegativeInteger(value); - } - /** * Checks that the provided parameter is an integer, not negative, that is larger * than the minimum value. @@ -1367,27 +1354,6 @@ public FormValidation doIntegerCheck( } } - /** - * Checks that the provided parameter is an empty string or an integer. - * @param value the value. - * @return {@link FormValidation#validatePositiveInteger(String)} - */ - public FormValidation doEmptyOrIntegerCheck( - @QueryParameter("value") - final String value) { - - if (value == null || value.length() <= 0) { - return FormValidation.ok(); - } else { - try { - Integer.parseInt(value); - return FormValidation.ok(); - } catch (NumberFormatException e) { - return FormValidation.error(Messages.NotANumber()); - } - } - } - /** * Checks if the value is a valid URL. It does not check if the URL is reachable. * @param value the value @@ -1437,14 +1403,14 @@ public FormValidation doValidKeyFileCheck( * Checks to see if the provided value represents a time on the hh:mm format. * Also checks that from is before to. * - * @param fromValue the from value. - * @param toValue the to value. + * @param from the from value. + * @param to the to value. * @return {@link FormValidation#ok() } if it is so. */ public FormValidation doValidTimeCheck( - @QueryParameter final String fromValue, @QueryParameter final String toValue) { - String[] splitFrom = fromValue.split(":"); - String[] splitTo = toValue.split(":"); + @QueryParameter final String from, @QueryParameter final String to) { + String[] splitFrom = from.split(":"); + String[] splitTo = to.split(":"); int fromHour; int fromMinute; int toHour; diff --git a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/diagnostics/Diagnostics.java b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/diagnostics/Diagnostics.java index 1092c4b04..00bc61b0a 100644 --- a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/diagnostics/Diagnostics.java +++ b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/diagnostics/Diagnostics.java @@ -80,15 +80,18 @@ public ContextMenu getContextMenu(String context) { String url = makeRelativeUrl(context, "buildMemory"); menu.add(new MenuItem() .withUrl(url) - .withStockIcon("clipboard.png") + .withIconClass("symbol-clipboard-outline plugin-ionicons-api") .withDisplayName(Messages.BuildMemoryReport_DisplayName())); url = makeRelativeUrl(context, "eventListeners"); menu.add(new MenuItem() .withUrl(url) - .withStockIcon("clipboard.png") + .withIconClass("symbol-clipboard-outline plugin-ionicons-api") .withDisplayName(Messages.EventListenersReport_DisplayName())); if (isDebugMode()) { - menu.add("triggerDebugEvent", "warning.png", "Trigger Debug", false, true); + MenuItem item = new MenuItem().withUrl("triggerDebugEvent").withIconClass("symbol-warning plugin-ionicons-api") + .withDisplayName("Trigger Debug"); + item.requiresConfirmation = true; + menu.add(item); } return menu; } diff --git a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerDescriptor.java b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerDescriptor.java index 3092014e2..c451620e7 100644 --- a/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerDescriptor.java +++ b/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerDescriptor.java @@ -63,27 +63,6 @@ public boolean isUnsuccessfulMessageFileSupported(Job job) { return job instanceof AbstractProject; } - /** - * Checks that the provided parameter is an empty string or an integer. - * - * @param value the value. - * @return {@link FormValidation#validatePositiveInteger(String)} - */ - public FormValidation doEmptyOrIntegerCheck( - @QueryParameter("value") - final String value) { - if (value == null || value.length() <= 0) { - return FormValidation.ok(); - } else { - try { - Integer.parseInt(value); - return FormValidation.ok(); - } catch (NumberFormatException e) { - return FormValidation.error(Messages.NotANumber()); - } - } - } - /** * Provides auto-completion candidates for dependency jobs names. * diff --git a/src/main/resources/META-INF/hudson.remoting.ClassFilter b/src/main/resources/META-INF/hudson.remoting.ClassFilter deleted file mode 100644 index ffda5871a..000000000 --- a/src/main/resources/META-INF/hudson.remoting.ClassFilter +++ /dev/null @@ -1,3 +0,0 @@ -# Remove once https://github.com/jenkinsci/jenkins/pull/3234 is integrated? -java.util.Collections$SynchronizedList -java.util.Collections$SynchronizedRandomAccessList diff --git a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/index.jelly b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/index.jelly index 7b334117f..f924edb26 100644 --- a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/index.jelly +++ b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/index.jelly @@ -3,88 +3,80 @@ xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + ${%New Server} + + + ${%Diagnostics} + + + + + + + + + + + + + + -
-
- Filtered Out -
-
- - +
+ +
-
- Filtered In -
@@ -102,11 +94,19 @@
-
-
${%Gerrit Servers}
-

-

-
+
${%Gerrit Servers}
+ + + + + + + + + + + +
${%Server Name}${%Version}${%Status}${%Edit}${%Remove}
diff --git a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/newServer.jelly b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/newServer.jelly index 8a76620d5..d31e357e8 100644 --- a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/newServer.jelly +++ b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritManagement/newServer.jelly @@ -28,12 +28,6 @@ THE SOFTWARE. - - - - - - diff --git a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/index.jelly b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/index.jelly index d7886fef1..88c838477 100644 --- a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/index.jelly +++ b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/GerritServer/index.jelly @@ -1,26 +1,35 @@ + xmlns:f="/lib/form"> + + - + +
+ + diff --git a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction/index.jelly b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction/index.jelly index 4598f31bc..a86f27f3f 100644 --- a/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction/index.jelly +++ b/src/main/resources/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/actions/manual/ManualTriggerAction/index.jelly @@ -3,16 +3,9 @@