File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,12 @@ export default class extends PageModification {
119119 ...groupColumns . map ( columnId => columnsInOrder . indexOf ( columnId ) ) . filter ( index => index != null )
120120 ) ;
121121 const leftTailColumnId = columnsInOrder [ leftTailColumnIndex ] ;
122+
123+ if ( ! leftTailColumnId ) {
124+ // throw `Need rebuild WIP-limits of columns. WIP-limits used not exists column ${leftTailColumnId}`;
125+ return ;
126+ }
127+
122128 this . insertHTML (
123129 document . querySelector ( `.ghx-column[data-id="${ leftTailColumnId } "]` ) ,
124130 'beforeend' ,
Original file line number Diff line number Diff line change @@ -196,7 +196,6 @@ export default class SettingsWIPLimits extends PageModification {
196196 columnHtml ( id , column , groupId ) {
197197 const columnHeader = column . querySelector ( SettingsWIPLimits . jiraSelectors . columnHeaderName ) ;
198198 const columnTitle = columnHeader . getAttribute ( 'title' ) ;
199-
200199 return columnTemplate ( {
201200 columnTitle,
202201 columnId : id ,
@@ -281,8 +280,31 @@ export default class SettingsWIPLimits extends PageModification {
281280 } ) ;
282281 } ;
283282
283+ getWipLimitsForOnlyExistsColumns ( ) {
284+ const columns = Array . from ( this . getColumns ( ) ) . map ( el => el . getAttribute ( 'data-column-id' ) ) ;
285+ const wipLimits = { } ;
286+
287+ Object . keys ( this . wipLimits ) . forEach ( key => {
288+ const group = this . wipLimits [ key ] ;
289+ let i = group . columns . length - 1 ;
290+
291+ while ( i >= 0 ) {
292+ if ( ! columns . includes ( group . columns [ i ] ) ) {
293+ group . columns . splice ( i , 1 ) ;
294+ }
295+ i -= 1 ;
296+ }
297+
298+ if ( group . columns . length > 0 ) {
299+ wipLimits [ key ] = group ;
300+ }
301+ } ) ;
302+
303+ return wipLimits ;
304+ }
305+
284306 handleSubmit = async unmountPopup => {
285- await this . updateBoardProperty ( BOARD_PROPERTIES . WIP_LIMITS_SETTINGS , this . wipLimits ) ;
307+ await this . updateBoardProperty ( BOARD_PROPERTIES . WIP_LIMITS_SETTINGS , this . getWipLimitsForOnlyExistsColumns ( ) ) ;
286308 unmountPopup ( ) ;
287309 } ;
288310}
You can’t perform that action at this time.
0 commit comments