Skip to content

Commit 343fcfe

Browse files
Add a new button in the query tool data output toolbar to get entire range of data. #8890
1 parent 63397a0 commit 343fcfe

File tree

3 files changed

+51
-32
lines changed

3 files changed

+51
-32
lines changed

docs/en_US/release_notes_9_12.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ Bundled PostgreSQL Utilities
2020
New features
2121
************
2222

23+
| `Issue #8890 <https://github.com/pgadmin-org/pgadmin4/issues/9380>`_ - Add a new button in the query tool data output toolbar to get entire range of data.
24+
2325

2426
Housekeeping
2527
************
2628

2729
Bug fixes
2830
*********
29-
| `Issue #9380 <https://github.com/pgadmin-org/pgadmin4/issues/9380>`_ - Fixed an issue where the Query History panel would auto-scroll to the top and did not preserve the scroll bar position for the selected entry.
31+
32+
| `Issue #9380 <https://github.com/pgadmin-org/pgadmin4/issues/9380>`_ - Fixed an issue where the Query History panel would auto-scroll to the top and did not preserve the scroll bar position for the selected entry.
3033
3134

web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSetToolbar.jsx

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import SkipPreviousRoundedIcon from '@mui/icons-material/SkipPreviousRounded';
2424
import EditRoundedIcon from '@mui/icons-material/EditRounded';
2525
import EditOffRoundedIcon from '@mui/icons-material/EditOffRounded';
2626
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
27+
import AllInboxRoundedIcon from '@mui/icons-material/AllInboxRounded';
2728

2829
import {QUERY_TOOL_EVENTS} from '../QueryToolConstants';
2930
import { QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent';
@@ -117,7 +118,7 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
117118
const goToPage = (pageNo)=>{
118119
const from = (pageNo-1) * pagination.page_size + 1;
119120
const to = from + pagination.page_size - 1;
120-
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, from, to, serverCursor);
121+
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, from, to);
121122
clearSelection();
122123
};
123124

@@ -204,33 +205,48 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
204205
error={errorInputs['to']}
205206
/>
206207
</Box> : <span>{gettext('Showing rows: %s to %s', inputs.from, inputs.to)}</span>}
207-
<PgButtonGroup>
208-
{!serverCursor && editPageRange && <PgIconButton size="xs"
209-
title={editPageRange ? gettext('Apply (or press Enter on input)') : gettext('Edit range')}
210-
onClick={()=>eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, inputs.from, inputs.to)}
211-
disabled={errorInputs.from || errorInputs.to} icon={<CheckRoundedIcon />}
212-
/>}
213-
{!serverCursor && <PgIconButton size="xs"
214-
title={editPageRange ? gettext('Cancel edit') : gettext('Edit range')}
215-
onClick={()=>setEditPageRange((prev)=>!prev)}
216-
icon={editPageRange ? <EditOffRoundedIcon /> : <EditRoundedIcon />}
217-
/>}
218-
</PgButtonGroup>
219-
<div className='PaginationInputs-divider'>&nbsp;</div>
220-
<span>{gettext('Page No:')}</span>
221-
<InputText
222-
type="int"
223-
size="small"
224-
controlProps={{maxLength: 7}}
225-
style={{
226-
maxWidth: '10ch'
227-
}}
228-
value={inputs.pageNo}
229-
onChange={(value)=>onInputChange('pageNo', value)}
230-
onKeyDown={onInputKeydownPageNo}
231-
error={errorInputs['pageNo']}
232-
/>
233-
<span> {gettext('of')} {pagination.page_count}</span>
208+
{!serverCursor && <>
209+
<PgButtonGroup>
210+
{editPageRange && <PgIconButton size="xs"
211+
title={editPageRange ? gettext('Apply (or press Enter on input)') : gettext('Edit range')}
212+
onClick={()=>eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, inputs.from, inputs.to)}
213+
disabled={errorInputs.from || errorInputs.to} icon={<CheckRoundedIcon />}
214+
/>}
215+
<PgIconButton size="xs"
216+
title={editPageRange ? gettext('Cancel edit') : gettext('Edit range')}
217+
onClick={()=>setEditPageRange((prev)=>!prev)}
218+
icon={editPageRange ? <EditOffRoundedIcon /> : <EditRoundedIcon />}
219+
/>
220+
</PgButtonGroup>
221+
<div className='PaginationInputs-divider'></div>
222+
<PgButtonGroup>
223+
<PgIconButton size="xs"
224+
title={gettext('Show entire range')}
225+
disabled={inputs.from == 1 && inputs.to == totalRowCount}
226+
onClick={()=>{
227+
onInputChange('from', 1);
228+
onInputChange('to', totalRowCount);
229+
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, 1, totalRowCount);
230+
}}
231+
icon={<AllInboxRoundedIcon />}
232+
/>
233+
</PgButtonGroup>
234+
<div className='PaginationInputs-divider'>&nbsp;</div>
235+
<span>{gettext('Page No:')}</span>
236+
<InputText
237+
type="int"
238+
size="small"
239+
controlProps={{maxLength: 7}}
240+
style={{
241+
maxWidth: '10ch'
242+
}}
243+
value={inputs.pageNo}
244+
onChange={(value)=>onInputChange('pageNo', value)}
245+
onKeyDown={onInputKeydownPageNo}
246+
error={errorInputs['pageNo']}
247+
/>
248+
<span> {gettext('of')} {pagination.page_count}</span>
249+
</>}
234250
<div className='PaginationInputs-divider'>&nbsp;</div>
235251
<PgButtonGroup size="small">
236252
<PgIconButton title={gettext('First Page')} disabled={pagination.page_no <= 1} onClick={()=>goToPage(1)} icon={<SkipPreviousRoundedIcon />}/>

web/regression/feature_utils/pgadmin_page.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,9 +962,9 @@ def find_codemirror(driver):
962962
action.perform()
963963
else:
964964
self.driver.execute_script(
965-
"arguments[0].cmView.view.setValue(arguments[1]);"
966-
"arguments[0].cmView.view.setCursor("
967-
"arguments[0].cmView.view.lineCount(),-1);",
965+
"arguments[0].cmTile.view.setValue(arguments[1]);"
966+
"arguments[0].cmTile.view.setCursor("
967+
"arguments[0].cmTile.view.lineCount(),-1);",
968968
codemirror_ele, field_content)
969969

970970
def click_tab(self, tab_name):

0 commit comments

Comments
 (0)