diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..baa7980b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*.{jelly, js, html, less, css, hbs}] +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitignore b/.gitignore index ab61d977..b42dc74e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ .settings/ .idea/ .DS_Store +*.iml diff --git a/pom.xml b/pom.xml index 51e2050f..f299c76c 100644 --- a/pom.xml +++ b/pom.xml @@ -33,19 +33,19 @@ THE SOFTWARE. - org.jenkins-ci.main - ui-samples-plugin + io.jenkins.plugins + design-library ${revision}${changelist} hpi - Jenkins UI sample plugin - Demonstration of UI controls available in Jenkins based on Stapler, Jelly, Groovy, etc. - https://github.com/ui-samples-plugin + Jenkins Design Library + Demonstration of UI controls available in Jenkins and guidance on how to use them + https://github.com/jenkinsci/ui-samples-plugin 2.1 -SNAPSHOT - github.com/ui-samples-plugin + jenkinsci/ui-samples-plugin 2.339 8 @@ -90,9 +90,9 @@ THE SOFTWARE. - scm:git:https://${gitHubRepo} - scm:git:https://${gitHubRepo} - https://${gitHubRepo} + scm:git:https://github.com/${gitHubRepo} + scm:git:https://github.com/${gitHubRepo} + https://github.com/${gitHubRepo} ${scmTag} diff --git a/src/main/java/io/jenkins/plugins/designlibrary/AppBar.java b/src/main/java/io/jenkins/plugins/designlibrary/AppBar.java new file mode 100644 index 00000000..7ea59ae4 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/AppBar.java @@ -0,0 +1,21 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +@Extension +public class AppBar extends UISample { + @Override + public String getDisplayName() { + return "App bars"; + } + + @Override + public String getIconFileName() { + return "symbol-app-bar"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Buttons.java b/src/main/java/io/jenkins/plugins/designlibrary/Buttons.java new file mode 100644 index 00000000..61cdf418 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Buttons.java @@ -0,0 +1,19 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class Buttons extends UISample { + @Override + public String getIconFileName() { + return "symbol-buttons"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Checkboxes.java b/src/main/java/io/jenkins/plugins/designlibrary/Checkboxes.java new file mode 100644 index 00000000..c225d2bc --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Checkboxes.java @@ -0,0 +1,19 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class Checkboxes extends UISample { + @Override + public String getIconFileName() { + return "symbol-checkboxes"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Colors.java b/src/main/java/io/jenkins/plugins/designlibrary/Colors.java new file mode 100644 index 00000000..d34b11a7 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Colors.java @@ -0,0 +1,25 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +import java.util.Arrays; +import java.util.List; + +@Extension +public class Colors extends UISample { + @Override + public String getIconFileName() { + return "symbol-colors"; + } + + public List getColors() { + // Uncomment these once these colors are in core + // return Arrays.asList("red", "green", "orange", "yellow", "blue", "indigo", "violet"); + return Arrays.asList("red", "green", "orange"); + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/jenkins/plugins/ui_samples/HeteroList.java b/src/main/java/io/jenkins/plugins/designlibrary/HeteroList.java similarity index 92% rename from src/main/java/jenkins/plugins/ui_samples/HeteroList.java rename to src/main/java/io/jenkins/plugins/designlibrary/HeteroList.java index 389b02aa..879b9727 100644 --- a/src/main/java/jenkins/plugins/ui_samples/HeteroList.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/HeteroList.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import com.google.common.collect.ImmutableList; import hudson.Extension; @@ -45,19 +45,10 @@ @Extension public final class HeteroList extends UISample { - @Override public String getDescription() { - return "Show a heterogeneous list of subitems with different data bindings for radio buttons and checkboxes"; - } - - @Override public List getSourceFiles() { - return super.getSourceFiles(); - // TODO add others - } - @Extension public static final class DescriptorImpl extends UISampleDescriptor {} public XmlFile getConfigFile() { - return new XmlFile(new File(Jenkins.getInstance().getRootDir(), "stuff.xml")); + return new XmlFile(new File(Jenkins.get().getRootDir(), "stuff.xml")); } private Config config; diff --git a/src/main/java/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb.java b/src/main/java/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb.java new file mode 100644 index 00000000..881f74ee --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb.java @@ -0,0 +1,15 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class InpageNavigationWithBreadcrumb extends UISample { + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + + diff --git a/src/main/java/jenkins/plugins/ui_samples/JavaScriptProxy.java b/src/main/java/io/jenkins/plugins/designlibrary/JavaScriptProxy.java similarity index 73% rename from src/main/java/jenkins/plugins/ui_samples/JavaScriptProxy.java rename to src/main/java/io/jenkins/plugins/designlibrary/JavaScriptProxy.java index 80afaa26..11b4536e 100644 --- a/src/main/java/jenkins/plugins/ui_samples/JavaScriptProxy.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/JavaScriptProxy.java @@ -1,4 +1,4 @@ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.Extension; import org.kohsuke.stapler.bind.JavaScriptMethod; @@ -12,10 +12,10 @@ @Extension public class JavaScriptProxy extends UISample { private int i; - + @Override - public String getDescription() { - return "Use JavaScript proxy objects to access server-side Java objects from inside the browser."; + public String getDisplayName() { + return "JavaScript Proxy"; } /** @@ -23,7 +23,7 @@ public String getDescription() { */ @JavaScriptMethod public int increment(int n) { - return i+=n; + return i += n; } @Extension diff --git a/src/main/java/jenkins/plugins/ui_samples/NavigationContextMenu.java b/src/main/java/io/jenkins/plugins/designlibrary/Links.java similarity index 67% rename from src/main/java/jenkins/plugins/ui_samples/NavigationContextMenu.java rename to src/main/java/io/jenkins/plugins/designlibrary/Links.java index 6770a566..bc7c754d 100644 --- a/src/main/java/jenkins/plugins/ui_samples/NavigationContextMenu.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/Links.java @@ -1,4 +1,4 @@ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.Extension; import jenkins.model.ModelObjectWithChildren; @@ -10,10 +10,10 @@ * @author Kohsuke Kawaguchi */ @Extension -public class NavigationContextMenu extends UISample implements ModelObjectWithContextMenu, ModelObjectWithChildren { +public class Links extends UISample implements ModelObjectWithContextMenu, ModelObjectWithChildren { @Override - public String getDescription() { - return "Integrate with navigational context menu to provider quick access around object graph"; + public String getIconFileName() { + return "symbol-links"; } /** @@ -28,18 +28,18 @@ public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse respons // otherwise you can also programatically create them. // see the javadoc for various convenience methods to add items return new ContextMenu() - .add("http://jenkins-ci.org/","Jenkins project") - .add("http://www.cloudbees.com/","CloudBees") - .add(new MenuItem().withContextRelativeUrl("/").withStockIcon("gear.png").withDisplayName("top page")); + .add(new MenuItem().withContextRelativeUrl("/").withIconClass("icon-up").withDisplayName("Back to Dashboard")) + .add("https://www.jenkins.io/","Jenkins project") + .add("https://plugins.jenkins.io/","Plugin documentation"); } } public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception { // You implement this method in much the same way you do doContextMenu return new ContextMenu() - .add("http://yahoo.com/","Yahoo") - .add("http://google.com/","Google") - .add("http://microsoft.com/","Microsoft"); + .add("https://yahoo.com/","Yahoo") + .add("https://google.com/","Google") + .add("https://microsoft.com/","Microsoft"); } @Extension diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Notifications.java b/src/main/java/io/jenkins/plugins/designlibrary/Notifications.java new file mode 100644 index 00000000..57e83bde --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Notifications.java @@ -0,0 +1,20 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class Notifications extends UISample { + @Override + public String getIconFileName() { + return "symbol-notifications"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + + diff --git a/src/main/java/jenkins/plugins/ui_samples/ProgressivelyRendered.java b/src/main/java/io/jenkins/plugins/designlibrary/Progress.java similarity index 50% rename from src/main/java/jenkins/plugins/ui_samples/ProgressivelyRendered.java rename to src/main/java/io/jenkins/plugins/designlibrary/Progress.java index e70729e5..007ab34a 100644 --- a/src/main/java/jenkins/plugins/ui_samples/ProgressivelyRendered.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/Progress.java @@ -1,49 +1,34 @@ -/* - * The MIT License - * - * Copyright 2012 Jesse Glick. - * - * 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 jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.Extension; -import java.util.LinkedList; -import java.util.List; import jenkins.util.ProgressiveRendering; import net.sf.json.JSON; import net.sf.json.JSONArray; import net.sf.json.JSONObject; -@Extension -public class ProgressivelyRendered extends UISample { +import java.util.LinkedList; +import java.util.List; - @Override public String getDescription() { - return "Shows how to use progressively rendered content to avoid overloading the server with a slow HTTP request."; +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class Progress extends UISample { + @Override + public String getIconFileName() { + return "symbol-progress"; } public ProgressiveRendering factor(final String numberS) { return new ProgressiveRendering() { final List newFactors = new LinkedList(); @Override protected void compute() throws Exception { - int number = Integer.parseInt(numberS); // try entering a nonnumeric value! + int number; + try { + number = Integer.parseInt(numberS); // try entering a nonnumeric value! + } catch (NumberFormatException e) { + number = Integer.MAX_VALUE; + } // Deliberately inefficient: for (int i = 1; i <= number; i++) { if (canceled()) { @@ -72,6 +57,7 @@ public ProgressiveRendering factor(final String numberS) { } @Extension - public static final class DescriptorImpl extends UISampleDescriptor {} - + public static final class DescriptorImpl extends UISampleDescriptor { + } } + diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Radios.java b/src/main/java/io/jenkins/plugins/designlibrary/Radios.java new file mode 100644 index 00000000..67200a91 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Radios.java @@ -0,0 +1,24 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; +import jenkins.model.Jenkins; + +import java.util.ArrayList; +import java.util.List; + +@Extension +public class Radios extends UISample { + @Override + public String getIconFileName() { + return "symbol-radios"; + } + + public List getRadios() { + return new ArrayList<>(Jenkins.get().getExtensionList(UISample.class)).subList(0, 4); + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/jenkins/plugins/ui_samples/Root.java b/src/main/java/io/jenkins/plugins/designlibrary/Root.java similarity index 66% rename from src/main/java/jenkins/plugins/ui_samples/Root.java rename to src/main/java/io/jenkins/plugins/designlibrary/Root.java index be4378b9..86563ae6 100644 --- a/src/main/java/jenkins/plugins/ui_samples/Root.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/Root.java @@ -1,4 +1,4 @@ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.Extension; import hudson.model.RootAction; @@ -16,15 +16,15 @@ @Extension public class Root implements RootAction, ModelObjectWithContextMenu { public String getIconFileName() { - return "gear.png"; + return "symbol-design-library plugin-design-library"; } public String getDisplayName() { - return "UI Samples"; + return "Design Library"; } public String getUrlName() { - return "ui-samples"; + return "design-library"; } public UISample getDynamic(String name) { @@ -37,18 +37,10 @@ public UISample getDynamic(String name) { } public List getAll() { - return UISample.all(); - } - - public List getAllGroovy() { - return UISample.getGroovySamples(); + return UISample.getAll(); } - public List getAllOther() { - return UISample.getOtherSamples(); - } - - public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws Exception { - return new ContextMenu().addAll(getAll()); + public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) { + return null; } } diff --git a/src/main/java/jenkins/plugins/ui_samples/DropdownList.java b/src/main/java/io/jenkins/plugins/designlibrary/Select.java similarity index 65% rename from src/main/java/jenkins/plugins/ui_samples/DropdownList.java rename to src/main/java/io/jenkins/plugins/designlibrary/Select.java index 76bc73c0..7f91b624 100644 --- a/src/main/java/jenkins/plugins/ui_samples/DropdownList.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/Select.java @@ -1,29 +1,31 @@ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.DescriptorExtensionList; import hudson.Extension; import hudson.ExtensionPoint; import hudson.model.Describable; import hudson.model.Descriptor; +import hudson.util.ListBoxModel; import jenkins.model.Jenkins; import hudson.util.XStream2; import java.io.IOException; -import java.util.List; import javax.servlet.ServletException; import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import static java.util.Arrays.asList; + /** * @author Alan.Harder@oracle.com */ @Extension -public class DropdownList extends UISample { - +public class Select extends UISample { @Override - public String getDescription() { - return "Show different form elements based on choice in a <select> control"; + public String getIconFileName() { + return "symbol-select"; } public Fruit getFruit() { @@ -32,7 +34,7 @@ public Fruit getFruit() { } public DescriptorExtensionList> getFruitDescriptors() { - return Jenkins.getInstance().>getDescriptorList(Fruit.class); + return Jenkins.get().getDescriptorList(Fruit.class); } // Process form data and show it as serialized XML @@ -44,16 +46,31 @@ public void doSubmit(StaplerRequest req, StaplerResponse rsp) throws ServletExce new XStream2().toXML(fruit, rsp.getWriter()); } - @Override - public List getSourceFiles() { - List list = new java.util.ArrayList(super.getSourceFiles()); - list.add(new SourceFile("Apple/config.jelly")); - list.add(new SourceFile("Banana/config.jelly")); - return list; - } - @Extension public static final class DescriptorImpl extends UISampleDescriptor { + + public ListBoxModel doFillFruitItems() { + return new ListBoxModel( + new ListBoxModel.Option("Apple"), + new ListBoxModel.Option("Banana") + ); + } + + public ListBoxModel doFillStateItems(@QueryParameter String country) { + ListBoxModel m = new ListBoxModel(); + for (String s : asList("A","B","C")) + m.add(String.format("State %s in %s", s, country), + country+':'+s); + return m; + } + + public ListBoxModel doFillCityItems(@QueryParameter String country, @QueryParameter String state) { + ListBoxModel m = new ListBoxModel(); + for (String s : asList("X","Y","Z")) + m.add(String.format("City %s in %s %s", s, state, country), + state+':'+s); + return m; + } } public static abstract class Fruit implements ExtensionPoint, Describable { @@ -61,7 +78,7 @@ public static abstract class Fruit implements ExtensionPoint, Describable protected Fruit(String name) { this.name = name; } public Descriptor getDescriptor() { - return Jenkins.getInstance().getDescriptor(getClass()); + return Jenkins.get().getDescriptor(getClass()); } } diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Spacing.java b/src/main/java/io/jenkins/plugins/designlibrary/Spacing.java new file mode 100644 index 00000000..30fd6934 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Spacing.java @@ -0,0 +1,15 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +@Extension +public class Spacing extends UISample { + @Override + public String getIconFileName() { + return "symbol-spacing"; + } + + @Extension + public static class DescriptorImpl extends UISampleDescriptor { + } +} diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Symbols.java b/src/main/java/io/jenkins/plugins/designlibrary/Symbols.java new file mode 100644 index 00000000..389d7076 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Symbols.java @@ -0,0 +1,19 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class Symbols extends UISample { + @Override + public String getIconFileName() { + return "symbol-symbols"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Table.java b/src/main/java/io/jenkins/plugins/designlibrary/Table.java new file mode 100644 index 00000000..7b4777e7 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Table.java @@ -0,0 +1,19 @@ +package io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +/** + * @author Kohsuke Kawaguchi + */ +@Extension +public class Table extends UISample { + @Override + public String getIconFileName() { + return "symbol-table"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} + diff --git a/src/main/java/jenkins/plugins/ui_samples/AutoCompleteTextBox.java b/src/main/java/io/jenkins/plugins/designlibrary/TextBox.java similarity index 70% rename from src/main/java/jenkins/plugins/ui_samples/AutoCompleteTextBox.java rename to src/main/java/io/jenkins/plugins/designlibrary/TextBox.java index 9a5e1afa..e9e8a91d 100644 --- a/src/main/java/jenkins/plugins/ui_samples/AutoCompleteTextBox.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/TextBox.java @@ -22,22 +22,28 @@ * THE SOFTWARE. */ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.Extension; import hudson.model.AutoCompletionCandidates; +import hudson.util.ComboBoxModel; +import hudson.util.ListBoxModel; import org.kohsuke.stapler.QueryParameter; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + /** * Adding auto-completion to the text box. * * @author Kohsuke Kawaguchi */ @Extension -public class AutoCompleteTextBox extends UISample { +public class TextBox extends UISample { @Override - public String getDescription() { - return "Provide auto-completion to the text box"; + public String getIconFileName() { + return "symbol-textbox"; } @Extension @@ -52,10 +58,41 @@ public static final class DescriptorImpl extends UISampleDescriptor { public AutoCompletionCandidates doAutoCompleteState(@QueryParameter String value) { AutoCompletionCandidates c = new AutoCompletionCandidates(); for (String state : STATES) - if (state.toLowerCase().startsWith(value.toLowerCase())) + if (state.toLowerCase().startsWith(value.toLowerCase())) { c.add(state); + } return c; } + + public ComboBoxModel doFillStateItems() { + return new ComboBoxModel(STATES); + } + + public ListBoxModel doFillAlbumItems() { + ListBoxModel m = new ListBoxModel(); + m.add("Yellow Submarine","1"); + m.add("Abbey Road","2"); + m.add("Let It Be","3"); + return m; + } + + public ComboBoxModel doFillTitleItems(@QueryParameter int album) { + switch (album) { + case 1: + return new ComboBoxModel("Yellow Submarine","Only a Northern Song","All You Need Is Love"); + case 2: + return new ComboBoxModel("Come Together","Something","I Want You"); + case 3: + return new ComboBoxModel("The One After 909","Rocker","Get Back"); + default: + // if no value is selected on the album, we'll get 0 + return new ComboBoxModel(); + } + } + } + + public Set getStatesNames() { + return new HashSet<> (Arrays.asList(STATES)); } private static final String[] STATES = new String[]{ diff --git a/src/main/java/io/jenkins/plugins/designlibrary/Tooltips.java b/src/main/java/io/jenkins/plugins/designlibrary/Tooltips.java new file mode 100644 index 00000000..cc4b0e2f --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/Tooltips.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * + * Copyright (c) 2010, InfraDNA, 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 io.jenkins.plugins.designlibrary; + +import hudson.Extension; + +@Extension +public class Tooltips extends UISample { + @Override + public String getIconFileName() { + return "symbol-tooltips"; + } + + @Extension + public static final class DescriptorImpl extends UISampleDescriptor { + } +} diff --git a/src/main/java/io/jenkins/plugins/designlibrary/UISample.java b/src/main/java/io/jenkins/plugins/designlibrary/UISample.java new file mode 100644 index 00000000..29988517 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/designlibrary/UISample.java @@ -0,0 +1,40 @@ +package io.jenkins.plugins.designlibrary; + +import static org.apache.commons.io.IOUtils.copy; + +import hudson.ExtensionPoint; +import hudson.model.Action; +import hudson.model.Describable; + +import java.util.ArrayList; +import java.util.List; + +import jenkins.model.Jenkins; + +/** + * @author Kohsuke Kawaguchi + */ +public abstract class UISample implements ExtensionPoint, Action, Describable { + public String getIconFileName() { + return "symbol-sample"; + } + + public String getUrlName() { + return getClass().getSimpleName(); + } + + /** + * Default display name. + */ + public String getDisplayName() { + return getClass().getSimpleName(); + } + + public UISampleDescriptor getDescriptor() { + return (UISampleDescriptor) Jenkins.get().getDescriptorOrDie(getClass()); + } + + public static List getAll() { + return new ArrayList<>(Jenkins.get().getExtensionList(UISample.class)); + } +} diff --git a/src/main/java/jenkins/plugins/ui_samples/UISampleDescriptor.java b/src/main/java/io/jenkins/plugins/designlibrary/UISampleDescriptor.java similarity index 77% rename from src/main/java/jenkins/plugins/ui_samples/UISampleDescriptor.java rename to src/main/java/io/jenkins/plugins/designlibrary/UISampleDescriptor.java index e6805b94..a1fbb2bb 100644 --- a/src/main/java/jenkins/plugins/ui_samples/UISampleDescriptor.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/UISampleDescriptor.java @@ -1,4 +1,4 @@ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.model.Descriptor; diff --git a/src/main/java/jenkins/plugins/ui_samples/FormFieldValidationWithContext.java b/src/main/java/io/jenkins/plugins/designlibrary/Validation.java similarity index 85% rename from src/main/java/jenkins/plugins/ui_samples/FormFieldValidationWithContext.java rename to src/main/java/io/jenkins/plugins/designlibrary/Validation.java index 4b76988a..82645596 100644 --- a/src/main/java/jenkins/plugins/ui_samples/FormFieldValidationWithContext.java +++ b/src/main/java/io/jenkins/plugins/designlibrary/Validation.java @@ -1,4 +1,4 @@ -package jenkins.plugins.ui_samples; +package io.jenkins.plugins.designlibrary; import hudson.Extension; import hudson.RelativePath; @@ -18,37 +18,29 @@ * @author Kohsuke Kawaguchi */ @Extension -public class FormFieldValidationWithContext extends UISample { +public class Validation extends UISample { + @Override + public String getIconFileName() { + return "symbol-validation"; + } + private List states = new ArrayList(Arrays.asList( new State("California",new City("Sacramento"), Arrays.asList(new City("San Francisco"),new City("Los Angeles"))), new State("New York",new City("New York"), Arrays.asList(new City("Albany"),new City("Ithaca"))) )); - public FormFieldValidationWithContext() { + public Validation() { } @DataBoundConstructor - public FormFieldValidationWithContext(List states) { + public Validation(List states) { this.states = states; } - @Override - public String getDescription() { - return "How to access values of the nearby input fields when you do form field validation"; - } - public List getStates() { return states; } - @Override - public List getSourceFiles() { - List r = super.getSourceFiles(); - r.add(new SourceFile("City/config.groovy")); - r.add(new SourceFile("State/config.groovy")); - return r; - } - public static class State extends AbstractDescribableImpl { private final String name; private final City capital; @@ -85,6 +77,9 @@ public FormValidation doCheckName(@QueryParameter String value, so this matches the current city name entered as the capital of this state */ + if (name == null) { + return FormValidation.ok(); + } return FormValidation.ok("Are you sure " + name + " is a capital of " + value + "?"); } diff --git a/src/main/java/jenkins/plugins/ui_samples/CopyButton.java b/src/main/java/jenkins/plugins/ui_samples/CopyButton.java deleted file mode 100644 index 6a0075ed..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/CopyButton.java +++ /dev/null @@ -1,29 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; - -import java.util.Arrays; -import java.util.List; - -/** - * @author Kohsuke Kawaguchi - */ -@Extension -public class CopyButton extends UISample { - @Override - public String getDescription() { - return "A small button to copy text into a clipboard"; - } - - public List getSourceFiles() { - // TODO: generate this from index - return Arrays.asList( - new SourceFile("index.groovy")); - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - } -} - - diff --git a/src/main/java/jenkins/plugins/ui_samples/DynamicComboBox.java b/src/main/java/jenkins/plugins/ui_samples/DynamicComboBox.java deleted file mode 100644 index edb72122..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/DynamicComboBox.java +++ /dev/null @@ -1,64 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; -import hudson.util.ComboBoxModel; -import hudson.util.ListBoxModel; -import org.kohsuke.stapler.QueryParameter; - -/** - * Combo box that changes the contents based on the values of other controls. - * - * @author Kohsuke Kawaguchi - */ -@Extension -public class DynamicComboBox extends UISample { - - @Override - public String getDescription() { - return "Updates the contents of a combo box control dynamically based on selections of other controls"; - } - - // these getter methods should return the current value, which form the initial selection. - - public String getAlbum() { - return "3"; - } - - public String getTitle() { - return "Rocker"; - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - /** - * This method determines the values of the album drop-down list box. - */ - public ListBoxModel doFillAlbumItems() { - ListBoxModel m = new ListBoxModel(); - m.add("Yellow Submarine","1"); - m.add("Abbey Road","2"); - m.add("Let It Be","3"); - return m; - } - - /** - * This method determines the values of the song title combo box. - * Note that it takes the album information as a parameter, so the contents - * of the combo box changes depending on the currently selected album. - */ - public ComboBoxModel doFillTitleItems(@QueryParameter int album) { - switch (album) { - case 1: - return new ComboBoxModel("Yellow Submarine","Only a Northern Song","All You Need Is Love"); - case 2: - return new ComboBoxModel("Come Together","Something","I Want You"); - case 3: - return new ComboBoxModel("The One After 909","Rocker","Get Back"); - default: - // if no value is selected in the album, we'll get 0 - return new ComboBoxModel(); - } - } - - } -} \ No newline at end of file diff --git a/src/main/java/jenkins/plugins/ui_samples/DynamicDropDownListBox.java b/src/main/java/jenkins/plugins/ui_samples/DynamicDropDownListBox.java deleted file mode 100644 index 73823869..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/DynamicDropDownListBox.java +++ /dev/null @@ -1,54 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; -import hudson.util.ListBoxModel; -import org.kohsuke.stapler.QueryParameter; - -import static java.util.Arrays.asList; - -/** - * Example of a dynamic drop-down list box that changes the contents dynamically based on the values of other controls. - * - * @author Kohsuke Kawaguchi - */ -@Extension -public class DynamicDropDownListBox extends UISample { - - @Override - public String getDescription() { - return "Updates the contents of a <select> control dynamically based on selections of other controls"; - } - - // these getter methods should return the current value, which form the initial selection. - - public String getCountry() { - return "USA"; - } - - public String getState() { - return "USA:B"; - } - - public String getCity() { - return "USA:B:Z"; - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - public ListBoxModel doFillStateItems(@QueryParameter String country) { - ListBoxModel m = new ListBoxModel(); - for (String s : asList("A","B","C")) - m.add(String.format("State %s in %s", s, country), - country+':'+s); - return m; - } - - public ListBoxModel doFillCityItems(@QueryParameter String country, @QueryParameter String state) { - ListBoxModel m = new ListBoxModel(); - for (String s : asList("X","Y","Z")) - m.add(String.format("City %s in %s %s", s, state, country), - state+':'+s); - return m; - } - } -} diff --git a/src/main/java/jenkins/plugins/ui_samples/InpageNavigationWithBreadcrumb.java b/src/main/java/jenkins/plugins/ui_samples/InpageNavigationWithBreadcrumb.java deleted file mode 100644 index 1c20d7fe..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/InpageNavigationWithBreadcrumb.java +++ /dev/null @@ -1,30 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; - -import java.util.Arrays; -import java.util.List; - -/** - * @author Kohsuke Kawaguchi - */ -@Extension -public class InpageNavigationWithBreadcrumb extends UISample { - @Override - public String getDescription() { - return "Adds in-page navigation with extra breadcrumb"; - } - - public List getSourceFiles() { - // TODO: generate this from index - return Arrays.asList( - new SourceFile("index.groovy"), - new SourceFile("header.groovy")); - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - } -} - - diff --git a/src/main/java/jenkins/plugins/ui_samples/ModularizeViewScript.java b/src/main/java/jenkins/plugins/ui_samples/ModularizeViewScript.java deleted file mode 100644 index 36eca31e..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/ModularizeViewScript.java +++ /dev/null @@ -1,28 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; - -import java.util.Arrays; -import java.util.List; - -/** - * Define portions of view fragments in separate methods/classes to improve reuse. - * - * @author Kohsuke Kawaguchi - */ -@Extension -public class ModularizeViewScript extends UISample { - @Override - public String getDescription() { - return "Define portions of view fragments in separate methods/classes to improve reuse"; - } - - public List getSourceFiles() { - // TODO: generate this from index - return Arrays.asList(new SourceFile("index.groovy")); - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - } -} diff --git a/src/main/java/jenkins/plugins/ui_samples/NotificationBar.java b/src/main/java/jenkins/plugins/ui_samples/NotificationBar.java deleted file mode 100644 index cf81df11..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/NotificationBar.java +++ /dev/null @@ -1,29 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; - -import java.util.Arrays; -import java.util.List; - -/** - * @author Kohsuke Kawaguchi - */ -@Extension -public class NotificationBar extends UISample { - @Override - public String getDescription() { - return "Notification bar shows a transient message on the top of the page"; - } - - public List getSourceFiles() { - // TODO: generate this from index - return Arrays.asList( - new SourceFile("index.groovy")); - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - } -} - - diff --git a/src/main/java/jenkins/plugins/ui_samples/ProgressBar.java b/src/main/java/jenkins/plugins/ui_samples/ProgressBar.java deleted file mode 100644 index 49b7094e..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/ProgressBar.java +++ /dev/null @@ -1,29 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; - -import java.util.Arrays; -import java.util.List; - -/** - * @author Kohsuke Kawaguchi - */ -@Extension -public class ProgressBar extends UISample { - @Override - public String getDescription() { - return "Shows you how to use the progress bar widget that's used in the executor view and other places"; - } - - public List getSourceFiles() { - // TODO: generate this from index - return Arrays.asList( - // new SourceFile(getClass().getSimpleName() + ".java"), // nothing interesting in the Java source file - new SourceFile("index.groovy")); - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - } -} - diff --git a/src/main/java/jenkins/plugins/ui_samples/SyntaxHighlightedTextArea.java b/src/main/java/jenkins/plugins/ui_samples/SyntaxHighlightedTextArea.java deleted file mode 100644 index 514d5724..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/SyntaxHighlightedTextArea.java +++ /dev/null @@ -1,29 +0,0 @@ -package jenkins.plugins.ui_samples; - -import hudson.Extension; - -import java.util.Arrays; -import java.util.List; - -/** - * Syntax-highlighted text area (powered by CodeMirror). - * - * @author Kohsuke Kawaguchi - */ -@Extension -public class SyntaxHighlightedTextArea extends UISample { - @Override - public String getDescription() { - return "Syntax-highlighted text area powered by CodeMirror"; - } - - public List getSourceFiles() { - // TODO: generate this from index - return Arrays.asList(new SourceFile(getClass().getSimpleName() + ".java"), - new SourceFile("index.groovy")); - } - - @Extension - public static final class DescriptorImpl extends UISampleDescriptor { - } -} diff --git a/src/main/java/jenkins/plugins/ui_samples/UISample.java b/src/main/java/jenkins/plugins/ui_samples/UISample.java deleted file mode 100644 index 5ba7bae9..00000000 --- a/src/main/java/jenkins/plugins/ui_samples/UISample.java +++ /dev/null @@ -1,135 +0,0 @@ -package jenkins.plugins.ui_samples; - -import static org.apache.commons.io.IOUtils.copy; -import hudson.ExtensionList; -import hudson.ExtensionPoint; -import hudson.model.Action; -import hudson.model.Describable; - -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import jenkins.model.Jenkins; - -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; - -/** - * @author Kohsuke Kawaguchi - */ -public abstract class UISample implements ExtensionPoint, Action, Describable { - public String getIconFileName() { - return "gear.png"; - } - - public String getUrlName() { - return getClass().getSimpleName(); - } - - /** - * Default display name. - */ - public String getDisplayName() { - return getClass().getSimpleName(); - } - - /** - * Source files associated with this sample. - */ - public List getSourceFiles() { - List r = new ArrayList(); - - r.add(new SourceFile(getClass().getSimpleName()+".java")); - for (String name : new String[]{"index.jelly","index.groovy"}) { - SourceFile s = new SourceFile(name); - if (s.resolve()!=null) - r.add(s); - } - return r; - } - - /** - * Binds {@link SourceFile}s into URL. - */ - public void doSourceFile(StaplerRequest req, StaplerResponse rsp) throws IOException { - String name = req.getRestOfPath().substring(1); // Remove leading / - for (SourceFile sf : getSourceFiles()) - if (sf.name.equals(name)) { - sf.doIndex(rsp); - return; - } - rsp.sendError(rsp.SC_NOT_FOUND); - } - - /** - * Returns a paragraph of natural text that describes this sample. - * Interpreted as HTML. - */ - public abstract String getDescription(); - - public UISampleDescriptor getDescriptor() { - return (UISampleDescriptor) Jenkins.getInstance().getDescriptorOrDie(getClass()); - } - - /** - * Returns all the registered {@link UISample}s. - */ - public static ExtensionList all() { - return Jenkins.getInstance().getExtensionList(UISample.class); - } - - public static List getGroovySamples() { - List r = new ArrayList(); - for (UISample uiSample : UISample.all()) { - for (SourceFile src : uiSample.getSourceFiles()) { - if (src.name.contains("groovy")) { - r.add(uiSample); - break; - } - } - } - return r; - } - - public static List getOtherSamples() { - List r = new ArrayList(); - OUTER: - for (UISample uiSample : UISample.all()) { - for (SourceFile src : uiSample.getSourceFiles()) { - if (src.name.contains("groovy")) { - continue OUTER; - } - } - r.add(uiSample); - } - return r; - } - - /** - * @author Kohsuke Kawaguchi - */ - public class SourceFile { - public final String name; - - public SourceFile(String name) { - this.name = name; - } - - public URL resolve() { - return UISample.this.getClass().getResource( - (name.endsWith(".jelly") || name.endsWith(".groovy")) ? UISample.this.getClass().getSimpleName()+"/"+name : name); - } - - /** - * Serves this source file. - */ - public void doIndex(StaplerResponse rsp) throws IOException { - rsp.setContentType("text/plain;charset=UTF-8"); - copy(resolve().openStream(),rsp.getOutputStream()); - } - } - -} diff --git a/src/main/resources/images/symbols/app-bar.svg b/src/main/resources/images/symbols/app-bar.svg new file mode 100644 index 00000000..3f9eca3e --- /dev/null +++ b/src/main/resources/images/symbols/app-bar.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/buttons.svg b/src/main/resources/images/symbols/buttons.svg new file mode 100644 index 00000000..9d7e8116 --- /dev/null +++ b/src/main/resources/images/symbols/buttons.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/checkboxes.svg b/src/main/resources/images/symbols/checkboxes.svg new file mode 100644 index 00000000..02138582 --- /dev/null +++ b/src/main/resources/images/symbols/checkboxes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/colors.svg b/src/main/resources/images/symbols/colors.svg new file mode 100644 index 00000000..2a3e012a --- /dev/null +++ b/src/main/resources/images/symbols/colors.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/design-library.svg b/src/main/resources/images/symbols/design-library.svg new file mode 100644 index 00000000..ce8be897 --- /dev/null +++ b/src/main/resources/images/symbols/design-library.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/github.svg b/src/main/resources/images/symbols/github.svg new file mode 100644 index 00000000..108c6d4b --- /dev/null +++ b/src/main/resources/images/symbols/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/gitter.svg b/src/main/resources/images/symbols/gitter.svg new file mode 100644 index 00000000..8e38a960 --- /dev/null +++ b/src/main/resources/images/symbols/gitter.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/home.svg b/src/main/resources/images/symbols/home.svg new file mode 100644 index 00000000..522a4ea3 --- /dev/null +++ b/src/main/resources/images/symbols/home.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/links.svg b/src/main/resources/images/symbols/links.svg new file mode 100644 index 00000000..ddc42d1f --- /dev/null +++ b/src/main/resources/images/symbols/links.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/notifications.svg b/src/main/resources/images/symbols/notifications.svg new file mode 100644 index 00000000..bfd6e1f8 --- /dev/null +++ b/src/main/resources/images/symbols/notifications.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/progress.svg b/src/main/resources/images/symbols/progress.svg new file mode 100644 index 00000000..c7ce7d89 --- /dev/null +++ b/src/main/resources/images/symbols/progress.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/radios.svg b/src/main/resources/images/symbols/radios.svg new file mode 100644 index 00000000..f4f003c0 --- /dev/null +++ b/src/main/resources/images/symbols/radios.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/sample.svg b/src/main/resources/images/symbols/sample.svg new file mode 100644 index 00000000..6c0a63a9 --- /dev/null +++ b/src/main/resources/images/symbols/sample.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/select.svg b/src/main/resources/images/symbols/select.svg new file mode 100644 index 00000000..a42dd94e --- /dev/null +++ b/src/main/resources/images/symbols/select.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/share.svg b/src/main/resources/images/symbols/share.svg new file mode 100644 index 00000000..0d09ae91 --- /dev/null +++ b/src/main/resources/images/symbols/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/spacing.svg b/src/main/resources/images/symbols/spacing.svg new file mode 100644 index 00000000..c49a6dce --- /dev/null +++ b/src/main/resources/images/symbols/spacing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/sunburst.svg b/src/main/resources/images/symbols/sunburst.svg new file mode 100644 index 00000000..457757a3 --- /dev/null +++ b/src/main/resources/images/symbols/sunburst.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/symbols.svg b/src/main/resources/images/symbols/symbols.svg new file mode 100644 index 00000000..8ac7e9b9 --- /dev/null +++ b/src/main/resources/images/symbols/symbols.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/table.svg b/src/main/resources/images/symbols/table.svg new file mode 100644 index 00000000..de656fb8 --- /dev/null +++ b/src/main/resources/images/symbols/table.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/textbox.svg b/src/main/resources/images/symbols/textbox.svg new file mode 100644 index 00000000..f6ed3dcb --- /dev/null +++ b/src/main/resources/images/symbols/textbox.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/tooltips.svg b/src/main/resources/images/symbols/tooltips.svg new file mode 100644 index 00000000..980a7496 --- /dev/null +++ b/src/main/resources/images/symbols/tooltips.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/symbols/validation.svg b/src/main/resources/images/symbols/validation.svg new file mode 100644 index 00000000..ce838420 --- /dev/null +++ b/src/main/resources/images/symbols/validation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/images/symbols/youtube.svg b/src/main/resources/images/symbols/youtube.svg new file mode 100644 index 00000000..dde1b073 --- /dev/null +++ b/src/main/resources/images/symbols/youtube.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/AppBar/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/AppBar/index.jelly new file mode 100644 index 00000000..b2cc4e11 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/AppBar/index.jelly @@ -0,0 +1,29 @@ + + + +
+
+
+

Page title

+
+
+ + + + +
+
+
+
+      
+    
+ +

+ App bars provide the page heading as well as important actions about the current page. + It must be included before the l:main-panel. +

+
+
diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Buttons/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Buttons/index.jelly new file mode 100644 index 00000000..80435b8f --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Buttons/index.jelly @@ -0,0 +1,118 @@ + + + + + +

+ Buttons are created with the jenkins-button CSS class. + There are a number of different styles that can be added by adding another class alongside, such as + jenkins-button--primary. Styling links as buttons is also supported. +

+ +

Each form should have only one primary button. Most other buttons should just be the default one. + Destructive buttons should be used when something will be deleted or not easily undone. + Generally these should have a confirmation page.

+ + + +
+ +
+
+      
+        
+      
+    
+ +
+ +
+
+      
+        
+      
+    
+ +
+ +
+
+      
+        
+      
+    
+ +
+ +
+
+      
+        
+      
+    
+ +
+ +
+
+      
+    
+ +

Copy button

+

A small button to copy text into a clipboard

+
+ +
+
+      
+    
+ +

+ The tag creates a small button that allows users to paste text into the clipboard. + The tag requires two mandatory attributes: +

+
    +
  • text - the text to be copied into the clipboard.
  • +
  • message - message to be displayed upon the successful copying into the clipboard
  • +
+ +

Help button

+
+ +
+
+      
+    
+ +

+ The tag creates a custom button to get help about a page. + The button should always be in the top right of a page, last in the row of components. + The tag has one mandatory attribute: +

+
    +
  • href - the page to navigate to on click
  • +
+
+
diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Checkboxes/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Checkboxes/index.jelly new file mode 100644 index 00000000..54c7580c --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Checkboxes/index.jelly @@ -0,0 +1,48 @@ + + + + + +

Checkboxes are simple to use in Jenkins with the jelly tag.

+ +

Example parameters:

+
    +
  • id (optional) - Sets an id for the input, useful for UI testing, one will be generated for you otherwise. Avoid using in repeatable elements as you will end up with duplicate IDs
  • +
  • default (optional) - Can be used to set the default to true, not generally recommended as this won't affect configuration as code users, + only use if you want to set a new default when people configure the plugin.
  • +
  • field - The field of the descriptor to bind to, must be of type boolean
  • +
  • title - The label for the checkbox.
  • +
+ +

There are more parameters available but they are generally not needed and should be avoided.

+ +
+ +
+
+      
+    
+
+
diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Colors/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Colors/index.jelly new file mode 100644 index 00000000..06dfa59a --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Colors/index.jelly @@ -0,0 +1,43 @@ + + + + + +
    + +
  1. +

    var(--${color})

    +
  2. +
    +
+ +

Tips

+
    +
  • Use color to draw attention to important parts of your interface
  • +
  • Color shouldn't be the only way a piece of information is conveyed, use text or symbols along with it
  • +
  • It's best to use colors provided by Jenkins as they will automatically adapt to the user's theme
  • +
+
+
diff --git a/src/main/resources/jenkins/plugins/ui_samples/DynamicComboBox/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/DynamicDropDownListBox/index.jelly similarity index 75% rename from src/main/resources/jenkins/plugins/ui_samples/DynamicComboBox/index.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/DynamicDropDownListBox/index.jelly index 0d66eedb..e69d17ea 100644 --- a/src/main/resources/jenkins/plugins/ui_samples/DynamicComboBox/index.jelly +++ b/src/main/resources/io/jenkins/plugins/designlibrary/DynamicDropDownListBox/index.jelly @@ -22,17 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - - -
- - - - - - - -
-
+ + diff --git a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/ChoiceEntry/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/ChoiceEntry/config.jelly similarity index 100% rename from src/main/resources/jenkins/plugins/ui_samples/HeteroList/ChoiceEntry/config.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/ChoiceEntry/config.jelly diff --git a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/Config/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/Config/config.jelly similarity index 100% rename from src/main/resources/jenkins/plugins/ui_samples/HeteroList/Config/config.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/Config/config.jelly diff --git a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/HeteroRadioEntry/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/HeteroRadioEntry/config.jelly similarity index 100% rename from src/main/resources/jenkins/plugins/ui_samples/HeteroList/HeteroRadioEntry/config.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/HeteroRadioEntry/config.jelly diff --git a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/SimpleEntry/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/SimpleEntry/config.jelly similarity index 100% rename from src/main/resources/jenkins/plugins/ui_samples/HeteroList/SimpleEntry/config.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/SimpleEntry/config.jelly diff --git a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/configure.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/configure.jelly similarity index 100% rename from src/main/resources/jenkins/plugins/ui_samples/HeteroList/configure.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/configure.jelly diff --git a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/index.jelly similarity index 80% rename from src/main/resources/jenkins/plugins/ui_samples/HeteroList/index.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/index.jelly index 2ed9ee4a..66a07d6b 100644 --- a/src/main/resources/jenkins/plugins/ui_samples/HeteroList/index.jelly +++ b/src/main/resources/io/jenkins/plugins/designlibrary/HeteroList/index.jelly @@ -26,6 +26,10 @@ THE SOFTWARE. +

+ + Show a heterogeneous list of subitems with different data bindings for radio buttons and checkboxes +

Configure me!

@@ -34,7 +38,9 @@ THE SOFTWARE. Current configuration:

-                ${it.configFile.asString()}
+              
+                
+              
             
diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb/header.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb/header.jelly new file mode 100644 index 00000000..50a194aa --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb/header.jelly @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb/index.jelly new file mode 100644 index 00000000..7ce5aa22 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/InpageNavigationWithBreadcrumb/index.jelly @@ -0,0 +1,30 @@ + + + +

You can add arbitrary additional items to the breadcrumb bar (see above), and associate menus with them. + This mechanism is convenient for adding anchors to a large page and provide quick access to the key parts. + A very typical place where you want to do this is in the configuration page. + There's a f:breadcrumb-config-outline tag specifically for this use case, + which parses f:section and use that to build the context menu. + See the freestyle job configuration page for an example of using this tag. +

+ + +

This is section 1

+
+ + +

This is section 1

+
+ + + +
+
diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/JavaScriptProxy/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/JavaScriptProxy/index.jelly new file mode 100644 index 00000000..b43d3cc2 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/JavaScriptProxy/index.jelly @@ -0,0 +1,104 @@ + + + + +

+ In Jenkins, you can export arbitrary server-side Java object to JavaScript via a proxy, + then invoke their methods from JavaScript. + In this sample, we call a method on the server to increment a counter. This object is a singleton, + so you'll see the same counter value across all the browsers. +

+ +

+ To expose a method of a Java class to JavaScript proxy, annotate the method with @JavaScriptMethod. + For security reasons, only public methods on public classes annotated with this annotation are invokable from browsers: +

+ +
+      
+    
+ +

+ Then from Jelly scripts, use st:bind tag to export a Java object into a proxy. + The "value" attribute evaluates to a server-side Java object to be exported, and the tag produces a JavaScript expression that creates a proxy. + + In the example below, we are pretending that the JEXL expression evaluates to some instance of Foo. +

+ +
+      
+    
+ + + +
+ + +

Invoking method

+

+ As you can see above, one can invoke methods on the proxy created by the st:bind tag. + The JavaScript method takes the arguments that the Java method takes, + then it can optionally take a function as an additional parameter, which is used as a callback method when the return value is available. + The callback method receives an Ajax.Response object. +

+ +

+ If the Java method returns an object value (such as int, String, Collection, Object[], JSONObject, etc.), + you can use the responseObject() method to evaluate the response into a JavaScript object and use it. + If the Java method renders more complex HTTP response (for example by writing directly to StaplerResponse + or returning an HttpResponse), + JavaScript can use other Ajax.Response methods to access the full HTTP response. +

+ +

+ The method call uses XmlHttpRequest underneath, and it gets eventually routed to the corresponding method call on the exact instance that was exported. +

+

Tips

+ +

Parameters of the server Java method

+

+ The Java method can define arbitrary number of parameters for JavaScript. + Each parameter is converted from JSON to Java via StaplerRequest.bindJSON, so aside from primitive Java data types + and typeless JSONObject / JSONArray, you can use Stapler databinding to accept typed structured data. +

+ +

+ After defining the parameters from JavaScript, you can additionally define parameters that are injectable by Stapler, + such as StaplerRequest or StaplerResponse. +

+ +

Exporting null

+ +

+ If the value attribute of a <st:bind> tag evaluates to null, then the corresponding + JavaScript proxy will be null.

+ + diff --git a/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.groovy b/src/main/resources/io/jenkins/plugins/designlibrary/Links/index.groovy similarity index 94% rename from src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.groovy rename to src/main/resources/io/jenkins/plugins/designlibrary/Links/index.groovy index 8326b55a..dfcf5056 100644 --- a/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.groovy +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Links/index.groovy @@ -1,4 +1,4 @@ -package jenkins.plugins.ui_samples.NavigationContextMenu; +package io.jenkins.plugins.designlibrary.Links; import lib.JenkinsTagLib diff --git a/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.properties b/src/main/resources/io/jenkins/plugins/designlibrary/Links/index.properties similarity index 75% rename from src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.properties rename to src/main/resources/io/jenkins/plugins/designlibrary/Links/index.properties index 5af5fd31..5afca5ed 100644 --- a/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.properties +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Links/index.properties @@ -1,16 +1,16 @@ -blurb=

Jenkins consists of a large and complex graph of domain objects (ModelObject), where each node in the graph is a web page and edges are hyperlinks. \ +blurb=

Jenkins consists of a large and complex graph of domain objects (ModelObject), where each node in the graph is a web page and edges are hyperlinks. \ To help users navigate quickly on this graph, Jenkins provides a mechanism to attach context menus to model objects, \ which can be used to hop multiple edges without going through individual hyperlinks. -blurb.define=

To define a context menu on ModelObject, implement ModelObjectWithContextMenu. \ +blurb.define=

To define a context menu on ModelObject, implement ModelObjectWithContextMenu. \ See the example for how to implement this method. -blurb.breadcrumb=

Implementing ModelObjectWithContextMenu is sufficient for the core to show the context menu \ +blurb.breadcrumb=

Implementing ModelObjectWithContextMenu is sufficient for the core to show the context menu \ for your model object in the breadcrumb. Hover your mouse over the breadcrumb of this page to see context menu \ associated with this sample. \

\ In addition, implementing \ - ModelObjectWithChildren \ + ModelObjectWithChildren \ enables you to show children of your model object in the breadcrumb when you click the \u2018>\u2019 icon that separates \ breadcrumb items. diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Notifications/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Notifications/index.jelly new file mode 100644 index 00000000..79a400df --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Notifications/index.jelly @@ -0,0 +1,38 @@ + + + +

+ Notification bar is a component with a JavaScript API, that you can use to show a message that disappears in a few seconds. + It is typically used to provide feedback for asynchronous operations. +

+ +

To show a notification bar, use:

+
+      notificationBar.show('message')
+    
+ +

+ +

+ +

A notification bar will auto-hide itself, but you can programmatically hide it with:

+
+      notificationBar.hide()
+    
+

+ +

For typical notifications, there are several pre-defined option set available as constants that you can use:

+
+      notificationBar.show(msg, notificationBar.OK)
+    
+

+ +

+

+ +

+

+ +

+ + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Progress/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Progress/index.jelly new file mode 100644 index 00000000..91a399be --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Progress/index.jelly @@ -0,0 +1,58 @@ + + + +

There are two components used to indicate progress to the user. Spinner is used + to show the user something is happening. Progress animation is used to show something is not complete (such as a log).

+
+ +
+
+      
+    
+ +
+ +
+
+      
+    
+ +
+ +
+
+      
+    
+ +

Progressive rendering

+

Shows how to do a complex operation on the server while displaying its progress, before displaying to the user

+ +
+ + + + +
+ + +

Factors of ${number}:

+ +
    + + +
    +      
    +    
    + + + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Radios/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Radios/index.jelly new file mode 100644 index 00000000..d8b49d2a --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Radios/index.jelly @@ -0,0 +1,48 @@ + + + + + +
    + +
    +
    +      
    +    
    +
    +      
    +    
    + +

    Boolean radio

    + +
    + +
    + +
    +      
    +    
    +
    +
    diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Root/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Root/index.jelly new file mode 100644 index 00000000..2d09e422 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Root/index.jelly @@ -0,0 +1,72 @@ + + + + + + + + + +
    +

    Jenkins

    +

    Design
    Library

    +
    +
    + + Jenkins illustration +
    +

    Welcome to Jenkins Design Library

    +

    + Design Library makes it easy for developers to build complex and consistent interfaces using Jenkins UI components +

    +
    +

    Topics for modernising your interface

    + +

    Get involved

    + + +
    +
    +
    +
    diff --git a/src/main/resources/jenkins/plugins/ui_samples/DropdownList/Apple/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Select/Apple/config.jelly similarity index 100% rename from src/main/resources/jenkins/plugins/ui_samples/DropdownList/Apple/config.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/Select/Apple/config.jelly diff --git a/src/main/resources/jenkins/plugins/ui_samples/DropdownList/Banana/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Select/Banana/config.jelly similarity index 99% rename from src/main/resources/jenkins/plugins/ui_samples/DropdownList/Banana/config.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/Select/Banana/config.jelly index 8079626f..3b4a7f17 100644 --- a/src/main/resources/jenkins/plugins/ui_samples/DropdownList/Banana/config.jelly +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Select/Banana/config.jelly @@ -24,6 +24,6 @@ THE SOFTWARE. - + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Select/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Select/index.jelly new file mode 100644 index 00000000..b2d26292 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Select/index.jelly @@ -0,0 +1,84 @@ + + + + +

    There are a couple of ways to create a dropdown in Jenkins.

    + +

    You can use dropdownDescriptorSelector to create a fully data-bound form and the option to include a + config page for the descriptor by creating a file called config.jelly. +

    +
    + +
    +        
    +        
    +      
    + + + + +

    If you want a simpler select to be rendered you can use the f:select + jelly tag and create a doFillFieldNameItems method in the descriptor.

    + + + + + + config.jelly: +
    + + Java source code: +
    + +

    Dynamic select

    + +

    + Updates the contents of a 'select' control dynamically based on selections of other controls. +

    + +
    + + + + + + + + + +
    + + config.jelly: +
    +      
    +    
    + Sample.java: + +
    +      
    +    
    + +
    +
    diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Spacing/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Spacing/index.jelly new file mode 100644 index 00000000..e5187c2b --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Spacing/index.jelly @@ -0,0 +1,34 @@ + + + +

    Spacing override classes

    + +

    Jenkins features a range of spacing helper classes to enable you to set the margin and padding for your element.

    + +

    This is done through the jenkins-!-margin-* and jenkins-!-padding-* classes. The * is the spacing modifier, it ranges from 0 for no spacing to 5 for maximum spacing.

    + +

    You can use position modifiers if you only want to impact one side, for example, jenkins-!-padding-left-3.

    + +

    Examples

    + +
    +

    jenkins-!-margin-bottom-5

    +
    +

    jenkins-!-margin-bottom-4

    +
    +

    jenkins-!-margin-bottom-3

    +
    +

    jenkins-!-margin-bottom-2

    +
    +

    jenkins-!-margin-bottom-1

    +
    +

    jenkins-!-margin-bottom-0

    +
    + +
    +
    +

    jenkins-!-padding-5

    +
    +
    + + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Symbols/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Symbols/index.jelly new file mode 100644 index 00000000..e29690b4 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Symbols/index.jelly @@ -0,0 +1,65 @@ + + + +

    Jenkins Symbols are an extensive and consistent collection of icons for use in Jenkins and plugins. + Symbols are intended to be used everywhere a traditional icon would be used, such as in the sidebar, in buttons and in tables. + Symbols are scalable, support different weights and adapt to the user’s theme. +

    + +

    Symbols should be used to help a user recognise what a task does at a glance. This means they should be easily + recognisable and relevant to the task, e.g. a padlock for credentials. + Don't add symbols to headings, they are distracting, often look out of place and do nothing to help the user.

    + +

    Using Symbols

    +

    Using symbols in your view is simple. Use the existing icon component and set the src value to the symbol you want, prefixed with "symbol-".

    +

    + +

    +
    +      
    +    
    + +

    It’s possible to add alt text and custom classes to symbols, for example:

    +

    + +

    +
    +      
    +    
    + +

    Sizing of the symbol can be achieved by wrapping it in an element such as span + with a class of icon-size where size is one of:

    + +
      +
    • icon-sm
    • +
    • icon-md
    • +
    • icon-lg
    • +
    • icon-xlg
    • +
    + +
    +      
    +    
    + + +

    Custom Symbols

    +

    Add your symbol to:

    +
    {plugin-root}/src/main/resources/images/symbols
    + +

    Reference it with:

    +
    +      
    +    
    + + Make sure you replace the placeholder parameters: +
      +
    • symbolName - the file name of the symbol without the file extension (e.g. cloud)
    • +
    • yourArtifactId - the artifact ID of your plugin, or the one of the plugin you want to load the symbol from
    • +
    + +

    + ArtifactId can be found in your pom.xml for Maven plugins or as shortName in + build.gradle for Gradle plugins. +

    +
    +
    diff --git a/src/main/resources/jenkins/plugins/ui_samples/DynamicDropDownListBox/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Table/index.jelly similarity index 65% rename from src/main/resources/jenkins/plugins/ui_samples/DynamicDropDownListBox/index.jelly rename to src/main/resources/io/jenkins/plugins/designlibrary/Table/index.jelly index 73661216..9105b762 100644 --- a/src/main/resources/jenkins/plugins/ui_samples/DynamicDropDownListBox/index.jelly +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Table/index.jelly @@ -1,7 +1,7 @@ + - - -
    - - - - - - - - - - -
    -
    + + +

    Jenkins Tables are created by adding the .jenkins-table + CSS class.

    + + + +
    + +
    +      
    +    
    diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/TextBox/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/TextBox/index.jelly new file mode 100644 index 00000000..39183ced --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/TextBox/index.jelly @@ -0,0 +1,117 @@ + + + + +
    + + + +
    +
    +      
    +    
    + +

    Auto-completion

    +

    + Start typing a US state for autocomplete results to appear. +

    +
    + + + +
    +

    + Textboxes can feature auto-completion items by Stapler finds this method via the naming convention. +

    +
    +      
    +    
    +
    +      
    +    
    + +

    + There is a similar control to the autocomplete functionality of 'textbox' called combobox: +

    + +
    + + + +
    + + config.jelly: +
    +      
    +    
    + + SimpleCombobox.java: +
    +      
    +    
    + +

    Dynamic combobox

    +

    + Like many other fields combo-boxes can be updated dynamically based on other field values: +

    + + + + + + + + + config.jelly: +
    +      
    +    
    + + DynamicCombobox.java: +
    +      
    +    
    + + +

    Syntax-highlighted text

    + +

    CodeMirror can be used to turn ordinary text area into syntax-highlighted content-assistable text area

    + + + +
    +      
    +    
    + +

    + You will want to use f:textarea to pass more CodeMirror configuration if you are doing more + than displaying a groovy text editor. +

    + + + +
    +
    + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Tooltips/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Tooltips/index.jelly new file mode 100644 index 00000000..2cdb4025 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Tooltips/index.jelly @@ -0,0 +1,21 @@ + + + +
    + +
    +
    +      
    +    
    + +

    + Make sure that text is sanitized before displaying + it inside of html-tooltip as this + can lead to XSS attacks. Escape or avoid using it on user-controlled data like agent display names or descriptions. + See Preventing Cross-Site Scripting in Jelly views. +

    +
    +
    + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Validation/City/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Validation/City/config.jelly new file mode 100644 index 00000000..91ecd6d6 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Validation/City/config.jelly @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Validation/State/config.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Validation/State/config.jelly new file mode 100644 index 00000000..20077d28 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Validation/State/config.jelly @@ -0,0 +1,23 @@ + + + + + + + +
    + + + + + + +
    + +
    +
    +
    +
    +
    +
    +
    diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/Validation/index.jelly b/src/main/resources/io/jenkins/plugins/designlibrary/Validation/index.jelly new file mode 100644 index 00000000..541d0444 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/Validation/index.jelly @@ -0,0 +1,29 @@ + + + +

    Form field validation can access values of the nearby input controls, which is useful for performing complex context sensitive form validation. + The same technique can be also used for auto-completion, populating combobox/listbox, and so on. + The example below is a bit contrived, but all the input elements are named 'name' (for city name and state name), + and we use @RelativePath so that the validation of the state name refers to the capital name, + and the validation of the city name refers to the state name. +

    + +
    + + + +
    + +

    + To implement this you need to provide a doCheckXXX method, where XXX is the name of your field. + This should return a FormValidation object. +

    +
    +      
    +    
    +
    +      
    +    
    + +
    +
    diff --git a/src/main/resources/io/jenkins/plugins/designlibrary/preCode.js b/src/main/resources/io/jenkins/plugins/designlibrary/preCode.js new file mode 100644 index 00000000..175d0b49 --- /dev/null +++ b/src/main/resources/io/jenkins/plugins/designlibrary/preCode.js @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2014, Leon Sorokin + * All rights reserved. (MIT Licensed) + * + * preCode.js - painkiller for
     &