diff --git a/docs/en_US/release_notes_5_7.rst b/docs/en_US/release_notes_5_7.rst index 1c7009d65..4d1369965 100644 --- a/docs/en_US/release_notes_5_7.rst +++ b/docs/en_US/release_notes_5_7.rst @@ -10,6 +10,7 @@ New features ************ | `Issue #4264 `_ - Make code folding case insensitive in the code mirror. +| `Issue #4629 `_ - Added database and server information on the Maintenance process watcher dialog. | `Issue #6691 `_ - Set PSQLRC and PSQL_HISTORY env vars to apt. user storage path in the server mode. Housekeeping diff --git a/web/pgadmin/tools/maintenance/__init__.py b/web/pgadmin/tools/maintenance/__init__.py index 378b00020..f0b24ce8f 100644 --- a/web/pgadmin/tools/maintenance/__init__.py +++ b/web/pgadmin/tools/maintenance/__init__.py @@ -81,18 +81,49 @@ class Message(IProcessDesc): self.data = _data self.query = _query + def get_server_name(self): + s = get_server(self.sid) + + from pgadmin.utils.driver import get_driver + driver = get_driver(PG_DEFAULT_DRIVER) + manager = driver.connection_manager(self.sid) + + host = manager.local_bind_host if manager.use_ssh_tunnel else s.host + port = manager.local_bind_port if manager.use_ssh_tunnel else s.port + + s.name = html.safe_str(s.name) + host = html.safe_str(host) + port = html.safe_str(port) + return "{0} ({1}:{2})".format(s.name, host, port) + + def get_op(self): + op = self._check_for_vacuum() + + if self.data['op'] == "ANALYZE": + op = _('ANALYZE') + if self.data['verbose']: + op += '(' + _('VERBOSE') + ')' + + if self.data['op'] == "REINDEX": + if 'schema' in self.data and self.data['schema']: + if 'primary_key' in self.data or \ + 'unique_constraint' in self.data or \ + 'index' in self.data: + return _('REINDEX INDEX') + else: + return _('REINDEX TABLE') + op = _('REINDEX') + + if self.data['op'] == "CLUSTER": + op = _('CLUSTER') + + return op + @property def message(self): - res = _("Maintenance ({0})") - - if self.data['op'] == "VACUUM": - return res.format(_('Vacuum')) - if self.data['op'] == "ANALYZE": - return res.format(_('Analyze')) - if self.data['op'] == "REINDEX": - return res.format(_('Reindex')) - if self.data['op'] == "CLUSTER": - return res.format(_('Cluster')) + res = _("{0} on database '{1}' of server {2}") + return res.format( + self.get_op(), self.data['database'], self.get_server_name()) @property def type_desc(self): @@ -119,28 +150,8 @@ class Message(IProcessDesc): return res def details(self, cmd, args): - res = self._check_for_vacuum() - - if self.data['op'] == "ANALYZE": - res = _('ANALYZE') - if self.data['verbose']: - res += '(' + _('VERBOSE') + ')' - - if self.data['op'] == "REINDEX": - if 'schema' in self.data and self.data['schema']: - if 'primary_key' in self.data or\ - 'unique_constraint' in self.data or\ - 'index' in self.data: - return _('REINDEX INDEX') - else: - return _('REINDEX TABLE') - res = _('REINDEX') - - if self.data['op'] == "CLUSTER": - res = _('CLUSTER') - - res = '
' + html.safe_str(res) + res = '
' + self.message res += '
' res += _("Running Query:") res += '
'