Skip to content

Commit

Permalink
[JENKINS-69549] Margins for headers and paragraphs make descriptions … (
Browse files Browse the repository at this point in the history
#7078)

Co-authored-by: Alexander Brandes <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
4 people authored Dec 9, 2024
1 parent 3b3a637 commit f6802dd
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 22 deletions.
5 changes: 5 additions & 0 deletions core/src/main/java/jenkins/telemetry/Telemetry.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public static ExtensionList<Telemetry> all() {
return ExtensionList.lookup(Telemetry.class);
}

@Restricted(NoExternalUse.class) // called by jelly
public static boolean isAnyTrialActive() {
return all().stream().anyMatch(Telemetry::isActivePeriod);
}

/**
* @since 2.147
* @return whether to collect telemetry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def f=namespace(lib.FormTagLib)

f.section(title: _("Usage Statistics")) {
if (UsageStatistics.DISABLED) {
span(class: "jenkins-not-applicable") {
div(class: "jenkins-not-applicable jenkins-description") {
raw(_("disabledBySystemProperty"))
}
} else if (FIPS140.useCompliantAlgorithms()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?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">
<div>
<p>
For any project, it's critical to know how the software is used, but tracking usage data is inherently difficult in open-source projects.
Anonymous usage statistics address this need.
When enabled, Jenkins periodically sends information to the Jenkins project.
The Jenkins project uses this information to set development priorities.
</div>
</p>
<j:invokeStatic className="jenkins.security.FIPS140" method="useCompliantAlgorithms" var="fips"/>
<j:if test="${!fips}">
<h1>General usage statistics</h1>
<h3>General usage statistics</h3>
<div>
<p>Jenkins reports the following general usage statistics:</p>
<ul>
Expand All @@ -24,7 +24,7 @@
</p>
</div>
</j:if>
<h1>Telemetry collection</h1>
<h3>Telemetry collection</h3>
<div>
<p>
<j:choose>
Expand All @@ -38,24 +38,34 @@
Each trial has a specific purpose and a defined end date, after which collection stops, independent of the installed versions of Jenkins or plugins.
Once a trial is complete, the trial results may be aggregated and shared with the developer community.
</p>
<p>
The following trials defined on this instance are active now or in the future:
</p>

<j:invokeStatic className="jenkins.telemetry.Telemetry" method="all" var="collectors"/>
<j:invokeStatic className="jenkins.telemetry.Telemetry" method="isAnyTrialActive" var="anyTrialActive"/>
<j:invokeStatic className="java.time.LocalDate" method="now" var="now"/>
<dl>
<j:forEach items="${collectors}" var="collector">
<j:if test="${not collector.end.isBefore(now)}">
<dt>${collector.displayName}</dt>
<dd>
<st:include it="${collector}" optional="true" page="description.jelly"/>
<p>
Start date: ${collector.start}<br/>
End date: ${collector.end}
</p>
</dd>
</j:if>
</j:forEach>
</dl>
<j:choose>
<j:when test="${!anyTrialActive}">
<p>${%There are currently no active trials.}</p>
</j:when>
<j:otherwise>
<p>
The following trials defined on this instance are active now or in the future:
</p>
<dl>
<j:forEach items="${collectors}" var="collector">
<j:if test="${not collector.end.isBefore(now)}">
<dt>${collector.displayName}</dt>
<dd>
<st:include it="${collector}" optional="true" page="description.jelly"/>
<p>
Start date: ${collector.start}
<br/>
End date: ${collector.end}
</p>
</dd>
</j:if>
</j:forEach>
</dl>
</j:otherwise>
</j:choose>
</div>
</j:jelly>
20 changes: 20 additions & 0 deletions src/main/scss/base/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ pre.console {
border-radius: 6px;
z-index: 0;

--section-padding: 0.8rem;

&::before {
content: "";
position: absolute;
Expand All @@ -389,6 +391,24 @@ pre.console {
p:last-of-type {
margin-bottom: 0;
}

// add spacing above headings except for when its the first element in the help
// the need for this is caused by p:last-of-type setting margin-bottom to 0
// unfortunately because of the varied markup I wasn't able to find a way to avoid this
h1:not(:first-child),
.h1:not(:first-child),
h2:not(:first-child),
.h2:not(:first-child),
h3:not(:first-child),
.h3:not(:first-child),
h4:not(:first-child),
.h4:not(:first-child),
h5:not(:first-child),
.h5:not(:first-child),
h6:not(:first-child),
.h6:not(:first-child) {
margin-top: var(--section-padding);
}
}

.help .from-plugin {
Expand Down

0 comments on commit f6802dd

Please sign in to comment.