Skip to content

Commit f972b9d

Browse files
authored
Refine the 'New Item' screen (#26031)
* Refine the 'New Item' screen * Simplify SCSS * Fix submission, fix some tests, improve tabbing + focus states * Fix more tests * Simplify JS + hopefully fix test * Update pom.xml * Update Jenkinsfile * Fix issue noticed in #26069 * Restore Jenkinsfile/test pom * Simplify JS * Restore ability to have headings * Fix focus state in Firefox/Chrome * Add separator between items and 'Duplicate an item'
1 parent 4daf33d commit f972b9d

File tree

13 files changed

+381
-328
lines changed

13 files changed

+381
-328
lines changed

core/src/main/resources/hudson/model/View/newJob.jelly

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,48 @@ THE SOFTWARE.
3535
<l:breadcrumb title="${%NewJob(it.newPronoun)}" />
3636

3737
<l:main-panel>
38+
<template id="i18n" data-empty-name="${%ItemName.validation.required}" />
39+
3840
<div id="add-item-panel" style="display: none;">
39-
<h1>${%NewJob(it.newPronoun)}</h1>
41+
<l:app-bar title="${%NewJob(it.newPronoun)}" />
42+
4043
<form method="post" action="createItem" name="createItem" id="createItem">
4144
<div class="header">
42-
<div class="add-item-name">
45+
<div class="jenkins-form-item add-item-name">
4346
<label for="name" class="jenkins-form-label">${%ItemName.label}</label>
4447
<input name="name" class="jenkins-input" id="name" data-valid="false" type="text" tabindex="0" />
45-
<div id="itemname-required" class="input-validation-message input-message-disabled">&#187; ${%ItemName.validation.required}</div>
46-
<div id="itemname-invalid" class="input-validation-message input-message-disabled"></div>
47-
<div id="itemtype-required" class="input-validation-message input-message-disabled">&#187; ${%ItemType.validation.required}</div>
48+
<div class="validation-error-area" />
4849
</div>
4950
</div>
5051

51-
<div>
52-
<div class="jenkins-form-label">${%ItemType.label}</div>
53-
<div id="items" class="categories flat" role="radiogroup" aria-labelledby="Items" data-valid="false" />
54-
</div>
52+
<fieldset class="jenkins-!-display-contents">
53+
<div class="jenkins-form-item">
54+
<legend class="jenkins-form-label">${%ItemType.label}</legend>
55+
<div id="items" class="jenkins-choice-list categories" data-valid="false" />
56+
57+
<j:if test="${!empty(app.items)}">
58+
<div class="jenkins-choice-list jenkins-!-margin-top-2">
59+
<div class="jenkins-choice-list__item">
60+
<label id="duplicate-job">
61+
<div class="jenkins-choice-list__item__icon">
62+
<l:icon src="symbol-duplicate" />
63+
</div>
64+
<input type="radio" name="mode" value="copy" />
65+
<div class="jenkins-choice-list__item__label">
66+
${%CopyOption.label}
67+
</div>
68+
<div class="jenkins-choice-list__item__description">${%CopyOption.description}</div>
69+
</label>
5570

56-
<j:if test="${!empty(app.items)}">
57-
<div class="item-copy">
58-
<p class="jenkins-form-label">${%CopyOption.description}</p>
59-
<div class="add-item-copy">
60-
<input type="radio" name="mode" value="copy" />
61-
<label>${%CopyOption.label}</label>
62-
<j:set var="descriptor" value="${it.descriptor}" />
63-
<s:textbox id="from" data-valid="false" name="from" placeholder="${%CopyOption.placeholder}" field="copyNewItemFrom"/>
64-
</div>
71+
<div class="jenkins-choice-list__item__conditional">
72+
<j:set var="descriptor" value="${it.descriptor}" />
73+
<s:textbox id="from" data-valid="false" name="from" placeholder="${%CopyOption.placeholder}" field="copyNewItemFrom"/>
74+
</div>
75+
</div>
76+
</div>
77+
</j:if>
6578
</div>
66-
</j:if>
79+
</fieldset>
6780

6881
<s:bottomButtonBar>
6982
<st:include page="newJobButtonBar.jelly"/>

core/src/main/resources/hudson/model/View/newJob.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ItemType.label=Select an item type
66
ItemName.validation.required=This field cannot be empty, please enter a valid name
77
ItemType.validation.required=Please select an item type
88
CopyOption.placeholder=Type to autocomplete
9-
CopyOption.description=If you want to create a new item from other existing, you can use this option:
10-
CopyOption.label=Copy from
9+
CopyOption.description=Create a new item by copying the configuration of an existing one.
10+
CopyOption.label=Duplicate an existing item
1111
CopyExisting=Copy existing {0}
1212

eslint.config.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module.exports = [
7777
Utilities: "readonly",
7878
UTILITIES_VERSION: "writeable",
7979
YAHOO: "readonly",
80+
updateValidationArea: "readonly",
8081
},
8182
},
8283
},

0 commit comments

Comments
 (0)