Skip to content

Commit 491fbe8

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

File tree

4 files changed

+57
-37
lines changed

4 files changed

+57
-37
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/8890>`_ - 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: 50 additions & 30 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';
@@ -114,11 +115,15 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
114115
pageCount: pagination.page_count ?? 0,
115116
});
116117

118+
const fetchWindow = (from, to) => {
119+
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, from, to);
120+
clearSelection();
121+
};
122+
117123
const goToPage = (pageNo)=>{
118124
const from = (pageNo-1) * pagination.page_size + 1;
119125
const to = from + pagination.page_size - 1;
120-
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, from, to, serverCursor);
121-
clearSelection();
126+
fetchWindow(from, to);
122127
};
123128

124129
const onInputChange = (key, value)=>{
@@ -128,7 +133,7 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
128133
const onInputKeydown = (e)=>{
129134
if(e.code === 'Enter' && !errorInputs.from && !errorInputs.to) {
130135
e.preventDefault();
131-
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, inputs.from, inputs.to);
136+
fetchWindow(inputs.from, inputs.to);
132137
}
133138
};
134139

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

web/pgadmin/translations/it/LC_MESSAGES/messages.po

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,6 @@ msgid ""
778778
"can provide any string with or without placeholders of their choice. A blank "
779779
"title will revert to the default."
780780
msgstr ""
781-
"I segnaposto supportati sono %FUNCTION%, %ARGS%, %SCHEMA% e %DATABASE%. Gli "
782-
"utenti possono specificare qualsiasi stringa con o senza segnaposto a loro "
783-
"scelta. Un titolo vuoto tornerà al valore predefinito."
784781

785782
#: pgadmin/browser/register_browser_preferences.py:456
786783
#: pgadmin/browser/static/js/collection.js:57 pgadmin/browser/static/js/node.js:215

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)