Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cleanup Jelly files & improve wording #58

Merged
merged 3 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/main/java/jenkinsci/plugins/influxdb/DescriptorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import java.util.concurrent.CopyOnWriteArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.CheckForNull;

import org.jenkinsci.Symbol;
import hudson.util.ListBoxModel;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest;

Expand All @@ -19,7 +18,7 @@
@Symbol("influxDbPublisher")
public final class DescriptorImpl extends BuildStepDescriptor<Publisher> implements ModelObject, java.io.Serializable {

private static final String DISPLAY_NAME = "Publish build data to InfluxDb target";
private static final String DISPLAY_NAME = "Publish build data to InfluxDB";
private List<Target> targets = new CopyOnWriteArrayList<>();

public DescriptorImpl() {
Expand Down Expand Up @@ -64,17 +63,19 @@ public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
}

@Override
public Publisher newInstance(@CheckForNull StaplerRequest req, @Nonnull JSONObject formData) {
InfluxDbPublisher publisher = new InfluxDbPublisher();
req.bindParameters(publisher, "publisherBinding.");
return publisher;
}

@Override
public boolean configure(StaplerRequest req, JSONObject formData) {
targets = req.bindJSONToList(Target.class, formData.get("currentTarget"));
targets.clear();
targets.addAll(req.bindJSONToList(Target.class, formData.get("targets")));
save();
return true;
}

public ListBoxModel doFillSelectedTargetItems() {
ListBoxModel model = new ListBoxModel();
for (Target target : targets) {
model.add(target.getDescription());
}
return model;
}
}
9 changes: 7 additions & 2 deletions src/main/java/jenkinsci/plugins/influxdb/models/Target.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jenkinsci.plugins.influxdb.models;

import com.google.common.base.Objects;
import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
Expand Down Expand Up @@ -130,8 +131,12 @@ public void setGlobalListenerFilter(String globalListenerFilter) {

@Override
public String toString() {
return "[url=" + this.url + ", description=" + this.description + ", username=" + this.username
+ ", password=*****, database=" + this.database + "]";
return Objects.toStringHelper(Target.class)
.add("description", description)
.add("url", url)
.add("username", username)
.add("database", database)
.toString();
}

@Extension
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<f:entry title="influxdb target">
<select class="setting-input" name="publisherBinding.selectedTarget" >
<j:forEach var="currentTarget" items="${descriptor.targets}">
<j:set var="targetDescription" value="${currentTarget.description}" />
<f:option selected="${targetDescription==instance.selectedTarget}" value="${targetDescription}">${currentTarget.description}</f:option>
</j:forEach>
</select>
</f:entry>

<f:section title="Advanced Settings">
<f:advanced>
<f:entry title="custom-prefix" field="customPrefix" >
<f:textbox name="publisherBinding.customPrefix" value="${publisherBinding.customPrefix}"/>
</f:entry>
<f:entry title="custom-project-name" field="customProjectName" >
<f:textbox name="publisherBinding.customProjectName" value="${publisherBinding.customProjectName}"/>
</f:entry>
<f:entry title="jenkins-env-parameter FieldSet" field="jenkinsEnvParameterField">
<f:textarea name="publisherBinding.jenkinsEnvParameterField" value="${publisherBinding.jenkinsEnvParameterField}"/>
</f:entry>
<f:entry title="jenkins-env-parameter TagSet" field="jenkinsEnvParameterTag">
<f:textarea name="publisherBinding.jenkinsEnvParameterTag" value="${publisherBinding.jenkinsEnvParameterTag}"/>
</f:entry>

<f:entry title="Replace dashes with underscore" field="replaceDashWithUnderscore" >
<f:checkbox name="publisherBinding.replaceDashWithUnderscore" checked="${publisherBinding.replaceDashWithUnderscore}" default="false" />
</f:entry>
</f:advanced>
</f:section>

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:entry title="InfluxDB Target" field="selectedTarget">
<f:select/>
</f:entry>
<f:advanced>
<f:entry title="Custom Prefix" field="customPrefix">
<f:textbox/>
</f:entry>
<f:entry title="Custom Project Name" field="customProjectName">
<f:textbox/>
</f:entry>
<f:entry title="Jenkins Environment Field Set" field="jenkinsEnvParameterField">
<f:textarea/>
</f:entry>
<f:entry title="Jenkins Environment Tag Set" field="jenkinsEnvParameterTag">
<f:textarea/>
</f:entry>
<f:entry title="Replace dashes with underscores" field="replaceDashWithUnderscore">
<f:checkbox default="false"/>
</f:entry>
</f:advanced>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -1,70 +1,49 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<f:section title="influxdb target">
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:section title="InfluxDB Targets">
<f:entry>

<f:repeatable
var="currentTarget"
items="${descriptor.targets}"
add="new influxdb target">

<table width="100%" >

<f:entry title="description">
<f:textbox name="targetBinding.description" value="${currentTarget.description}" />
</f:entry>

<f:entry title="url" field="url">
<f:textbox name="targetBinding.url" value="${currentTarget.url}" />
</f:entry>

<f:entry title="username" field="username">
<f:textbox name="targetBinding.username" value="${currentTarget.username}"/>
</f:entry>

<f:entry title="password" field="password">
<f:password name="targetBinding.password" value="${currentTarget.password}"/>
</f:entry>

<f:entry title="database" field="database" >
<f:textbox name="targetBinding.database" value="${currentTarget.database}" />
</f:entry>

<f:entry title="retentionPolicy" field="retentionPolicy" >
<f:textbox name="targetBinding.retentionPolicy" value="${currentTarget.retentionPolicy}" default="autogen" />
</f:entry>

<f:entry title="job scheduled time as points timestamp" field="jobScheduledTimeAsPointsTimestamp" >
<f:checkbox name="targetBinding.jobScheduledTimeAsPointsTimestamp" checked="${currentTarget.jobScheduledTimeAsPointsTimestamp}" default="false" />
</f:entry>

<f:entry title="exposeExceptions" field="exposeExceptions" >
<f:checkbox name="targetBinding.exposeExceptions" checked="${currentTarget.exposeExceptions}" default="true" />
</f:entry>

<f:entry title="Use Jenkins Proxy" field="usingJenkinsProxy" >
<f:checkbox name="targetBinding.usingJenkinsProxy" checked="${currentTarget.usingJenkinsProxy}" default="false" />
</f:entry>

<f:entry title="globalListener" field="globalListener" >
<f:checkbox name="targetBinding.globalListener" checked="${currentTarget.globalListener}" default="false" />
</f:entry>

<f:entry title="globalListenerFilter" field="globalListenerFilter" >
<f:textbox name="targetBinding.globalListenerFilter" value="${currentTarget.globalListenerFilter}" default="" />
</f:entry>

<f:entry title="delete target" >
<f:repeatable name="targets" var="instance" items="${descriptor.targets}">
<table width="100%">
<f:entry title="Description" field="description">
<f:textbox/>
</f:entry>
<f:entry title="URL" field="url">
<f:textbox/>
</f:entry>
<f:entry title="Username" field="username">
<f:textbox/>
</f:entry>
<f:entry title="Password" field="password">
<f:password/>
</f:entry>
<f:entry title="Database" field="database">
<f:textbox/>
</f:entry>
<f:entry title="Retention Policy" field="retentionPolicy">
<f:textbox default="autogen"/>
</f:entry>
<f:entry title="Job scheduled time as timestamp" field="jobScheduledTimeAsPointsTimestamp">
<f:checkbox default="false"/>
</f:entry>
<f:entry title="Expose Exceptions" field="exposeExceptions">
<f:checkbox default="true"/>
</f:entry>
<f:entry title="Use Jenkins Proxy" field="usingJenkinsProxy">
<f:checkbox default="false"/>
</f:entry>
<f:entry title="Global Listener" field="globalListener">
<f:checkbox default="false"/>
</f:entry>
<f:entry title="Global Listener Filter" field="globalListenerFilter">
<f:textbox/>
</f:entry>
<f:entry title="">
<div align="right">
<f:repeatableDeleteButton value="delete target"/>
<f:repeatableDeleteButton/>
</div>
</f:entry>

</table>

</f:entry>
</table>
</f:repeatable>

</f:entry>
</f:section>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
A custom prefix, that gets prepended to the job name, for example to prevent several 'master' metrics for different jobs in multi branch pipeline jobs
A custom prefix that gets prepended to the job name, for example to prevent several 'master' metrics for different jobs in multi branch pipeline jobs.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Sets a custom value for the InfluxDB 'project_name' tagKey, that overrides the default, which is the job name. Useful to easily group metrics for different jobs in multi branch pipeline jobs.
Sets a custom value for the InfluxDB 'project_name' tag key, that overrides the default, which is the job name.
<p>Useful to easily group metrics for different jobs in multi branch pipeline jobs.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Name of the database.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Description for the InfluxDB target.
<p>This is used in a job's configuration to select which InfluxDB target to use.</p>
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
If activated, Exceptions communicating with InfluxDB are exposed and Jobs may fail if a Report could not be written to InfluxDB. If false, even if an Exception occurs while connecting to influxdb, this Exception is not exposed but just logged.
If enabled, exceptions communicating with InfluxDB are exposed and jobs may fail if a report could not be written to InfluxDB.<br/>
If disabled, even if an exception occurs while connecting to InfluxDB, this exception is not exposed but just logged.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Whether to globally enable publishing build results to this target.
<p>Even if enabled, it is still possible to configure an additional target per job.</p>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Regular expression to match only certain builds.
Regular expression to match only certain jobs.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Custom FieldSets that will be added to the default measurement 'jenkins_data', configured as key-value-pairs (one per line, in Java-Properties file format).
<br />
Current build parameters and/or environment variables can be used in form ${PARAM}
Custom field set that will be added to the default measurement 'jenkins_data', configured as key-value pairs (one per line, in Java Properties file format).
<p>Current build parameters and/or environment variables can be used in the form of ${PARAM}</p>
<ul>
<li>KEY=${PARAM}</li>
<li>KEY=PREFIX_${PARAM}_SUFFIX</li>
<li>KEY=VALUE</li>
</ul>
</ul>
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Custom TagSets that will be added to the default measurement 'jenkins_data', configured as key-value-pairs (one per line, in Java-Properties file format).
<br />
Current build parameters and/or environment variables can be used in form ${PARAM}
Custom tag set that will be added to the default measurement 'jenkins_data', configured as key-value pairs (one per line, in Java Properties file format).
<p>Current build parameters and/or environment variables can be used in the form of ${PARAM}</p>
<ul>
<li>KEY=${PARAM}</li>
<li>KEY=PREFIX_${PARAM}_SUFFIX</li>
<li>KEY=VALUE</li>
</ul>
</ul>
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
If activated, the time when a job is scheduled is set as timestamp for every InfluxDB point instead of the time, when the point is created (and the job is almost done).
Which timestamp to use for InfluxDB points.
<p>
If enabled, the time when a job is scheduled.<br/>
If disabled, the time when a point is created (the job is almost done).
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Password of the database.
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Choose whether or not you would like to change dashes (-) to underscores (_) in tag values.
<br />
i.e. "my-custom-tag" --> "my_custom_tag".
Choose whether to change dashes (-) to underscores (_) in tag values.<br/>
<p>i.e. "my-custom-tag" &rarr; "my_custom_tag".</p>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Choose the retention policy for the data (i.e. how long is the data stored).
<br/><br/>
The default value for InfluxDB 1.0+ versions is "autogen". For InfluxDB versions &lt;1.0 the default retention policy is "default".
The "autogen" or "default" retention policies mean the data is stored for infinity.
<br/><br/>
The input can be set e.g. "2m", "3d", "4w", for 2 minutes, 3 days, or 4 weeks respectively.
The retention policy for the data (i.e. how long the data is stored).
<p>
The default value for InfluxDB 1.0+ versions is "autogen".<br/>
The default value for InfluxDB &lt;1.0 versions is "default".
</p>
<p>The "autogen" or "default" retention policies mean the data is stored for infinity.</p>
<p>The input can be set e.g. "2m", "3d", "4w", for 2 minutes, 3 days, or 4 weeks respectively.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
InfluxDB target to send data to. Targets have to be configured in the global Jenkins settings.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
URL of the InfluxDB.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Username of the database.
1 change: 0 additions & 1 deletion src/main/webapp/help/config/choose-influxdb-server.html

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/webapp/help/global/influxdb_database_name.html

This file was deleted.

1 change: 0 additions & 1 deletion src/main/webapp/help/global/influxdb_servers_added.html

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.