File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
src/dashboard/Data/Browser Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1246,6 +1246,13 @@ class Browser extends DashboardView {
12461246 }
12471247
12481248 updateFilters ( filters ) {
1249+ // Check if there are selected rows
1250+ if ( Object . keys ( this . state . selection ) . length > 0 ) {
1251+ if ( ! window . confirm ( SELECTED_ROWS_MESSAGE ) ) {
1252+ return ;
1253+ }
1254+ }
1255+
12491256 const relation = this . state . relation ;
12501257 if ( relation ) {
12511258 this . setRelation ( relation , filters ) ;
@@ -2528,6 +2535,8 @@ class Browser extends DashboardView {
25282535 this . setState ( { limit } ) ;
25292536 this . updateOrdering ( this . state . ordering ) ;
25302537 } }
2538+ hasSelectedRows = { Object . keys ( this . state . selection ) . length > 0 }
2539+ selectedRowsMessage = { SELECTED_ROWS_MESSAGE }
25312540 />
25322541 </ >
25332542 ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ class BrowserFooter extends React.Component {
1919 }
2020
2121 handleLimitChange = event => {
22+ // Check if there are selected rows
23+ if ( this . props . hasSelectedRows && ! window . confirm ( this . props . selectedRowsMessage ) ) {
24+ return ;
25+ }
2226 const newLimit = parseInt ( event . target . value , 10 ) ;
2327 this . props . setLimit ( newLimit ) ;
2428 this . props . setSkip ( 0 ) ;
@@ -27,6 +31,10 @@ class BrowserFooter extends React.Component {
2731
2832 handlePageChange = newSkip => {
2933 if ( newSkip >= 0 && newSkip < this . props . count ) {
34+ // Check if there are selected rows
35+ if ( this . props . hasSelectedRows && ! window . confirm ( this . props . selectedRowsMessage ) ) {
36+ return ;
37+ }
3038 this . props . setSkip ( newSkip ) ;
3139 this . setState ( { pageInput : ( Math . floor ( newSkip / this . props . limit ) + 1 ) . toString ( ) } ) ;
3240 }
You can’t perform that action at this time.
0 commit comments