Exemplo n.º 1
0
    def details(self, cmd, args):
        name, host, port = self.get_server_details()

        res = '<div>'

        if self.backup_type == BACKUP.OBJECT:
            msg = _("Backing up an object on the server '{0}' "
                    "from database '{1}'...").format(
                        "{0} ({1}:{2})".format(name, host, port),
                        self.database)
            res += html.safe_str(msg)
        elif self.backup_type == BACKUP.GLOBALS:
            msg = _("Backing up the global objects on "
                    "the server '{0}'...").format("{0} ({1}:{2})".format(
                        name, host, port))
            res += html.safe_str(msg)
        elif self.backup_type == BACKUP.SERVER:
            msg = _("Backing up the server '{0}'...").format(
                "{0} ({1}:{2})".format(name, host, port))
            res += html.safe_str(msg)
        else:
            # It should never reach here.
            res += "Backup"

        res += '</div><div class="py-1">'
        res += _("Running command:")
        res += '<div class="pg-bg-cmd enable-selection p-1">'
        res += html.safe_str(cmd + self.cmd)
        res += '</div></div>'

        return res
Exemplo n.º 2
0
    def message(self):
        name, host, port = self.get_server_details()
        name = html.safe_str(name)
        host = html.safe_str(host)
        port = html.safe_str(port)

        if self.backup_type == BACKUP.OBJECT:
            return _(
                "Backing up an object on the server '{0}' "
                "from database '{1}'"
            ).format(
                "{0} ({1}:{2})".format(
                    name, host, port
                ),
                html.safe_str(self.database)
            )
        if self.backup_type == BACKUP.GLOBALS:
            return _("Backing up the global objects on "
                     "the server '{0}'").format(
                "{0} ({1}:{2})".format(
                    name, host, port
                )
            )
        elif self.backup_type == BACKUP.SERVER:
            return _("Backing up the server '{0}'").format(
                "{0} ({1}:{2})".format(
                    name, host, port
                )
            )
        else:
            # It should never reach here.
            return "Unknown Backup"
Exemplo n.º 3
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(id=self.sid,
                                   user_id=current_user.id).first()

        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

        res = '<div class="h5">'

        res += html.safe_str(
            _("Restoring backup on the server '{0}'...").format(
                "{0} ({1}:{2})".format(s.name, host, port)))

        res += '</div><div class="h5"><b>'
        res += html.safe_str(_("Running command:"))
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd)
        res += self.cmd
        res += '</span></div>'

        return res
Exemplo n.º 4
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'

        res += html.safe_str(
            _(
                "Restoring backup on the server '{0}'..."
            ).format(
                "{0} ({1}:{2})".format(s.name, s.host, s.port)
            )
        )

        res += '</div><div class="h5"><b>'
        res += html.safe_str(
            _("Running command:")
        )
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd)
        res += self.cmd
        res += '</span></div>'

        return res
Exemplo n.º 5
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'

        res += html.safe_str(
            _(
                "Restoring backup on the server '{0}'..."
            ).format(
                "{0} ({1}:{2})".format(s.name, s.host, s.port)
            )
        )

        res += '</div><div class="h5"><b>'
        res += html.safe_str(
            _("Running command:")
        )
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd)
        res += self.cmd
        res += '</span></div>'

        return res
Exemplo n.º 6
0
    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 = '<div>' + html.safe_str(res)

        res += '</div><div class="py-1">'
        res += _("Running Query:")
        res += '<div class="pg-bg-cmd enable-selection p-1">'
        res += html.safe_str(self.query)
        res += '</div></div>'

        return res
Exemplo n.º 7
0
    def message(self):
        # Fetch the server details like hostname, port, roles etc
        name, host, port = self.get_server_details()

        return _("Copying table data '{0}.{1}' on database '{2}' "
                 "and server ({3}:{4})").format(html.safe_str(self.schema),
                                                html.safe_str(self.table),
                                                html.safe_str(self.database),
                                                html.safe_str(host),
                                                html.safe_str(port))
Exemplo n.º 8
0
 def message(self):
     # Fetch the server details like hostname, port, roles etc
     return _(
         "Copying table data '{0}.{1}' on database '{2}' "
         "and server '{3}'"
     ).format(
         html.safe_str(self.schema),
         html.safe_str(self.table),
         html.safe_str(self.database),
         self.get_server_name()
     )
Exemplo n.º 9
0
    def message(self):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(id=self.sid,
                                   user_id=current_user.id).first()

        return _("Copying table data '{0}.{1}' on database '{2}' "
                 "and server ({3}:{4})").format(html.safe_str(self.schema),
                                                html.safe_str(self.table),
                                                html.safe_str(self.database),
                                                html.safe_str(s.host),
                                                html.safe_str(s.port))
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
    def details(self, cmd, args):
        name, host, port = self.get_server_details()
        res = '<div>'

        res += html.safe_str(
            _("Restoring backup on the server '{0}'...").format(
                "{0} ({1}:{2})".format(name, host, port)))

        res += '</div><div class="py-1">'
        res += _("Running command:")
        res += '<div class="pg-bg-cmd enable-selection p-1">'
        res += html.safe_str(cmd + self.cmd)
        res += '</div></div>'
        return res
Exemplo n.º 12
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'

        res += html.safe_str(
            _(
                "Restoring the backup on the server '{0}'..."
            ).format(
                "{0} ({1}:{2})".format(s.name, s.host, s.port)
            )
        )

        res += '</div><div class="h5"><b>'
        res += html.safe_str(
            _("Running command:")
        )
        res += '</b><br><i>'
        res += html.safe_str(cmd)

        def cmdArg(x):
            if x:
                x = x.replace('\\', '\\\\')
                x = x.replace('"', '\\"')
                x = x.replace('""', '\\"')

                return ' "' + html.safe_str(x) + '"'

            return ''

        idx = 0
        no_args = len(args)
        for arg in args:
            if idx < no_args - 1:
                if arg[:2] == '--':
                    res += ' ' + arg
                else:
                    res += cmdArg(arg)
            idx += 1

        if no_args > 1:
            res += ' "' + html.safe_str(arg) + '"'

        res += '</i></div>'

        return res
Exemplo n.º 13
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'
        res += html.safe_str(
            _(
                "Copying table data '{0}.{1}' on database '{2}' for the server - '{3}'"
            ).format(
                self.schema, self.table, self.database,
                "{0} ({1}:{2})".format(s.name, s.host, s.port)
            )
        )

        res += '</div><div class="h5">'
        res += html.safe_str(
            _("Running command:")
        )
        res += '</b><br><span class="pg-bg-cmd">'
        res += html.safe_str(cmd)

        replace_next = False

        def cmdArg(x):
            if x:
                x = x.replace('\\', '\\\\')
                x = x.replace('"', '\\"')
                x = x.replace('""', '\\"')

                return ' "' + html.safe_str(x) + '"'

            return ''

        for arg in args:
            if arg and len(arg) >= 2 and arg[:2] == '--':
                if arg == '--command':
                    replace_next = True
                res += ' ' + arg
            elif replace_next:
                if self.storage:
                    arg = arg.replace(self.storage, '<STORAGE_DIR>')
                res += ' "' + html.safe_str(arg) + '"'
            else:
                res += cmdArg(arg)
        res += '</span></div>'

        return res
Exemplo n.º 14
0
    def details(self, cmd, args):

        res = None

        if self.data['op'] == "VACUUM":
            res = _('VACUUM ({0})')

            opts = []
            if self.data['vacuum_full']:
                opts.append(_('FULL'))
            if self.data['vacuum_freeze']:
                opts.append(_('FREEZE'))
            if self.data['verbose']:
                opts.append(_('VERBOSE'))

            res = res.format(', '.join(str(x) for x in opts))

        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 = '<div class="h5">' + html.safe_str(res)

        res += '</div><div class="h5">'
        res += html.safe_str(
            _("Running Query:")
        )
        res += '</b><br><i>'
        res += html.safe_str(self.query)
        res += '</i></div>'

        return res
Exemplo n.º 15
0
 def cmdArg(x):
     if x:
         x = html.safe_str(x)
         x = x.replace('\\', '\\\\')
         x = x.replace('"', '\\"')
         x = x.replace('""', '\\"')
         return ' "' + x + '"'
     return ''
Exemplo n.º 16
0
 def cmdArg(x):
     if x:
         x = html.safe_str(x)
         x = x.replace('\\', '\\\\')
         x = x.replace('"', '\\"')
         x = x.replace('""', '\\"')
         return ' "' + x + '"'
     return ''
Exemplo n.º 17
0
    def details(self, cmd, args):
        res = '<div>' + self.message
        res += '</div><div class="py-1">'
        res += '<div class="pg-bg-cmd enable-selection p-1">'
        res += html.safe_str(self.cmd)
        res += '</div></div>'

        return res
Exemplo n.º 18
0
    def details(self, cmd, args):

        res = None

        if self.data['op'] == "VACUUM":
            res = _('VACUUM ({0})')

            opts = []
            if self.data['vacuum_full']:
                opts.append(_('FULL'))
            if self.data['vacuum_freeze']:
                opts.append(_('FREEZE'))
            if self.data['verbose']:
                opts.append(_('VERBOSE'))

            res = res.format(', '.join(str(x) for x in opts))

        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 = '<div>' + html.safe_str(res)

        res += '</div><div>'
        res += html.safe_str(
            _("Running Query:")
        )
        res += '</b><br><i>'
        res += html.safe_str(self.query)
        res += '</i></div>'

        return res
Exemplo n.º 19
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        name, host, port = self.get_server_details()

        res = '<div>'
        res += _(
            "Copying table data '{0}.{1}' on database '{2}' "
            "for the server '{3}'"
        ).format(
            html.safe_str(self.schema),
            html.safe_str(self.table),
            html.safe_str(self.database),
            "{0} ({1}:{2})".format(
                html.safe_str(name),
                html.safe_str(host),
                html.safe_str(port)
            )
        )

        res += '</div><div class="py-1">'
        res += _("Running command:")
        res += '<div class="pg-bg-cmd enable-selection p-1">'
        res += html.safe_str(self._cmd)
        res += '</div></div>'

        return res
Exemplo n.º 20
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div>'
        res += _(
            "Copying table data '{0}.{1}' on database '{2}' "
            "for the server '{3}'..."
        ).format(
            html.safe_str(self.schema),
            html.safe_str(self.table),
            html.safe_str(self.database),
            "{0} ({1}:{2})".format(
                html.safe_str(s.name),
                html.safe_str(s.host),
                html.safe_str(s.port)
            )
        )

        res += '</div><div>'
        res += _("Running command:")
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(self._cmd)
        res += '</span></div>'

        return res
Exemplo n.º 21
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div>'
        res += _(
            "Copying table data '{0}.{1}' on database '{2}' "
            "for the server '{3}'"
        ).format(
            html.safe_str(self.schema),
            html.safe_str(self.table),
            html.safe_str(self.database),
            "{0} ({1}:{2})".format(
                html.safe_str(s.name),
                html.safe_str(s.host),
                html.safe_str(s.port)
            )
        )

        res += '</div><div class="py-1">'
        res += _("Running command:")
        res += '<div class="pg-bg-cmd enable-selection p-1">'
        res += html.safe_str(self._cmd)
        res += '</div></div>'

        return res
Exemplo n.º 22
0
    def get_server_name(self):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        if s is None:
            return _("Not available")
        return html.safe_str("{0} ({1}:{2})".format(s.name, s.host, s.port))
Exemplo n.º 23
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(id=self.sid,
                                   user_id=current_user.id).first()

        res = '<div class="h5">'

        res += html.safe_str(
            _("Restoring the backup on the server '{0}'...").format(
                "{0} ({1}:{2})".format(s.name, s.host, s.port)))

        res += '</div><div class="h5"><b>'
        res += html.safe_str(_("Running command:"))
        res += '</b><br><i>'
        res += html.safe_str(cmd)

        def cmdArg(x):
            if x:
                x = x.replace('\\', '\\\\')
                x = x.replace('"', '\\"')
                x = x.replace('""', '\\"')

                return ' "' + html.safe_str(x) + '"'

            return ''

        idx = 0
        no_args = len(args)
        for arg in args:
            if idx < no_args - 1:
                if arg[:2] == '--':
                    res += ' ' + arg
                else:
                    res += cmdArg(arg)
            idx += 1

        if no_args > 1:
            res += ' "' + html.safe_str(arg) + '"'

        res += '</i></div>'

        return res
Exemplo n.º 24
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(id=self.sid,
                                   user_id=current_user.id).first()

        res = '<div class="h5">'
        res += html.safe_str(
            _("Copying table data '{0}.{1}' on database '{2}' for the server - '{3}'"
              ).format(self.schema, self.table, self.database,
                       "{0} ({1}:{2})".format(s.name, s.host, s.port)))

        res += '</div><div class="h5">'
        res += html.safe_str(_("Running command:"))
        res += '</b><br><span class="pg-bg-cmd">'
        res += html.safe_str(cmd)

        replace_next = False

        def cmdArg(x):
            if x:
                x = x.replace('\\', '\\\\')
                x = x.replace('"', '\\"')
                x = x.replace('""', '\\"')

                return ' "' + html.safe_str(x) + '"'

            return ''

        for arg in args:
            if arg and len(arg) >= 2 and arg[:2] == '--':
                if arg == '--command':
                    replace_next = True
                res += ' ' + arg
            elif replace_next:
                if self.storage:
                    arg = arg.replace(self.storage, '<STORAGE_DIR>')
                res += ' "' + html.safe_str(arg) + '"'
            else:
                res += cmdArg(arg)
        res += '</span></div>'

        return res
Exemplo n.º 25
0
    def details(self, cmd, args):
        name, host, port = self.get_server_details()
        res = '<div>'

        res += html.safe_str(
            _(
                "Restoring backup on the server '{0}'..."
            ).format(
                "{0} ({1}:{2})".format(name, host, port)
            )
        )

        res += '</div><div><b>'
        res += html.safe_str(
            _("Running command:")
        )
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd)
        res += self.cmd
        res += '</span></div>'

        return res
Exemplo n.º 26
0
    def message(self):
        server_name = self.get_server_name()

        if self.backup_type == BACKUP.OBJECT:
            return _("Backing up an object on the server '{0}' "
                     "from database '{1}'").format(
                         server_name, html.safe_str(self.database))
        if self.backup_type == BACKUP.GLOBALS:
            return _("Backing up the global objects on "
                     "the server '{0}'").format(server_name)
        elif self.backup_type == BACKUP.SERVER:
            return _("Backing up the server '{0}'").format(server_name)
        else:
            # It should never reach here.
            return "Unknown Backup"
Exemplo n.º 27
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'

        if self.backup_type == BACKUP.OBJECT:
            res += html.safe_str(
                _(
                    "Backing up an object on the server '{0}' from database '{1}'..."
                ).format(
                    "{0} ({1}:{2})".format(s.name, s.host, s.port),
                    self.database
                )
            )
        elif self.backup_type == BACKUP.GLOBALS:
            res += html.safe_str(
                _("Backing up the global objects on the server '{0}'").format(
                    "{0} ({1}:{2})".format(s.name, s.host, s.port)
                )
            )
        elif self.backup_type == BACKUP.SERVER:
            res += html.safe_str(
                _("Backing up the server '{0}'").format(
                    "{0} ({1}:{2})".format(s.name, s.host, s.port)
                )
            )
        else:
            # It should never reach here.
            res += "Backup"

        res += '</div><div class="h5">'
        res += html.safe_str(
            _("Running command:")
        )
        res += '</b><br><i>'
        res += html.safe_str(cmd)

        replace_next = False

        def cmdArg(x):
            if x:
                x = x.replace('\\', '\\\\')
                x = x.replace('"', '\\"')
                x = x.replace('""', '\\"')

                return ' "' + html.safe_str(x) + '"'

            return ''

        for arg in args:
            if arg and len(arg) >= 2 and arg[:2] == '--':
                res += ' ' + arg
            elif replace_next:
                res += ' "' + html.safe_str(
                    self.bfile
                ) + '"'
            else:
                if arg == '--file':
                    replace_next = True
                res += cmdArg(arg)
        res += '</i></div>'

        return res
Exemplo n.º 28
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'

        if self.backup_type == BACKUP.OBJECT:
            res += _(
                "Backing up an object on the server '{0}' "
                "from database '{1}'..."
            ).format(
                "{0} ({1}:{2})".format(
                    html.safe_str(s.name),
                    html.safe_str(s.host),
                    html.safe_str(s.port),
                ),
                html.safe_str(self.database)
            )
        elif self.backup_type == BACKUP.GLOBALS:
            res += _("Backing up the global objects on "
                     "the server '{0}'...").format(
                "{0} ({1}:{2})".format(
                    html.safe_str(s.name),
                    html.safe_str(s.host),
                    html.safe_str(s.port)
                )
            )
        elif self.backup_type == BACKUP.SERVER:
            res += _("Backing up the server '{0}'...").format(
                "{0} ({1}:{2})".format(
                    html.safe_str(s.name),
                    html.safe_str(s.host),
                    html.safe_str(s.port)
                )
            )
        else:
            # It should never reach here.
            res += "Backup"

        res += '</div><div class="h5">'
        res += _("Running command:")
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd + self.cmd)
        res += '</span></div>'

        return res
Exemplo n.º 29
0
    def details(self, cmd, args):
        name, host, port = self.get_server_details()

        res = '<div>'

        if self.backup_type == BACKUP.OBJECT:
            res += _(
                "Backing up an object on the server '{0}' "
                "from database '{1}'..."
            ).format(
                "{0} ({1}:{2})".format(
                    html.safe_str(name),
                    html.safe_str(host),
                    html.safe_str(port),
                ),
                html.safe_str(self.database)
            )
        elif self.backup_type == BACKUP.GLOBALS:
            res += _("Backing up the global objects on "
                     "the server '{0}'...").format(
                "{0} ({1}:{2})".format(
                    html.safe_str(name),
                    html.safe_str(host),
                    html.safe_str(port)
                )
            )
        elif self.backup_type == BACKUP.SERVER:
            res += _("Backing up the server '{0}'...").format(
                "{0} ({1}:{2})".format(
                    html.safe_str(name),
                    html.safe_str(host),
                    html.safe_str(port)
                )
            )
        else:
            # It should never reach here.
            res += "Backup"

        res += '</div><div>'
        res += _("Running command:")
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd + self.cmd)
        res += '</span></div>'

        return res
Exemplo n.º 30
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(
            id=self.sid, user_id=current_user.id
        ).first()

        res = '<div class="h5">'

        if self.backup_type == BACKUP.OBJECT:
            res += _(
                "Backing up an object on the server '{0}' "
                "from database '{1}'..."
            ).format(
                "{0} ({1}:{2})".format(
                    html.safe_str(s.name),
                    html.safe_str(s.host),
                    html.safe_str(s.port),
                ),
                html.safe_str(self.database)
            )
        elif self.backup_type == BACKUP.GLOBALS:
            res += _("Backing up the global objects on "
                     "the server '{0}'...").format(
                "{0} ({1}:{2})".format(
                    html.safe_str(s.name),
                    html.safe_str(s.host),
                    html.safe_str(s.port)
                )
            )
        elif self.backup_type == BACKUP.SERVER:
            res += _("Backing up the server '{0}'...").format(
                "{0} ({1}:{2})".format(
                    html.safe_str(s.name),
                    html.safe_str(s.host),
                    html.safe_str(s.port)
                )
            )
        else:
            # It should never reach here.
            res += "Backup"

        res += '</div><div class="h5">'
        res += _("Running command:")
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd + self.cmd)
        res += '</span></div>'

        return res
Exemplo n.º 31
0
    def message(self):
        name, host, port = self.get_server_details()

        return _("Restoring backup on the server '{0}'").format(
            "{0} ({1}:{2})".format(html.safe_str(name), html.safe_str(host),
                                   html.safe_str(port)), )
Exemplo n.º 32
0
    def details(self, cmd, args):
        # Fetch the server details like hostname, port, roles etc
        s = Server.query.filter_by(id=self.sid,
                                   user_id=current_user.id).first()

        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

        res = '<div class="h5">'

        if self.backup_type == BACKUP.OBJECT:
            res += _("Backing up an object on the server '{0}' "
                     "from database '{1}'...").format(
                         "{0} ({1}:{2})".format(
                             html.safe_str(s.name),
                             html.safe_str(host),
                             html.safe_str(port),
                         ), html.safe_str(self.database))
        elif self.backup_type == BACKUP.GLOBALS:
            res += _("Backing up the global objects on "
                     "the server '{0}'...").format("{0} ({1}:{2})".format(
                         html.safe_str(s.name), html.safe_str(host),
                         html.safe_str(port)))
        elif self.backup_type == BACKUP.SERVER:
            res += _("Backing up the server '{0}'...").format(
                "{0} ({1}:{2})".format(html.safe_str(s.name),
                                       html.safe_str(host),
                                       html.safe_str(port)))
        else:
            # It should never reach here.
            res += "Backup"

        res += '</div><div class="h5">'
        res += _("Running command:")
        res += '</b><br><span class="pg-bg-cmd enable-selection">'
        res += html.safe_str(cmd + self.cmd)
        res += '</span></div>'

        return res