Skip to content

Commit

Permalink
Merge branch 'master' into extendability
Browse files Browse the repository at this point in the history
  • Loading branch information
asheshv authored Aug 30, 2024
2 parents 664e9da + f451f89 commit 9588f15
Show file tree
Hide file tree
Showing 56 changed files with 148 additions and 29 deletions.
2 changes: 2 additions & 0 deletions Make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ REM Main build sequence Ends
RD /Q /S "%BUILDROOT%\web\regression" 1> nul 2>&1
ECHO Removing tools...
RD /Q /S "%BUILDROOT%\web\tools" 1> nul 2>&1
ECHO Removing yarn cache...
RD /Q /S "%BUILDROOT%\web\.yarn" 1> nul 2>&1
ECHO Removing any existing configurations...
DEL /q "%BUILDROOT%\web\pgadmin4.db" 1> nul 2>&1
DEL /q "%BUILDROOT%\web\config_local.py" 1> nul 2>&1
Expand Down
Binary file modified docs/en_US/images/preferences_browser_breadcrumbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_browser_display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_browser_keyboard_shortcuts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_browser_nodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_browser_processes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_browser_properties.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_browser_tab_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_dashboard_display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_dashboard_graphs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_dashboard_refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_debugger_keyboard_shortcuts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_erd_keyboard_shortcuts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_erd_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_graph_visualiser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_misc_themes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_misc_user_language.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_paths_binary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_paths_help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_schema_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_auto_completion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_csv_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_explain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_formatting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/preferences_sql_keyboard_shortcuts.png
Binary file modified docs/en_US/images/preferences_sql_options.png
Binary file modified docs/en_US/images/preferences_sql_results_grid.png
Binary file modified docs/en_US/images/preferences_storage_options.png
4 changes: 1 addition & 3 deletions docs/en_US/preferences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ The left pane of the *Preferences* dialog displays a tree control; each node of
the tree control provides access to options that are related to the node under
which they are displayed.

* Use the plus sign (+) to the left of a node name to expand a segment of the
tree control.
* Use the minus sign (-) to the left of a node name to close that node.
* Click the *Reset all preferences* button to restore all preferences to their default values.

The Browser Node
****************
Expand Down
6 changes: 4 additions & 2 deletions docs/en_US/release_notes_8_12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Bundled PostgreSQL Utilities
New features
************

| `Issue #7293 <https://github.com/pgadmin-org/pgadmin4/issues/7293>`_ - Allow running non-continuous selected SQL code blocks in the query tool.
| `Issue #1900 <https://github.com/pgadmin-org/pgadmin4/issues/1900>`_ - Added feature to restore preferences to their default values.
| `Issue #7293 <https://github.com/pgadmin-org/pgadmin4/issues/7293>`_ - Allow running non-continuous selected SQL code blocks in the query tool.
Housekeeping
************
Expand All @@ -29,4 +30,5 @@ Housekeeping
Bug fixes
*********

| `Issue #7076 <https://github.com/pgadmin-org/pgadmin4/issues/7076>`_ - Revamp the current password saving implementation to a keyring and reduce repeated OS user password prompts.
| `Issue #7076 <https://github.com/pgadmin-org/pgadmin4/issues/7076>`_ - Revamp the current password saving implementation to a keyring and reduce repeated OS user password prompts.
| `Issue #7571 <https://github.com/pgadmin-org/pgadmin4/issues/7571>`_ - Fixed an issue where users could not use pgAdmin if they did not have access to the management database.
4 changes: 3 additions & 1 deletion pkg/linux/build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ _build_runtime() {
yarn plugin import workspace-tools
yarn workspaces focus --production

# remove the yarn cache
rm -rf .yarn .yarn*
popd > /dev/null || exit

# Create the icon
Expand Down Expand Up @@ -232,7 +234,7 @@ _copy_code() {
cp "${SOURCEDIR}/pkg/linux/config_distro.py" "${SERVERROOT}/usr/${APP_NAME}/web/"
cd "${SERVERROOT}/usr/${APP_NAME}/web/" || exit
rm -f pgadmin4.db config_local.*
rm -rf jest.config.js babel.* package.json node_modules/ regression/ tools/ pgadmin/static/js/generated/.cache
rm -rf jest.config.js babel.* package.json .yarn* yarn* .editorconfig .eslint* node_modules/ regression/ tools/ pgadmin/static/js/generated/.cache
find . -name "tests" -type d -print0 | xargs -0 rm -rf
find . -name "feature_tests" -type d -print0 | xargs -0 rm -rf
find . -name "__pycache__" -type d -print0 | xargs -0 rm -rf
Expand Down
2 changes: 2 additions & 0 deletions pkg/mac/build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ _build_runtime() {
yarn plugin import workspace-tools
yarn workspaces focus --production

# remove the yarn cache
rm -rf .yarn .yarn*
popd > /dev/null || exit
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
typ.typrelid AS typoid, am.amname,
(SELECT st.setting from pg_catalog.pg_settings st WHERE st.name = 'default_table_access_method') as default_amname,
(SELECT st.setting from pg_catalog.pg_show_all_settings() st WHERE st.name = 'default_table_access_method') as default_amname,
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
(SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
typ.typrelid AS typoid, am.amname,
(SELECT st.setting from pg_catalog.pg_settings st WHERE st.name = 'default_table_access_method') as default_amname,
(SELECT st.setting from pg_catalog.pg_show_all_settings() st WHERE st.name = 'default_table_access_method') as default_amname,
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
(SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace
WHERE i.inhrelid = rel.oid) AS inherited_tables_cnt,
(CASE WHEN rel.relpersistence = 'u' THEN true ELSE false END) AS relpersistence,
(SELECT st.setting from pg_catalog.pg_settings st WHERE st.name = 'default_table_access_method') as default_amname,
(SELECT st.setting from pg_catalog.pg_show_all_settings() st WHERE st.name = 'default_table_access_method') as default_amname,
substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'fillfactor=([0-9]*)') AS fillfactor,
substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'parallel_workers=([0-9]*)') AS parallel_workers,
substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'toast_tuple_target=([0-9]*)') AS toast_tuple_target,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{# ============= Fetch list of default values for autovacuum parameters =============== #}
SELECT name, setting::numeric AS setting FROM pg_catalog.pg_settings WHERE name IN({{ columns }}) ORDER BY name
SELECT name, setting::numeric AS setting FROM pg_catalog.pg_show_all_settings() WHERE name IN({{ columns }}) ORDER BY name
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SELECT
JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid
WHERE dtb.oid = {{ did }}::oid)
END as spcname,
(SELECT st.setting from pg_catalog.pg_settings st
(SELECT st.setting from pg_catalog.pg_show_all_settings() st
WHERE st.name = 'default_table_access_method') as default_amname,
c.relacl,
nsp.nspname as schema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SELECT
JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid
WHERE dtb.oid = {{ did }}::oid)
END as spcname,
(SELECT st.setting from pg_catalog.pg_settings st
(SELECT st.setting from pg_catalog.pg_show_all_settings() st
WHERE st.name = 'default_table_access_method') as default_amname,
c.relacl,
nsp.nspname as schema,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SELECT name, vartype, min_val, max_val, enumvals
FROM pg_catalog.pg_settings WHERE context in ('user', 'superuser')
FROM pg_catalog.pg_show_all_settings() WHERE context in ('user', 'superuser')
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ def voptions(self, gid, sid):
name, vartype, min_val::numeric AS min_val, max_val::numeric AS max_val,
enumvals
FROM
pg_settings
pg_show_all_settings()
WHERE
context in ('user', 'superuser')
) a""")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{### SQL to fetch tablespace object options ###}
SELECT name, vartype, min_val, max_val, enumvals
FROM pg_catalog.pg_settings
FROM pg_catalog.pg_show_all_settings()
WHERE name IN ('seq_page_cost', 'random_page_cost', 'effective_io_concurrency');
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ SELECT
unit,
short_desc
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
ORDER BY
category
14 changes: 14 additions & 0 deletions web/pgadmin/preferences/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,17 @@ def update():
data={'data': 'Success'},
status=200
)


@blueprint.route("/", methods=['DELETE'], endpoint="reset_prefs")
@pga_login_required
def reset():
"""
Reset preferences to default
"""
res, msg = Preferences.reset()

if not res:
return internal_server_error(errormsg=msg)

return success_return()
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import getApiInstance from '../../../../static/js/api_instance';
import CloseSharpIcon from '@mui/icons-material/CloseSharp';
import HelpIcon from '@mui/icons-material/HelpRounded';
import SaveSharpIcon from '@mui/icons-material/SaveSharp';
import SettingsBackupRestoreIcon from'@mui/icons-material/SettingsBackupRestore';
import pgAdmin from 'sources/pgadmin';
import { DefaultButton, PgIconButton, PrimaryButton } from '../../../../static/js/components/Buttons';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
Expand Down Expand Up @@ -602,6 +603,64 @@ export default function PreferencesComponent({ ...props }) {
window.open(url_for('help.static', { 'filename': 'preferences.html' }), 'pgadmin_help');
};

const reset = () => {
pgAdmin.Browser.notifier.confirm(
gettext('Reset all preferences'),
`${gettext('All preferences will be reset to their default values.')}<br><br>${gettext('Do you want to proceed?')}<br><br>
${gettext('Note:')}<br> <ul style="padding-left:20px"><li style="list-style-type:disc">${gettext('The object explorer tree will be refreshed automatically to reflect the changes.')}</li>
<li style="list-style-type:disc">${gettext('If the application language changes, a reload of the application will be required. You can choose to reload later at your convenience.')}</li></ul>`,
function () {},
function () {},
'',
'Cancel',
function (closeModal) {
return [
{
type: 'default',
icon: <SaveSharpIcon />,
label: gettext('Save & Reload'),
onclick: () => {
resetPrefsToDefault(true);
closeModal();
}
}, {
type: 'primary',
icon: <SaveSharpIcon />,
label: gettext('Save & Reload Later'),
onclick: () => {
resetPrefsToDefault(false);
closeModal();
}
}
];
}
);
};

const resetPrefsToDefault = (refresh = false) => {
api({
url: url_for('preferences.index'),
method: 'DELETE'
}).then(()=>{
if (refresh){
location.reload();
return true;
}
preferencesStore.cache();
pgAdmin.Browser.tree.destroy().then(
() => {
pgAdmin.Browser.Events.trigger(
'pgadmin-browser:tree:destroyed', undefined, undefined
);
return true;
}
);
props.closeModal();
}).catch((err) => {
pgAdmin.Browser.notifier.alert(err.response.data);
});
};

return (
<StyledBox height={'100%'}>
<Box className='PreferencesComponent-root'>
Expand Down Expand Up @@ -639,6 +698,10 @@ export default function PreferencesComponent({ ...props }) {
/>
</Box>
<Box className='PreferencesComponent-actionBtn' marginLeft="auto">
<DefaultButton className='PreferencesComponent-buttonMargin' onClick={reset} startIcon={<SettingsBackupRestoreIcon />}>
{gettext('Reset all preferences')}
</DefaultButton>
<DefaultButton className='PreferencesComponent-buttonMargin' onClick={() => { props.closeModal();}} startIcon={<CloseSharpIcon onClick={() => { props.closeModal();}} />}>
<DefaultButton className='PreferencesComponent-buttonMargin'
onClick={() => { props.closeModal();}}
startIcon={
Expand Down
26 changes: 22 additions & 4 deletions web/pgadmin/static/js/helpers/ModalProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,31 @@ export function useModal() {
return React.useContext(ModalContext);
}

function AlertContent({ text, confirm, okLabel = gettext('OK'), cancelLabel = gettext('Cancel'), onOkClick, onCancelClick }) {
function renderExtraButtons(button) {
switch(button.type) {
case 'primary':
return <PrimaryButton className='Alert-margin' startIcon={button.icon} onClick={button.onclick}>{button.label}</PrimaryButton>;
case 'default':
return <DefaultButton className='Alert-margin' startIcon={button.icon} onClick={button.onclick}>{button.label}</DefaultButton>;
default:
return <DefaultButton className='Alert-margin' startIcon={button.icon} onClick={button.onclick}>{button.label}</DefaultButton>;
};
}

function AlertContent({ text, confirm, okLabel = gettext('OK'), cancelLabel = gettext('Cancel'), onOkClick, onCancelClick, extraButtons }) {
return (
<StyledBox display="flex" flexDirection="column" height="100%">
<Box flexGrow="1" p={2}>{typeof (text) == 'string' ? HTMLReactParser(text) : text}</Box>
<Box className='Alert-footer'>
{confirm &&
<DefaultButton startIcon={<CloseIcon />} onClick={onCancelClick} >{cancelLabel}</DefaultButton>
}
<PrimaryButton className='Alert-margin' startIcon={<CheckRoundedIcon />} onClick={onOkClick} autoFocus={true} >{okLabel}</PrimaryButton>
{
extraButtons?.length ?
extraButtons.map(button=>renderExtraButtons(button))
:
<PrimaryButton className='Alert-margin' startIcon={<CheckRoundedIcon />} onClick={onOkClick} autoFocus={true} >{okLabel}</PrimaryButton>
}
</Box>
</StyledBox>
);
Expand All @@ -61,6 +77,7 @@ AlertContent.propTypes = {
onCancelClick: PropTypes.func,
okLabel: PropTypes.string,
cancelLabel: PropTypes.string,
extraButtons: PropTypes.array
};

function alert(title, text, onOkClick, okLabel = gettext('OK')) {
Expand All @@ -76,7 +93,7 @@ function alert(title, text, onOkClick, okLabel = gettext('OK')) {
});
}

function confirm(title, text, onOkClick, onCancelClick, okLabel = gettext('Yes'), cancelLabel = gettext('No')) {
function confirm(title, text, onOkClick, onCancelClick, okLabel = gettext('Yes'), cancelLabel = gettext('No'), extras = null) {
// bind the modal provider before calling
this.showModal(title, (closeModal) => {
const onCancelClickClose = () => {
Expand All @@ -87,8 +104,9 @@ function confirm(title, text, onOkClick, onCancelClick, okLabel = gettext('Yes')
onOkClick?.();
closeModal();
};
const extraButtons = extras?.(closeModal);
return (
<AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} okLabel={okLabel} cancelLabel={cancelLabel} />
<AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} okLabel={okLabel} cancelLabel={cancelLabel} extraButtons={extraButtons} />
);
});
}
Expand Down
4 changes: 2 additions & 2 deletions web/pgadmin/static/js/helpers/Notifier.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ class Notifier {
this.modal.alert(title, text, onOkClick, okLabel);
}

confirm(title, text, onOkClick, onCancelClick, okLabel=gettext('Yes'), cancelLabel=gettext('No')) {
confirm(title, text, onOkClick, onCancelClick, okLabel=gettext('Yes'), cancelLabel=gettext('No'), extras=null) {
/* Use this if you want to use pgAdmin global notifier.
Or else, if you want to use modal inside iframe only then use ModalProvider eg- query tool */
this.modal.confirm(title, text, onOkClick, onCancelClick, okLabel, cancelLabel);
this.modal.confirm(title, text, onOkClick, onCancelClick, okLabel, cancelLabel, extras);
}

showModal(title, content, modalOptions) {
Expand Down
3 changes: 2 additions & 1 deletion web/pgadmin/utils/driver/psycopg3/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ def _initialize(self, conn_id, **kwargs):
cur,
"SET DateStyle=ISO; "
"SET client_min_messages=notice; "
"SELECT set_config('bytea_output','hex',false) FROM pg_settings"
"SELECT set_config('bytea_output','hex',false)"
" FROM pg_show_all_settings()"
" WHERE name = 'bytea_output'; "
"SET client_encoding='{0}';".format(postgres_encoding)
)
Expand Down
17 changes: 17 additions & 0 deletions web/pgadmin/utils/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,3 +694,20 @@ def migrate_user_preferences(self, pid, converter_func):
pref.value = converter_func(pref.value)

db.session.commit()

@classmethod
def reset(cls):
"""
reset
Reset the preferences for the current user in the configuration table.
"""
try:
db.session.query(UserPrefTable).filter(
UserPrefTable.uid == current_user.id).delete()
db.session.commit()
except Exception as e:
db.session.rollback()
current_app.logger.exception(e)
return False, str(e)

return True, None

0 comments on commit 9588f15

Please sign in to comment.