Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[JENKINS-69549] Margins for headers and paragraphs make descriptions … #7078

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
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 @@
return ExtensionList.lookup(Telemetry.class);
}

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

Check warning on line 135 in core/src/main/java/jenkins/telemetry/Telemetry.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 135 is not covered by tests
}

/**
* @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-!-margin-bottom-2") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't look great as it was touching the line

Before:
image

After:
image

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the help was ending with this as there's no trials currently (and an empty dl)

</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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried removing this as its the cause of the heading spacing issue but I couldn't find a way to make it work whilst keeping no spacing at the bottom of the help file (made worse in help from plugins that have from plugin ... as the space was a bit excessive without this.

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),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janfaracik what do you think about this approach and can you think of a simpler one?

.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
Loading