From 2f0eefbe4cdaf988cd0ca27d33e11ce4f37bc3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zvonko=20Kutle=C5=A1a?= Date: Thu, 20 May 2021 15:55:41 +0200 Subject: [PATCH] Added dashboard view option. Added vertical view dashboard. --- .../EnvDashboardView.java | 25 +- .../EnvDashboardView/configure-entries.jelly | 7 + .../EnvDashboardView/help-viewOption.html | 3 + .../EnvDashboardView/index.jelly | 5 +- .../EnvDashboardView/main-vertical.jelly | 315 ++++++++++++++++++ 5 files changed, 353 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/help-viewOption.html create mode 100644 src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/main-vertical.jelly diff --git a/src/main/java/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView.java b/src/main/java/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView.java index 6a7978bc..07e808c0 100644 --- a/src/main/java/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView.java +++ b/src/main/java/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView.java @@ -47,14 +47,17 @@ public class EnvDashboardView extends View { private String compOrder = null; private String deployHistory = null; + + private String viewOption = null; @DataBoundConstructor public EnvDashboardView(final String name, final String envOrder, final String compOrder, - final String deployHistory) { + final String deployHistory, final String viewOption) { super(name, Hudson.getInstance()); this.envOrder = envOrder; this.compOrder = compOrder; this.deployHistory = deployHistory; + this.viewOption = viewOption; } static { @@ -113,12 +116,23 @@ public Item doCreateItem(StaplerRequest req, StaplerResponse rsp) throws IOExcep return Hudson.getInstance().doCreateItem(req, rsp); } + /** + * Overridden for better type safety. + * If your plugin doesn't really define any property on Descriptor, + * you don't have to do this. + */ + @Override + public DescriptorImpl getDescriptor() { + return (DescriptorImpl)super.getDescriptor(); + } + @Extension public static final class DescriptorImpl extends ViewDescriptor { private String envOrder; private String compOrder; private String deployHistory; + private String viewOption; /** * descriptor impl constructor This empty constructor is required for @@ -233,6 +247,7 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc envOrder = formData.getString("envOrder"); compOrder = formData.getString("compOrder"); deployHistory = formData.getString("deployHistory"); + viewOption = formData.getString("viewOption"); save(); return super.configure(req, formData); } @@ -519,6 +534,14 @@ public void setDeployHistory(final String deployHistory) { this.deployHistory = deployHistory; } + public String getViewOption() { + return viewOption; + } + + public void setViewOption(final String viewOption) { + this.viewOption = viewOption; + } + @Override public boolean contains(TopLevelItem topLevelItem) { return false; diff --git a/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/configure-entries.jelly b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/configure-entries.jelly index d5afc556..b489cbfd 100644 --- a/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/configure-entries.jelly +++ b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/configure-entries.jelly @@ -12,6 +12,13 @@ + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/help-viewOption.html b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/help-viewOption.html new file mode 100644 index 00000000..06f0602e --- /dev/null +++ b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/help-viewOption.html @@ -0,0 +1,3 @@ +
+ You can choose dashboard view. +
\ No newline at end of file diff --git a/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/index.jelly b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/index.jelly index ec0eb0b0..05a16466 100644 --- a/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/index.jelly +++ b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/index.jelly @@ -7,7 +7,10 @@ ConfigureDelete

- + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/main-vertical.jelly b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/main-vertical.jelly new file mode 100644 index 00000000..e8c37928 --- /dev/null +++ b/src/main/resources/org/jenkinsci/plugins/environmentdashboard/EnvDashboardView/main-vertical.jelly @@ -0,0 +1,315 @@ + + + + + + + + +
+ + + +
+

Hi, there!

+

You possibly haven't set up any jobs to use the Dashboard. Or if you have, the job hasn't run atleast once. You can configure the jobs by using the 'Details for Environment Dashboard' checkbox.

+
+ +
+ + + + + + + + + +
+
+ [X] +
+

${envsHeader}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ComponentBuildPackageLast Update
${deployment.get("compName")} + + ${deployment.get("buildNum")} + + + + + + + + + + + ? + + + + ${deployment.get("packageName")} + + ${it.getNiceTimeStamp(time)} +
+
+ + + + +
+
+ [X] +
+

${comp + " | " + envsHeader}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BuildPackage${column.substring(0, 1).toUpperCase() + column.substring(1)}StatusTime
+ ${deployment.get('buildNum')} + + ${deployment.get('packageName')} + + ${deployment.get(column.toLowerCase())} + + + + + + + + + + + + + ? + + + + ${it.getNiceTimeStamp(deployment.get('created_at'))} +
+
+
+ + + + +
+
+ [X] +
+

${comp} History

+ + + + + + + + + + + + + + + + + + + + + + +
EnvBuildStatusPackageTime
+ ${deployment.get('envName')} + + ${deployment.get('buildNum')} + + + + + + + + + + + + + ? + + + + ${deployment.get('packageName')} + + ${it.getNiceTimeStamp(deployment.get('created_at'))} +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ${envsHeader} +
Component nameBuild number
${comps} + + + ${deployment.get('buildNum')} + ${deployment.get('packageName')} + + + + + + + + + + + + ? + + + + + +
+
+
+
+