mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-22 15:13:42 -06:00
More fixes for issues found while testing query tool pagination changes. #1780
This commit is contained in:
parent
67d3f14c3d
commit
6fcc4ae6a2
33
.github/workflows/run-python-tests-pg.yml
vendored
33
.github/workflows/run-python-tests-pg.yml
vendored
@ -62,7 +62,7 @@ jobs:
|
||||
ECHO Running %INSTALLER_EXE%...
|
||||
%INSTALLER_EXE% --prefix C:\PostgreSQL\${{ matrix.pgver }} --datadir C:\PostgreSQL\${{ matrix.pgver }}\data --serverport 59${{ matrix.pgver }} --superpassword postgres --install_runtimes 0 --mode unattended --unattendedmodeui none --disable-components pgAdmin,stackbuilder --enable-components server,commandlinetools"
|
||||
choco install -y mitkerberos
|
||||
|
||||
|
||||
REM Ignore error 3010 (reboot required)
|
||||
IF %ERRORLEVEL% EQU 3010 cmd /c "exit /b 0"
|
||||
shell: cmd
|
||||
@ -92,12 +92,12 @@ jobs:
|
||||
sudo sed -i "s/port = 543[0-9]/port = 59${{ matrix.pgver }}/g" /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
|
||||
sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = '\$libdir\/plugin_debugger'/g" /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
|
||||
sudo su - postgres -c "/usr/lib/postgresql/${{ matrix.pgver }}/bin/postgres -D /var/lib/postgresql/${{ matrix.pgver }}/main -c config_file=/etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf &"
|
||||
|
||||
|
||||
until sudo runuser -l postgres -c "pg_isready -p 59${{ matrix.pgver }}" 2>/dev/null; do
|
||||
>&2 echo "Postgres is unavailable - sleeping for 2 seconds"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
|
||||
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION pgagent;'
|
||||
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION pldbgapi;'
|
||||
|
||||
@ -107,18 +107,13 @@ jobs:
|
||||
echo local all all trust > /opt/homebrew/var/postgresql@${{ matrix.pgver }}/pg_hba.conf
|
||||
sed -i '' "s/#port = 543[0-9]/port = 59${{ matrix.pgver }}/g" /opt/homebrew/var/postgresql@${{ matrix.pgver }}/postgresql.conf
|
||||
brew services restart postgresql@${{ matrix.pgver }}
|
||||
|
||||
|
||||
until /opt/homebrew/opt/postgresql@${{ matrix.pgver }}/bin/pg_isready -p 59${{ matrix.pgver }} 2>/dev/null; do
|
||||
>&2 echo "Postgres is unavailable - sleeping for 2 seconds"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
psql postgres -p 59${{ matrix.pgver }} -c 'CREATE ROLE postgres SUPERUSER LOGIN;'
|
||||
|
||||
# Pin the python version to v3.12 till pgAdmin supports latest versions.
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
psql postgres -p 59${{ matrix.pgver }} -c 'CREATE ROLE postgres SUPERUSER LOGIN;'
|
||||
|
||||
- name: Install Python dependencies on Linux and macOS
|
||||
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' }}
|
||||
@ -140,21 +135,21 @@ jobs:
|
||||
run: |
|
||||
cat <<EOF > web/config_local.py
|
||||
from config import *
|
||||
|
||||
|
||||
# Debug mode
|
||||
DEBUG = True
|
||||
|
||||
|
||||
# App mode
|
||||
SERVER_MODE = False
|
||||
|
||||
|
||||
# Log
|
||||
CONSOLE_LOG_LEVEL = DEBUG
|
||||
FILE_LOG_LEVEL = DEBUG
|
||||
|
||||
|
||||
DEFAULT_SERVER = '127.0.0.1'
|
||||
|
||||
|
||||
UPGRADE_CHECK_ENABLED = False
|
||||
|
||||
|
||||
LOG_FILE = "$(pwd)/var/pgadmin4.log"
|
||||
SESSION_DB_PATH = "$(pwd)/var/sessions"
|
||||
STORAGE_DIR = "$(pwd)/var/storage"
|
||||
@ -162,7 +157,7 @@ jobs:
|
||||
TEST_SQLITE_PATH = "$(pwd)/var/pgadmin4.db"
|
||||
AZURE_CREDENTIAL_CACHE_DIR = "$(pwd)/var/azurecredentialcache"
|
||||
EOF
|
||||
|
||||
|
||||
cat <<EOF > web/regression/test_config.json
|
||||
{
|
||||
"pgAdmin4_login_credentials": {
|
||||
@ -211,7 +206,7 @@ jobs:
|
||||
if: ${{ matrix.os == 'windows-latest' }}
|
||||
run: |
|
||||
FOR /f "delims=" %%D IN ('python -c "import os; print(os.getcwd().replace('\\', '\\\\'))"') DO SET WORKING_DIR=%%D
|
||||
|
||||
|
||||
> web\config_local.py (
|
||||
@echo.from config import *
|
||||
@echo.
|
||||
@ -236,7 +231,7 @@ jobs:
|
||||
@echo.TEST_SQLITE_PATH = "%WORKING_DIR%\\var\\test_pgadmin4.db"
|
||||
@echo.AZURE_CREDENTIAL_CACHE_DIR = "%WORKING_DIR%\\var\\azurecredentialcache"
|
||||
)
|
||||
|
||||
|
||||
> web\regression\test_config.json (
|
||||
@echo.{
|
||||
@echo. "pgAdmin4_login_credentials": {
|
||||
|
@ -26,6 +26,7 @@ define(
|
||||
'SQL_NO_CHANGE': gettext('Nothing changed'),
|
||||
'MUST_BE_INT' : gettext("'%s' must be an integer."),
|
||||
'MUST_BE_NUM' : gettext("'%s' must be a numeric."),
|
||||
'INVALID_MIN_MAX' : gettext("Min and Max values are not valid"),
|
||||
'MUST_GR_EQ' : gettext("'%s' must be greater than or equal to %s."),
|
||||
'MUST_LESS_EQ' : gettext("'%s' must be less than or equal to %s."),
|
||||
'CANNOT_BE_EMPTY': gettext("'%s' cannot be empty."),
|
||||
|
@ -15,7 +15,10 @@ import pgAdmin from 'sources/pgadmin';
|
||||
export function minMaxValidator(label, value, minValue, maxValue) {
|
||||
if((_.isUndefined(value) || _.isNull(value) || String(value) === ''))
|
||||
return null;
|
||||
if (!_.isUndefined(minValue) && (value < minValue || value === '-')) {
|
||||
|
||||
if(isNaN(minValue) || isNaN(maxValue)) {
|
||||
return pgAdmin.Browser.messages.INVALID_MIN_MAX;
|
||||
} else if (!_.isUndefined(minValue) && (value < minValue || value === '-')) {
|
||||
return sprintf(pgAdmin.Browser.messages.MUST_GR_EQ, label, minValue);
|
||||
} else if (!_.isUndefined(maxValue) && value > maxValue) {
|
||||
return sprintf(pgAdmin.Browser.messages.MUST_LESS_EQ, label, maxValue);
|
||||
|
@ -153,17 +153,17 @@ function PaginationInputs({pagination, totalRowCount, clearSelection}) {
|
||||
setErrorInputs((prev)=>{
|
||||
let errors = {...prev};
|
||||
|
||||
if(minMaxValidator('', inputs.pageNo, 1, inputs.pageCount) || isEmptyString(inputs.pageNo)) {
|
||||
if(minMaxValidator('', parseInt(inputs.pageNo), 1, parseInt(inputs.pageCount)) || isEmptyString(inputs.pageNo)) {
|
||||
errors.pageNo = true;
|
||||
} else {
|
||||
errors.pageNo = false;
|
||||
}
|
||||
if(minMaxValidator('', inputs.from, 1, inputs.to) || isEmptyString(inputs.from)) {
|
||||
if(minMaxValidator('', parseInt(inputs.from), 1, parseInt(inputs.to)) || isEmptyString(inputs.from)) {
|
||||
errors.from = true;
|
||||
} else {
|
||||
errors.from = false;
|
||||
}
|
||||
if(minMaxValidator('', inputs.to, 1, totalRowCount) || isEmptyString(inputs.to)) {
|
||||
if(minMaxValidator('', parseInt(inputs.to), 1, totalRowCount) || isEmptyString(inputs.to)) {
|
||||
errors.to = true;
|
||||
} else {
|
||||
errors.to = false;
|
||||
@ -233,8 +233,8 @@ function PaginationInputs({pagination, totalRowCount, clearSelection}) {
|
||||
<span> {gettext('of')} {pagination.page_count}</span>
|
||||
<div className='PaginationInputs-divider'> </div>
|
||||
<PgButtonGroup size="small">
|
||||
<PgIconButton title={gettext('First Page')} disabled={pagination.page_no == 1} onClick={()=>goToPage(1)} icon={<SkipPreviousRoundedIcon />}/>
|
||||
<PgIconButton title={gettext('Previous Page')} disabled={pagination.page_no == 1} onClick={()=>goToPage(pagination.page_no-1)} icon={<FastRewindRoundedIcon />}/>
|
||||
<PgIconButton title={gettext('First Page')} disabled={pagination.page_no <= 1} onClick={()=>goToPage(1)} icon={<SkipPreviousRoundedIcon />}/>
|
||||
<PgIconButton title={gettext('Previous Page')} disabled={pagination.page_no <= 1} onClick={()=>goToPage(pagination.page_no-1)} icon={<FastRewindRoundedIcon />}/>
|
||||
<PgIconButton title={gettext('Next Page')} disabled={pagination.page_no == pagination.page_count} onClick={()=>goToPage(pagination.page_no+1)} icon={<FastForwardRoundedIcon />}/>
|
||||
<PgIconButton title={gettext('Last Page')} disabled={pagination.page_no == pagination.page_count} onClick={()=>goToPage(pagination.page_count)} icon={<SkipNextRoundedIcon />} />
|
||||
</PgButtonGroup>
|
||||
@ -423,7 +423,7 @@ export function ResultSetToolbar({query, canEdit, totalRowCount, pagination, all
|
||||
</>
|
||||
}
|
||||
{
|
||||
allRowsSelect == 'PAGE' && (
|
||||
allRowsSelect == 'PAGE' && totalRowCount > pagination.page_size && (
|
||||
<div>
|
||||
<span>{gettext('All rows on this page are selected.')}</span>
|
||||
<PgButtonGroup size="small">
|
||||
|
Loading…
Reference in New Issue
Block a user