Skip to content

Commit

Permalink
Getting there...
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Oct 23, 2021
1 parent 1a55c92 commit b8b894c
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,39 @@ THE SOFTWARE.
-->
<?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" xmlns:p="/lib/hudson/project" xmlns:this="this">
<p:config-disableBuild/>
<p:config-concurrentBuild />
<div class="jenkins-section">
<p:config-disableBuild/>
<p:config-concurrentBuild />

<j:set var="jdks" value="${app.JDKs}" />
<j:if test="${jdks.size() gt 1}">
<!-- if there's only one JDK configured, always use that. -->
<f:entry title="JDK"
description="${%JDK to be used for this project}">
<select class="jenkins-input validated" name="jdk" checkUrl="'${rootURL}/defaultJDKCheck?value='+this.value">
<j:getStatic var="DEFAULT_NAME" className="hudson.model.JDK" field="DEFAULT_NAME"/>
<option>${DEFAULT_NAME}</option>
<j:forEach var="inst" items="${jdks}">
<f:option selected="${inst.name==it.JDK.name}" value="${inst.name}">${inst.name}</f:option>
</j:forEach>
</select>
</f:entry>
</j:if>
<j:set var="jdks" value="${app.JDKs}" />
<j:if test="${jdks.size() gt 1}">
<!-- if there's only one JDK configured, always use that. -->
<f:entry title="JDK"
description="${%JDK to be used for this project}">
<select class="jenkins-input validated" name="jdk" checkUrl="'${rootURL}/defaultJDKCheck?value='+this.value">
<j:getStatic var="DEFAULT_NAME" className="hudson.model.JDK" field="DEFAULT_NAME"/>
<option>${DEFAULT_NAME}</option>
<j:forEach var="inst" items="${jdks}">
<f:option selected="${inst.name==it.JDK.name}" value="${inst.name}">${inst.name}</f:option>
</j:forEach>
</select>
</f:entry>
</j:if>

<p:config-assignedLabel />
<p:config-assignedLabel />

<f:advanced>
<p:config-quietPeriod />
<p:config-retryCount />
<p:config-blockWhenUpstreamBuilding />
<p:config-blockWhenDownstreamBuilding />
<st:include page="configure-advanced.jelly" optional="true" />
<f:entry title="${%Display Name}" field="displayNameOrNull">
<f:textbox checkUrl="'${rootURL}/checkDisplayName?displayName='+encodeURIComponent(this.value)+'&amp;jobName='+encodeURIComponent('${h.jsStringEscape(it.name)}')"/>
</f:entry>
<f:optionalBlock name="keepDependencies" checked="${it.keepDependencies}" title="${%Keep the build logs of dependencies}" help="/help/tasks/fingerprint/keepDependencies.html"/>
</f:advanced>
<f:advanced>
<p:config-quietPeriod />
<p:config-retryCount />
<p:config-blockWhenUpstreamBuilding />
<p:config-blockWhenDownstreamBuilding />
<st:include page="configure-advanced.jelly" optional="true" />
<f:entry title="${%Display Name}" field="displayNameOrNull">
<f:textbox checkUrl="'${rootURL}/checkDisplayName?displayName='+encodeURIComponent(this.value)+'&amp;jobName='+encodeURIComponent('${h.jsStringEscape(it.name)}')"/>
</f:entry>
<f:optionalBlock name="keepDependencies" checked="${it.keepDependencies}" title="${%Keep the build logs of dependencies}" help="/help/tasks/fingerprint/keepDependencies.html"/>
</f:advanced>
</div>

<this:configure-scm/>
</j:jelly>
8 changes: 5 additions & 3 deletions core/src/main/resources/hudson/model/Computer/configure.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ THE SOFTWARE.
<j:set var="instance" value="${it.node}" />
<j:set var="descriptor" value="${instance.descriptor}" />

<f:entry title="${%Name}" field="name">
<f:textbox value="${it.name}" /><!-- anomaly. instance[field] isn't what we want. -->
</f:entry>
<div class="jenkins-section">
<f:entry title="${%Name}" field="name">
<f:textbox value="${it.name}" /><!-- anomaly. instance[field] isn't what we want. -->
</f:entry>
</div>

<!-- main body of the configuration -->
<st:include it="${instance}" page="configure-entries.jelly" />
Expand Down
10 changes: 7 additions & 3 deletions core/src/main/resources/hudson/model/Job/configure.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ THE SOFTWARE.
<j:set var="descriptor" value="${it.descriptor}" />
<j:set var="instance" value="${it}" />

<f:entry title="${%Description}" help="${app.markupFormatter.helpUrl}">
<f:textarea name="description" value="${it.description}" codemirror-mode="${app.markupFormatter.codeMirrorMode}" codemirror-config="${app.markupFormatter.codeMirrorConfig}" previewEndpoint="/markupFormatter/previewDescription"/>
</f:entry>
<div class="jenkins-section">
<f:entry title="${%Description}" help="${app.markupFormatter.helpUrl}">
<f:textarea name="description" value="${it.description}" codemirror-mode="${app.markupFormatter.codeMirrorMode}" codemirror-config="${app.markupFormatter.codeMirrorConfig}" previewEndpoint="/markupFormatter/previewDescription"/>
</f:entry>
</div>

<!-- TODO REMEMBER TO DELETE THIS LINE-->

<f:descriptorList field="properties" descriptors="${h.getJobPropertyDescriptors(it)}" forceRowSet="true"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import jenkins.model.ProjectNamingStrategy

def f=namespace(lib.FormTagLib)

f.optionalBlock( field:"useProjectNamingStrategy", title:_("useNamingStrategy"), checked:app.useProjectNamingStrategy) {
div(class: "jenkins-form-item") {
f.optionalBlock( field:"useProjectNamingStrategy", title:_("useNamingStrategy"), checked:app.useProjectNamingStrategy) {

f.entry(title:_("namingStrategyTitle")) {
div(style:"width:100%") {
f.descriptorRadioList(title:_("strategy"), varName:"namingStrategy", instance:app.projectNamingStrategy, descriptors:ProjectNamingStrategy.all())
f.entry(title:_("namingStrategyTitle")) {
div(style:"width:100%") {
f.descriptorRadioList(title:_("strategy"), varName:"namingStrategy", instance:app.projectNamingStrategy, descriptors:ProjectNamingStrategy.all())
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ THE SOFTWARE.
<j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigUnclassifiedReadable()}">
<j:set var="readOnlyMode" value="${!editable.contains(descriptor)}" />
<j:set var="instance" value="${descriptor}" /><!-- this makes the <f:textbox field=.../> work -->
<f:rowSet name="${descriptor.jsonSafeClassName}">
<st:include page="${descriptor.globalConfigPage}" from="${descriptor}" />
</f:rowSet>
<st:include page="${descriptor.globalConfigPage}" from="${descriptor}" />
</j:forEach>

<l:hasPermission permission="${app.SYSTEM_READ}">
Expand Down
87 changes: 45 additions & 42 deletions core/src/main/resources/lib/form/advanced.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,53 @@ THE SOFTWARE.
-->

<?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">
<st:documentation>
Expandable section that shows "advanced..." button by default.
Upon clicking it, a section unfolds, and the HTML rendered by the body of this tag
appears.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout">
<st:documentation>
Expandable section that shows "advanced..." button by default.
Upon clicking it, a section unfolds, and the HTML rendered by the body of this tag
appears.

<st:attribute name="title" use="optional">
Caption of the button. By default "Advanced"
</st:attribute>
<st:attribute name="style" use="optional">
Additional styles
</st:attribute>
<st:attribute name="align" use="optional">
'left' or 'center' to align the button to left or center.
</st:attribute>
</st:documentation>
<st:attribute name="title" use="optional">
Caption of the button. By default "Advanced"
</st:attribute>
<st:attribute name="style" use="optional">
Additional styles
</st:attribute>
<st:attribute name="align" use="optional">
'left' or 'center' to align the button to left or center.
</st:attribute>
</st:documentation>

<div class='tr'>
<st:adjunct includes="lib.form.advanced.advanced"/>
<div class='tr'>
<st:adjunct includes="lib.form.advanced.advanced"/>

<div class="advancedLink" style="${attrs.align!=null?('text-align:'+attrs.align):''}">
<j:set var="id" value="${h.generateId()}"/>
<span style="display: none" id="${id}">
<div class="advancedLink">
<j:set var="id" value="${h.generateId()}"/>
<span style="display: none" id="${id}">
<l:icon class="icon-notepad icon-md" tooltip="${%customizedFields}"/>
</span>
<st:nbsp />
<input type="button" value="${attrs.title?:'%Advanced'}..." class="advanced-button advancedButton" /><!-- advancedButton is legacy -->
</div>
<j:new var="customizedFields" className="java.util.TreeSet"/>
<div class="advancedBody"><div class="tbody">
<!-- this is the hidden portion that hosts the "advanced" part. Contents will be moved to the master table when "advanced..." is clicked -->
<d:invokeBody/>
</div></div>
<j:if test="${!customizedFields.isEmpty()}">
<script>
{
var span = $$('${id}');
if (span != null) {
span.style.display = '';
} else if (console &amp;&amp; console.log) {
console.log('no element ${id} for ${customizedFields}');
}
}
</script>
</j:if>
</div>
</span>
<st:nbsp/>
<input type="button" value="${attrs.title?:'%Advanced'}..."
class="advanced-button"/><!-- advancedButton is legacy -->
</div>
<j:new var="customizedFields" className="java.util.TreeSet"/>
<div class="advancedBody">
<div class="tbody">
<!-- this is the hidden portion that hosts the "advanced" part. Contents will be moved to the master table when "advanced..." is clicked -->
<d:invokeBody/>
</div>
</div>
<j:if test="${!customizedFields.isEmpty()}">
<script>
{
var span = $$('${id}');
if (span != null) {
span.style.display = '';
} else if (console &amp;&amp; console.log) {
console.log('no element ${id} for ${customizedFields}');
}
}
</script>
</j:if>
</div>
</j:jelly>
6 changes: 3 additions & 3 deletions core/src/main/resources/lib/form/hetero-list.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ THE SOFTWARE.
<div class="tr help-sibling">
<div colspan="3">
<div class="${attrs.disableDragAndDrop or readOnlyMode ? '' : 'dd-handle'}">
<b>${descriptor.displayName}</b>
${descriptor.displayName}
<f:helpLink url="${help}"/>
</div>
<f:helpLink url="${help}"/>
</div>
</div>
<!-- TODO: help support is unintuitive; people should be able to see help from drop-down menu -->
Expand All @@ -114,7 +114,7 @@ THE SOFTWARE.
<st:adjunct includes="lib.form.hetero-list.hetero-list"/>

<j:set var="targetType" value="${attrs.targetType?:it.class}"/>
<div class="hetero-list-container ${hasHeader?'with-drag-drop':''} ${attrs.oneEach?'one-each':''} ${attrs.honorOrder?'honor-order':''}">
<div class="jenkins-form-item hetero-list-container ${hasHeader?'with-drag-drop':''} ${attrs.oneEach?'one-each':''} ${attrs.honorOrder?'honor-order':''}">
<!-- display existing items -->
<j:forEach var="i" items="${attrs.items}"><!-- TODO consider customizedFields: how to distinguish default items from user-configured items? -->
<j:set var="descriptor" value="${i.descriptor}" />
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/form/optionalBlock.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ THE SOFTWARE.

<j:choose>
<j:when test="${attrs.title!=null}">
<div class="optionalBlock-container">
<div class="optionalBlock-container jenkins-form-item">
<div class="help-sibling tr optional-block-start row-group-start ${attrs.inline?'':'row-set-start'}" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning -->
<div class="jenkins-checkbox-help-wrapper">
<f:checkbox name="${attrs.name}" class="optional-block-control block-control" onclick="javascript:updateOptionalBlock(this,true)"
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/form/radioBlock.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ THE SOFTWARE.

<div class="radioBlock-container">
<div class="tr help-sibling radio-block-start row-group-start ${attrs.inline?'':'row-set-start'}" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning -->
<div colspan="3">
<div class="jenkins-radio-help-wrapper">
<div class="jenkins-radio">
<input type="radio"
id="${name}-${value}"
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/form/rowSet.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>

<div class="rowSet-container">
<div class="rowSet-container jenkins-form-item">
<j:choose>
<j:when test="${attrs.ref==null and attrs.name==null}">
<!-- noop -->
Expand Down
46 changes: 20 additions & 26 deletions war/src/main/less/base/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,6 @@ pre.console {
cursor: pointer;
}

.advancedLink {
text-align: right;
}

.advancedBody {
display: none;
}
Expand Down Expand Up @@ -1158,8 +1154,9 @@ table.fingerprint-in-build td {
/* ========================= repeatable elements ========================= */

.repeated-chunk {
border: 2px dashed transparent;
padding-left: 1.5rem;
border: 2px dashed var(--input-border);
padding: 1rem;
border-radius: 6px;
}

.repeated-chunk.hover {
Expand Down Expand Up @@ -1211,9 +1208,21 @@ div.to-be-removed { display: none; }
.optionalBlock-container > .form-container,
.radioBlock-container > .form-container,
.dropdownList-container {
margin-left: 10px;
border-left: 2px dashed var(--input-border);
padding-left: 20px;
position: relative;
margin-top: 10px;
padding-left: 32px;

&::after {
content: "";
position: absolute;
top: 0;
left: 10px;
bottom: 0;
width: 2px;
background: var(--input-border);
border-radius: 2px;
transition: var(--standard-transition);
}
}

.row-set-end { display: none; }
Expand Down Expand Up @@ -1252,23 +1261,14 @@ textarea.rich-editor {

.hetero-list-container .dd-handle,
.repeated-container .dd-handle {
cursor: move;
background-image: url(../../images/grip.png);
background-repeat: repeat-y;
padding-left: 20px;
//cursor: move;
font-weight: 600;
}

.hetero-list-container.with-drag-drop .repeated-chunk,
.repeated-container.with-drag-drop .repeated-chunk {
padding: 0.5em;
margin-top: 0.5em;
margin-bottom: 0.5em;
padding-left: 1.5rem;
}

.hetero-list-container.with-drag-drop .repeated-chunk .dd-handle,
.repeated-container.with-drag-drop .repeated-chunk .dd-handle {
margin-left: -1.25rem;
}

// SortableJS drag & drop classes
Expand Down Expand Up @@ -1691,12 +1691,6 @@ svg.icon-xlg {
fill: currentColor;
}

/* -------------------------------------- */

.tr {
margin-top: 0.4em;
}

/* -------------- Unclassified ---------- */

.spacer {
Expand Down
8 changes: 7 additions & 1 deletion war/src/main/less/modules/form.less
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@
}
}

.jenkins-radio-help-wrapper {
display: flex;
align-items: center;
justify-content: flex-start;
}

.jenkins-radio {
margin-top: 2px;

Expand All @@ -263,7 +269,7 @@
position: relative;
display: inline-block;
margin-bottom: 0;
padding: 0 32px 5px;
padding: 0 0 5px 32px;
cursor: pointer;
font-weight: 600;
// remove 300ms pause on mobile
Expand Down
Binary file removed war/src/main/webapp/images/grip.png
Binary file not shown.

0 comments on commit b8b894c

Please sign in to comment.