Skip to content

Commit f74ba30

Browse files
committed
feat: confirm refresh when rows selected
1 parent 6632f61 commit f74ba30

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ import { withRouter } from 'lib/withRouter';
4444
import { get } from 'lib/AJAX';
4545
import BrowserFooter from './BrowserFooter.react';
4646

47+
const SELECTED_ROWS_MESSAGE =
48+
'There are selected rows. Are you sure you want to leave this page?';
49+
4750
function SelectedRowsNavigationPrompt({ when }) {
48-
const message =
49-
'There are selected rows. Are you sure you want to leave this page?';
51+
const message = SELECTED_ROWS_MESSAGE;
5052

5153
React.useEffect(() => {
5254
if (!when) {
@@ -952,6 +954,11 @@ class Browser extends DashboardView {
952954
}
953955

954956
async refresh() {
957+
if (Object.keys(this.state.selection).length > 0) {
958+
if (!window.confirm(SELECTED_ROWS_MESSAGE)) {
959+
return;
960+
}
961+
}
955962
const relation = this.state.relation;
956963
const prevFilters = this.state.filters || new List();
957964
const initialState = {

0 commit comments

Comments
 (0)