public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4]: Reload Server Configuration
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4]: Reload Server Configuration
@ 2016-05-05 13:36 Neel Patel <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Neel Patel @ 2016-05-05 13:36 UTC (permalink / raw)
To: pgadmin-hackers
Hi,
Please find attached patch file to reload the server configuration.
Do review it and let me know for any comments.
Thanks,
Neel Patel
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] reload_config_v1.patch (4.5K, 3-reload_config_v1.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 967d7c7..983cb49 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -179,6 +179,8 @@ class ServerNode(PGChildNodeView):
'dependent': [{'get': 'dependents'}],
'children': [{'get': 'children'}],
'module.js': [{}, {}, {'get': 'module_js'}],
+ 'reload':
+ [{'get': 'reload_configuration'}],
'connect': [{
'get': 'connect_status', 'post': 'connect', 'delete': 'disconnect'
}]
@@ -749,5 +751,29 @@ class ServerNode(PGChildNodeView):
}
)
+ def reload_configuration(self, gid, sid):
+ """Reload the server configuration"""
+
+ # Reload the server configurations
+ from pgadmin.utils.driver import get_driver
+ manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
+ conn = manager.connection()
+
+ if conn.connected():
+ # Execute the command for reload configuration for the server
+ status, rid = conn.execute_scalar("SELECT pg_reload_conf();")
+
+ if not status:
+ return internal_server_error(
+ gettext("ERROR: Couldn't reload the server configuration")
+ )
+ else:
+ return make_json_response(data={'status': True,
+ 'result': gettext('Server configuration reloaded')})
+
+ else:
+ return make_json_response(data={'status': False,
+ 'result': gettext('Not connected to server or connection with the server has been closed.')})
+
ServerNode.register_node_view(blueprint)
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
index 5423e98..2de705b 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
@@ -39,6 +39,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
applies: ['object', 'context'], callback: 'disconnect_server',
category: 'drop', priority: 5, label: '{{ _('Disconnect Server...') }}',
icon: 'fa fa-chain-broken', enable : 'is_connected'
+ },
+ {
+ name: 'reload_configuration', node: 'server', module: this,
+ applies: ['tools', 'context'], callback: 'reload_configuration',
+ category: 'reload', priority: 6, label: '{{ _('Reload Configuration...') }}',
+ icon: 'fa fa-repeat', enable : 'is_connected'
}]);
pgBrowser.messages['PRIV_GRANTEE_NOT_SPECIFIED'] =
@@ -144,6 +150,49 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
pgBrowser.serverInfo[data._id] = _.extend({}, data);
return true;
+ },
+ /* Reload configuration */
+ reload_configuration: function(args){
+ var input = args || {};
+ obj = this,
+ t = pgBrowser.tree,
+ i = input.item || t.selected(),
+ d = i && i.length == 1 ? t.itemData(i) : undefined;
+
+ if (!d)
+ return false;
+
+ alertify.confirm(
+ '{{ _('Reload server configuration') }}',
+ S('{{ _('Are you sure you want to reload server configuration - %%s ?') }}').sprintf(d.label).value(),
+ function(evt) {
+ $.ajax({
+ url: obj.generate_url(i, 'reload', d, true),
+ method:'GET',
+ success: function(res) {
+ if (res.data.status) {
+ alertify.success(res.data.result);
+ }
+ else {
+ alertify.error(res.data.result);
+ }
+ },
+ error: function(xhr, status, error) {
+ try {
+ var err = $.parseJSON(xhr.responseText);
+ if (err.success == 0) {
+ alertify.error(err.errormsg);
+ }
+ } catch (e) {}
+ t.unload(i);
+ }
+ });
+ },
+ function(evt) {
+ return true;
+ });
+
+ return false;
}
},
model: pgAdmin.Browser.Node.Model.extend({
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4]: Reload Server Configuration
@ 2016-05-06 14:08 Dave Page <[email protected]>
parent: Neel Patel <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2016-05-06 14:08 UTC (permalink / raw)
To: Neel Patel <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Thu, May 5, 2016 at 2:36 PM, Neel Patel <[email protected]> wrote:
> Hi,
>
> Please find attached patch file to reload the server configuration.
>
> Do review it and let me know for any comments.
>
> Thanks,
> Neel Patel
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-05-06 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 13:36 [pgAdmin4]: Reload Server Configuration Neel Patel <[email protected]>
2016-05-06 14:08 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox