File tree Expand file tree Collapse file tree 5 files changed +34
-17
lines changed
core/src/main/resources/lib/form Expand file tree Collapse file tree 5 files changed +34
-17
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ THE SOFTWARE.
154154
155155 <j : if test =" ${!readOnlyMode}" >
156156 <div >
157- <button type =" button" class =" jenkins-button hetero-list-add" menualign =" ${attrs.menuAlign}" suffix =" ${attrs.name}" >${attrs.addCaption?:'%Add'} <l : icon src =" symbol-chevron-down " />
157+ <button type =" button" class =" jenkins-button hetero-list-add" menualign =" ${attrs.menuAlign}" suffix =" ${attrs.name}" ><l : icon src =" symbol-add " />${attrs.addCaption?:'%Add'}
158158 </button >
159159 </div >
160160 </j : if >
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ THE SOFTWARE.
2323-->
2424
2525<?jelly escape-by-default =' true' ?>
26- <j : jelly xmlns : j =" jelly:core" xmlns : st =" jelly:stapler" xmlns : d =" jelly:define" >
26+ <j : jelly xmlns : j =" jelly:core" xmlns : st =" jelly:stapler" xmlns : d =" jelly:define" xmlns : l = " /lib/layout " >
2727 <st : documentation > <![CDATA[
2828 Repeatable blocks used to present UI where the user can configure multiple entries
2929 of the same kind (see the Java installations configuration in the system config.)
@@ -143,6 +143,7 @@ THE SOFTWARE.
143143 </div >
144144 <j : if test =" ${!empty(items) and !attrs.noAddButton and attrs.enableTopButton}" >
145145 <button type =" button" class =" jenkins-button repeatable-add repeatable-add-top" >
146+ <l : icon src =" symbol-add" />
146147 ${attrs.add?:'%Add'}
147148 </button >
148149 </j : if >
@@ -173,6 +174,7 @@ THE SOFTWARE.
173174 <div class =" repeatable-insertion-point" />
174175 <j : if test =" ${!attrs.noAddButton}" >
175176 <button type =" button" class =" jenkins-button repeatable-add" >
177+ <l : icon src =" symbol-add" />
176178 ${attrs.add?:'%Add'}
177179 </button >
178180 </j : if >
Original file line number Diff line number Diff line change @@ -167,6 +167,23 @@ function generateButtons() {
167167
168168 let oneEach = e . classList . contains ( "one-each" ) ;
169169
170+ /**
171+ * Disable the Add button if there are no more items to add
172+ */
173+ function toggleButtonState ( ) {
174+ const templateCount = templates . length ;
175+ const selectedCount = [ ...e . children ] . filter ( ( e ) =>
176+ e . classList . contains ( "repeated-chunk" ) ,
177+ ) . length ;
178+
179+ btn . disabled = oneEach && selectedCount === templateCount ;
180+ }
181+ const observer = new MutationObserver ( ( ) => {
182+ toggleButtonState ( ) ;
183+ } ) ;
184+ observer . observe ( e , { childList : true } ) ;
185+ toggleButtonState ( ) ;
186+
170187 generateDropDown ( btn , ( instance ) => {
171188 let menuItems = [ ] ;
172189 for ( let i = 0 ; i < templates . length ; i ++ ) {
@@ -196,7 +213,7 @@ function generateButtons() {
196213
197214function createFilter ( menu ) {
198215 const filterInput = createElementFromHtml ( `
199- <input class="jenkins-dropdown__filter-input" placeholder="Filter" spellcheck="false" type="search"/>
216+ <input class="jenkins-input jenkins-search__input jenkins- dropdown__filter-input" placeholder="Filter" spellcheck="false" type="search"/>
200217 ` ) ;
201218
202219 filterInput . addEventListener ( "input" , ( event ) =>
Original file line number Diff line number Diff line change 230230 }
231231}
232232
233- .advanced-button ,
234- .hetero-list-add {
233+ .advanced-button {
235234 svg {
236235 width : 0.875rem ;
237236 height : 0.875rem ;
Original file line number Diff line number Diff line change @@ -68,19 +68,18 @@ $dropdown-padding: 0.375rem;
6868 & __filter {
6969 display : flex ;
7070 align-items : center ;
71- gap : 5 px ;
71+ gap : 1.2 ch ;
7272 padding : 0.6rem 1rem ;
73- border-bottom : 1 px solid var (--input -border );
73+ border-bottom : var (--jenkins -border );
7474
7575 & -input {
76- & :focus {
77- outline : none ;
78- }
79-
80- width : 100% ;
81- border : none ;
82- color : var (--text-color-secondary );
83- background-color : unset ;
76+ outline : none !important ;
77+ border : none !important ;
78+ background-color : unset !important ;
79+ box-shadow : none !important ;
80+ padding : 0 !important ;
81+ min-height : 0 !important ;
82+ border-radius : 0 !important ;
8483 }
8584
8685 svg {
@@ -118,11 +117,11 @@ $dropdown-padding: 0.375rem;
118117 & __disabled {
119118 color : var (--text-color-secondary ) !important ;
120119 font-size : 0.8125rem ;
121- opacity : 0.8 ;
120+ opacity : 0.5 ;
122121 display : inline-flex ;
123122 align-items : center ;
124123 margin : 0 ;
125- cursor : default ;
124+ cursor : not-allowed ;
126125 }
127126
128127 & __item {
You can’t perform that action at this time.
0 commit comments