Fix description merge (#11126)

This commit is contained in:
Jan Faracik 2025-09-29 13:16:00 +01:00 committed by GitHub
parent 35e05775f9
commit 9238140442
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 65 additions and 18 deletions

View File

@ -33,7 +33,6 @@ THE SOFTWARE.
<script src="${resURL}/jsbundles/pages/job.js" type="text/javascript" defer="true" /> <script src="${resURL}/jsbundles/pages/job.js" type="text/javascript" defer="true" />
<j:set var="controls"> <j:set var="controls">
<t:editDescriptionButton permission="${it.UPDATE}"/>
<l:hasPermission permission="${it.UPDATE}"> <l:hasPermission permission="${it.UPDATE}">
<st:include page="logKeep.jelly" /> <st:include page="logKeep.jelly" />
</l:hasPermission> </l:hasPermission>
@ -41,7 +40,9 @@ THE SOFTWARE.
<t:buildCaption controls="${controls}">${it.displayName}</t:buildCaption> <t:buildCaption controls="${controls}">${it.displayName}</t:buildCaption>
<l:details-bar it="${it}" /> <l:details-bar it="${it}">
<t:editDescriptionButton permission="${it.UPDATE}" compact="true" />
</l:details-bar>
<div> <div>
<t:editableDescription permission="${it.UPDATE}" hideButton="true"/> <t:editableDescription permission="${it.UPDATE}" hideButton="true"/>

View File

@ -13,20 +13,36 @@
<st:attribute name="submissionUrl"> <st:attribute name="submissionUrl">
Optional submission URL. If not specified, will use 'submitDescription'. Optional submission URL. If not specified, will use 'submitDescription'.
</st:attribute> </st:attribute>
<st:attribute name="compact">
If set, the button becomes compact and the button label hides.
</st:attribute>
</st:documentation> </st:documentation>
<j:set var="actualDescription" value="${description}" defaultValue="${it.description}"/>
<j:set var="actualDescription" value="${description}" defaultValue="${it.description}" />
<j:set var="label">
<j:choose>
<j:when test="${empty(actualDescription)}">
${%add description}
</j:when>
<j:otherwise>
${%edit description}
</j:otherwise>
</j:choose>
</j:set>
<l:hasPermission permission="${permission}"> <l:hasPermission permission="${permission}">
<st:adjunct includes="lib.hudson.editable-description"/> <st:adjunct includes="lib.hudson.editable-description" />
<a class="jenkins-button jenkins-hidden" id="description-link" href="editDescription" data-description="${actualDescription}" data-url="${submissionUrl}"> <a class="jenkins-button jenkins-hidden ${attrs.compact ? 'jenkins-details__button' : ''}"
<l:icon src="symbol-edit" /> id="description-link"
<j:choose> href="editDescription"
<j:when test="${empty(actualDescription)}"> data-description="${actualDescription}"
${%add description} data-url="${submissionUrl}"
</j:when> tooltip="${attrs.compact ? label : null}">
<j:otherwise> <l:icon src="symbol-description" />
${%edit description} <j:if test="${!attrs.compact}">
</j:otherwise> ${label}
</j:choose> </j:if>
</a> </a>
</l:hasPermission> </l:hasPermission>
</j:jelly> </j:jelly>

View File

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
--> -->
<?jelly escape-by-default='true'?> <?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:x="jelly:xml"> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:x="jelly:xml" xmlns:d="jelly:define">
<st:documentation> <st:documentation>
A wrappable bar of details about the given object. A wrappable bar of details about the given object.
@ -51,5 +51,6 @@ THE SOFTWARE.
</st:include> </st:include>
</j:forEach> </j:forEach>
</j:forEach> </j:forEach>
<d:invokeBody />
</div> </div>
</j:jelly> </j:jelly>

View File

@ -5,7 +5,7 @@ $icon-size: 1.125rem;
.jenkins-details { .jenkins-details {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.625rem 1.25rem; gap: 0.75rem 1.25rem;
flex-wrap: wrap; flex-wrap: wrap;
button.jenkins-details__item, button.jenkins-details__item,
@ -42,7 +42,7 @@ $icon-size: 1.125rem;
height: $icon-size; height: $icon-size;
* { * {
stroke-width: 40px; stroke-width: 36px;
} }
} }
} }
@ -53,4 +53,26 @@ $icon-size: 1.125rem;
opacity: 0.5; opacity: 0.5;
margin-inline: -0.5rem; margin-inline: -0.5rem;
} }
&__button {
--button-background: transparent !important;
min-width: 51px;
min-height: 2rem;
padding-block: 0;
color: var(--text-color-secondary) !important;
&:not(:hover, :active, :focus-visible) {
--jenkins-border--subtle: var(--jenkins-border);
}
svg {
width: $icon-size;
height: $icon-size;
* {
stroke-width: 36px;
}
}
}
} }

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="512px" height="512px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" fill="none" stroke-width="32">
<path d="M406.5,264.938815 L406.5,347 C406.5,382.070082 378.070082,410.5 343,410.5 L149,410.5 C113.929918,410.5 85.5,382.070082 85.5,347 L85.5,227 C85.5,191.929918 113.929918,163.5 149,163.5 L237.059224,163.5" stroke="currentColor" stroke-linecap="round" fill-rule="nonzero"></path>
<path d="M414.210207,90.5004486 C422.473806,90.5004486 430.737415,93.6256822 437.042278,99.8761853 C443.347125,106.126673 446.49955,114.318928 446.49955,122.511205 C446.49955,130.703511 443.347104,138.895832 437.042278,145.146379 L437.042278,145.146379 L292.628663,288.314875 C287.494083,293.405186 281.281811,297.29966 274.441786,299.716231 L274.441786,299.716231 L215.617478,320.500449 C215.30681,320.511448 215.021375,320.388803 214.816804,320.185992 C214.612147,319.983094 214.488432,319.699988 214.49955,319.391869 L214.49955,319.391869 L235.464235,261.074683 C237.901822,254.293533 241.8302,248.134734 246.964841,243.044363 L246.964841,243.044363 L391.378135,99.8761853 C397.682998,93.6256822 405.946607,90.5004486 414.210207,90.5004486 Z" stroke="currentColor"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB