Add a new button in the query tool data output toolbar to get entire range of data. #8890

pull/9460/head
Aditya Toshniwal 2025-12-12 15:38:01 +05:30 committed by GitHub
parent 63397a003a
commit 491fbe8a36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 57 additions and 37 deletions

View File

@ -20,12 +20,15 @@ Bundled PostgreSQL Utilities
New features
************
| `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.
Housekeeping
************
Bug fixes
*********
| `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.
| `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.

View File

@ -24,6 +24,7 @@ import SkipPreviousRoundedIcon from '@mui/icons-material/SkipPreviousRounded';
import EditRoundedIcon from '@mui/icons-material/EditRounded';
import EditOffRoundedIcon from '@mui/icons-material/EditOffRounded';
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
import AllInboxRoundedIcon from '@mui/icons-material/AllInboxRounded';
import {QUERY_TOOL_EVENTS} from '../QueryToolConstants';
import { QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent';
@ -114,11 +115,15 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
pageCount: pagination.page_count ?? 0,
});
const fetchWindow = (from, to) => {
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, from, to);
clearSelection();
};
const goToPage = (pageNo)=>{
const from = (pageNo-1) * pagination.page_size + 1;
const to = from + pagination.page_size - 1;
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, from, to, serverCursor);
clearSelection();
fetchWindow(from, to);
};
const onInputChange = (key, value)=>{
@ -128,7 +133,7 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
const onInputKeydown = (e)=>{
if(e.code === 'Enter' && !errorInputs.from && !errorInputs.to) {
e.preventDefault();
eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, inputs.from, inputs.to);
fetchWindow(inputs.from, inputs.to);
}
};
@ -204,33 +209,48 @@ function PaginationInputs({pagination, totalRowCount, clearSelection, serverCurs
error={errorInputs['to']}
/>
</Box> : <span>{gettext('Showing rows: %s to %s', inputs.from, inputs.to)}</span>}
<PgButtonGroup>
{!serverCursor && editPageRange && <PgIconButton size="xs"
title={editPageRange ? gettext('Apply (or press Enter on input)') : gettext('Edit range')}
onClick={()=>eventBus.fireEvent(QUERY_TOOL_EVENTS.FETCH_WINDOW, inputs.from, inputs.to)}
disabled={errorInputs.from || errorInputs.to} icon={<CheckRoundedIcon />}
/>}
{!serverCursor && <PgIconButton size="xs"
title={editPageRange ? gettext('Cancel edit') : gettext('Edit range')}
onClick={()=>setEditPageRange((prev)=>!prev)}
icon={editPageRange ? <EditOffRoundedIcon /> : <EditRoundedIcon />}
/>}
</PgButtonGroup>
<div className='PaginationInputs-divider'>&nbsp;</div>
<span>{gettext('Page No:')}</span>
<InputText
type="int"
size="small"
controlProps={{maxLength: 7}}
style={{
maxWidth: '10ch'
}}
value={inputs.pageNo}
onChange={(value)=>onInputChange('pageNo', value)}
onKeyDown={onInputKeydownPageNo}
error={errorInputs['pageNo']}
/>
<span> {gettext('of')} {pagination.page_count}</span>
{!serverCursor && <>
<PgButtonGroup>
{editPageRange && <PgIconButton size="xs"
title={editPageRange ? gettext('Apply (or press Enter on input)') : gettext('Edit range')}
onClick={()=>fetchWindow(inputs.from, inputs.to)}
disabled={errorInputs.from || errorInputs.to} icon={<CheckRoundedIcon />}
/>}
<PgIconButton size="xs"
title={editPageRange ? gettext('Cancel edit') : gettext('Edit range')}
onClick={()=>setEditPageRange((prev)=>!prev)}
icon={editPageRange ? <EditOffRoundedIcon /> : <EditRoundedIcon />}
/>
</PgButtonGroup>
<div className='PaginationInputs-divider'></div>
<PgButtonGroup>
<PgIconButton size="xs"
title={gettext('Show entire range')}
disabled={inputs.from == 1 && inputs.to == totalRowCount}
onClick={()=>{
onInputChange('from', 1);
onInputChange('to', totalRowCount);
fetchWindow(1, totalRowCount);
}}
icon={<AllInboxRoundedIcon />}
/>
</PgButtonGroup>
<div className='PaginationInputs-divider'>&nbsp;</div>
<span>{gettext('Page No:')}</span>
<InputText
type="int"
size="small"
controlProps={{maxLength: 7}}
style={{
maxWidth: '10ch'
}}
value={inputs.pageNo}
onChange={(value)=>onInputChange('pageNo', value)}
onKeyDown={onInputKeydownPageNo}
error={errorInputs['pageNo']}
/>
<span> {gettext('of')} {pagination.page_count}</span>
</>}
<div className='PaginationInputs-divider'>&nbsp;</div>
<PgButtonGroup size="small">
<PgIconButton title={gettext('First Page')} disabled={pagination.page_no <= 1} onClick={()=>goToPage(1)} icon={<SkipPreviousRoundedIcon />}/>

View File

@ -778,9 +778,6 @@ msgid ""
"can provide any string with or without placeholders of their choice. A blank "
"title will revert to the default."
msgstr ""
"I segnaposto supportati sono %FUNCTION%, %ARGS%, %SCHEMA% e %DATABASE%. Gli "
"utenti possono specificare qualsiasi stringa con o senza segnaposto a loro "
"scelta. Un titolo vuoto tornerà al valore predefinito."
#: pgadmin/browser/register_browser_preferences.py:456
#: pgadmin/browser/static/js/collection.js:57 pgadmin/browser/static/js/node.js:215

View File

@ -962,9 +962,9 @@ class PgadminPage:
action.perform()
else:
self.driver.execute_script(
"arguments[0].cmView.view.setValue(arguments[1]);"
"arguments[0].cmView.view.setCursor("
"arguments[0].cmView.view.lineCount(),-1);",
"arguments[0].cmTile.view.setValue(arguments[1]);"
"arguments[0].cmTile.view.setCursor("
"arguments[0].cmTile.view.lineCount(),-1);",
codemirror_ele, field_content)
def click_tab(self, tab_name):