Пример #1
0
class MiscModule(PgAdminModule):
    def get_own_javascripts(self):
        return [
            {
                'name': 'pgadmin.misc.explain',
                'path': url_for('misc.index') + 'explain/explain',
                'preloaded': False
            }, {
                'name': 'snap.svg',
                'path': url_for(
                    'misc.static', filename='explain/vendor/snap.svg/' + (
                        'snap.svg' if config.DEBUG else 'snap.svg-min'
                    )),
                'preloaded': False
            }
        ]

    def get_own_stylesheets(self):
        stylesheets = []
        stylesheets.append(
            url_for('misc.static', filename='explain/css/explain.css')
        )
        return stylesheets

    def register_preferences(self):
        """
        Register preferences for this module.
        """
        self.misc_preference = Preferences(
            'miscellaneous', gettext('Miscellaneous')
        )

        lang_options = []
        for lang in config.LANGUAGES:
            lang_options.append(
                {
                    'label': config.LANGUAGES[lang],
                    'value': lang
                }
            )

        # Register options for the User language settings
        self.misc_preference.register(
            'miscellaneous', 'user_language',
            gettext("User language"), 'options', 'en',
            category_label=gettext('User language'),
            options=lang_options
        )

    def get_exposed_url_endpoints(self):
        """
        Returns:
            list: a list of url endpoints exposed to the client.
        """
        return ['misc.ping', 'misc.index']
Пример #2
0
class MiscModule(PgAdminModule):
    def get_own_javascripts(self):
        return [
            {
                'name': 'pgadmin.misc.explain',
                'path': url_for('misc.index') + 'explain/explain',
                'preloaded': False
            }, {
                'name': 'snap.svg',
                'path': url_for(
                    'misc.static', filename='explain/vendor/snap.svg/' + (
                        'snap.svg' if config.DEBUG else 'snap.svg-min'
                    )),
                'preloaded': False
            }
        ]

    def get_own_stylesheets(self):
        stylesheets = []
        stylesheets.append(
            url_for('misc.static', filename='explain/css/explain.css')
        )
        return stylesheets

    def register_preferences(self):
        """
        Register preferences for this module.
        """
        self.misc_preference = Preferences(
            'miscellaneous', gettext('Miscellaneous')
        )

        lang_options = []
        for lang in config.LANGUAGES:
            lang_options.append(
                {
                    'label': config.LANGUAGES[lang],
                    'value': lang
                }
            )

        # Register options for the User language settings
        self.misc_preference.register(
            'miscellaneous', 'user_language',
            gettext("User language"), 'options', 'en',
            category_label=gettext('User language'),
            options=lang_options
        )

    def get_exposed_url_endpoints(self):
        """
        Returns:
            list: a list of url endpoints exposed to the client.
        """
        return ['misc.ping', 'misc.index']
Пример #3
0
    def register_preferences(cls):
        paths = Preferences('paths', _('Paths'))

        for key in cls.registry:
            st = cls.registry[key]
            default_path = config.DEFAULT_BINARY_PATHS.get(st.stype, "")

            st.utility_path = paths.register(
                'bin_paths', st.stype + '_bin_dir',
                st.UTILITY_PATH_LABEL,
                'text', default_path, category_label=_('Binary paths'),
                help_str=st.UTILITY_PATH_HELP
            )
Пример #4
0
    def register_preferences(cls):
        paths = Preferences('paths', _('Paths'))

        for key in cls.registry:
            st = cls.registry[key]
            default_path = config.DEFAULT_BINARY_PATHS.get(st.stype, "")

            st.utility_path = paths.register(
                'bin_paths', st.stype + '_bin_dir',
                st.UTILITY_PATH_LABEL,
                'text', default_path, category_label=_('Binary paths'),
                help_str=st.UTILITY_PATH_HELP
            )
Пример #5
0
class HelpModule(PgAdminModule):
    def get_own_menuitems(self):
        """Return a (set) of dicts of help menu items, with name, priority,
        URL, target and onclick code."""
        return {
            'help_items': [
                MenuItem(name='mnu_online_help',
                         label=gettext('Online Help'),
                         priority=100,
                         target='pgadmin_help',
                         icon='fa fa-question',
                         url=url_for('help.static', filename='index.html')),
                MenuItem(name='mnu_pgadmin_website',
                         label=gettext('pgAdmin Website'),
                         priority=200,
                         target='pgadmin_website',
                         icon='fa fa-external-link-alt',
                         url='https://www.pgadmin.org/'),
                MenuItem(name='mnu_postgresql_website',
                         label=gettext('PostgreSQL Website'),
                         priority=300,
                         target='postgres_website',
                         icon='fa fa-external-link-alt',
                         url='https://www.postgresql.org/')
            ]
        }

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.help_preference = Preferences('paths', gettext('Paths'))

        self.pg_help_path = self.help_preference.register(
            'help',
            'pg_help_path',
            gettext("PostgreSQL Help Path"),
            'text',
            'https://www.postgresql.org/docs/$VERSION$/',
            category_label=gettext('Help'),
            help_str=gettext(
                'Path to the PostgreSQL documentation. $VERSION$ will be '
                'replaced with the major.minor version number.'))

    def get_exposed_url_endpoints(self):
        """
        Returns the list of URLs exposed to the client.
        """
        return ['help.static']
Пример #6
0
    def register_preferences(cls):
        paths = Preferences('paths', _('Paths'))

        for key in cls.registry:
            st = cls.registry[key]

            st.utility_path = paths.register(
                'bin_paths',
                st.stype + '_bin_dir',
                _("{0} Binary Path").format(st.desc),
                'text',
                "",
                category_label=_('Binary paths'),
                help_str=_("Path to the {0} binary utilities.".format(
                    st.desc)))
Пример #7
0
    def register_preferences(cls):
        paths = Preferences('paths', _('Paths'))

        for key in cls.registry:
            st = cls.registry[key]

            st.utility_path = paths.register(
                'bin_paths', st.stype + '_bin_dir',
                _("{0} Binary Path").format(st.desc),
                'text', "", category_label=_('Binary paths'),
                help_str=_(
                    "Path to the {0} binary utilities.".format(
                        st.desc
                    )
                )
            )
Пример #8
0
    def register_preferences(cls):
        paths = Preferences('paths', _('Paths'))

        for key in cls.registry:
            st = cls.registry[key]
            default_path = config.DEFAULT_BINARY_PATHS[st.stype] or ""

            st.utility_path = paths.register(
                'bin_paths', st.stype + '_bin_dir',
                _("{0} Binary Path").format(st.desc),
                'text', default_path, category_label=_('Binary paths'),
                help_str=_(
                    "Path to the directory containing the {0} utility programs (pg_dump, pg_restore etc).".format(
                        st.desc
                    )
                )
            )
Пример #9
0
class DashboardModule(PgAdminModule):
    def __init__(self, *args, **kwargs):
        super(DashboardModule, self).__init__(*args, **kwargs)

    def get_own_menuitems(self):
        return {}

    def get_own_javascripts(self):
        return [{
            'name': 'pgadmin.dashboard',
            'path': url_for('dashboard.index') + 'dashboard',
            'when': None
        }]

    def get_own_stylesheets(self):
        """
        Returns:
            list: the stylesheets used by this module.
        """
        stylesheets = []
        return stylesheets

    def get_panels(self):
        return [
            Panel(name='dashboard',
                  priority=1,
                  title=gettext('Dashboard'),
                  icon='',
                  content='',
                  is_closeable=True,
                  is_private=False,
                  limit=1,
                  is_iframe=False,
                  can_hide=True).__dict__
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        help_string = gettext('The number of seconds between graph samples.')

        # Register options for the PG and PPAS help paths
        self.dashboard_preference = Preferences('dashboards',
                                                gettext('Dashboards'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'session_stats_refresh',
            gettext("Session statistics refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=help_string)

        self.tps_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'tps_stats_refresh',
            gettext("Transaction throughput refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=help_string)

        self.ti_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'ti_stats_refresh',
            gettext("Tuples in refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=help_string)

        self.to_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'to_stats_refresh',
            gettext("Tuples out refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=help_string)

        self.bio_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'bio_stats_refresh',
            gettext("Block I/O statistics refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=help_string)

        self.display_graphs = self.dashboard_preference.register(
            'display',
            'show_graphs',
            gettext("Show graphs?"),
            'boolean',
            True,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, graphs '
                             'will be displayed on dashboards.'))

        self.display_server_activity = self.dashboard_preference.register(
            'display',
            'show_activity',
            gettext("Show activity?"),
            'boolean',
            True,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, activity tables '
                             'will be displayed on dashboards.'))

        self.graph_data_points = self.dashboard_preference.register(
            'display',
            'graph_data_points',
            gettext("Show graph data points?"),
            'boolean',
            False,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, data points will be '
                             'visible on graph lines.'))

        self.graph_mouse_track = self.dashboard_preference.register(
            'display',
            'graph_mouse_track',
            gettext("Show mouse hover tooltip?"),
            'boolean',
            True,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, tooltip will appear on mouse '
                             'hover on the graph lines giving the data point '
                             'details'))

    def get_exposed_url_endpoints(self):
        """
        Returns:
            list: a list of url endpoints exposed to the client.
        """
        return [
            'dashboard.index',
            'dashboard.get_by_sever_id',
            'dashboard.get_by_database_id',
            'dashboard.dashboard_stats',
            'dashboard.dashboard_stats_sid',
            'dashboard.dashboard_stats_did',
            'dashboard.activity',
            'dashboard.get_activity_by_server_id',
            'dashboard.get_activity_by_database_id',
            'dashboard.locks',
            'dashboard.get_locks_by_server_id',
            'dashboard.get_locks_by_database_id',
            'dashboard.prepared',
            'dashboard.get_prepared_by_server_id',
            'dashboard.get_prepared_by_database_id',
            'dashboard.config',
            'dashboard.get_config_by_server_id',
        ]
Пример #10
0
class HelpModule(PgAdminModule):
    def get_own_menuitems(self):
        """Return a (set) of dicts of help menu items, with name, priority, URL,
        target and onclick code."""
        return {
            'help_items': [
                MenuItem(name='mnu_online_help',
                         label=gettext('Online Help'),
                         priority=100,
                         target='_blank',
                         icon='fa fa-question',
                         url=url_for('help.static', filename='index.html')),
                MenuItem(name='mnu_pgadmin_website',
                         label=gettext('pgAdmin Website'),
                         priority=200,
                         target='_blank',
                         icon='fa fa-external-link',
                         url='https://www.pgadmin.org/'),
                MenuItem(name='mnu_postgresql_website',
                         label=gettext('PostgreSQL Website'),
                         priority=300,
                         target='_blank',
                         icon='fa fa-external-link',
                         url='http://www.postgresql.org/')
            ]
        }

    def get_panels(self):
        return [
            Panel(name='pnl_online_help',
                  priority=100,
                  isPrivate=True,
                  title=gettext('Online Help'),
                  icon='fa fa-question'),
            Panel(name='pnl_pgadmin_website',
                  priority=200,
                  title=gettext('pgAdmin Website'),
                  icon='fa fa-external-link',
                  content='https://www.pgadmin.org/'),
            Panel(name='pnl_postgresql_website',
                  priority=300,
                  title=gettext('PostgreSQL Website'),
                  icon='fa fa-external-link',
                  content='http://www.postgresql.org/'),
            Panel(name='pnl_sql_help',
                  priority=400,
                  isPrivate=True,
                  icon='fa fa-info',
                  title=gettext('SQL Help'))
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.help_preference = Preferences('paths', gettext('Paths'))

        self.pg_help_path = self.help_preference.register(
            'help',
            'pg_help_path',
            gettext("PostgreSQL Help Path"),
            'text',
            'http://www.postgresql.org/docs/$VERSION$/static/',
            category_label=gettext('Help'),
            help_str=gettext(
                'Path to the PostgreSQL documentation. $VERSION$ will be replaced with the major.minor version number.'
            ))

        self.edbas_help_path = self.help_preference.register(
            'help',
            'edbas_help_path',
            gettext("EDB Advanced Server Help Path"),
            'text',
            'http://www.enterprisedb.com/docs/en/$VERSION$/pg/',
            category_label=gettext('Help'),
            help_str=gettext(
                'Path to the EDB Advanced Server documentation. $VERSION$ will be replaced with the major.minor version number.'
            ))
Пример #11
0
class DashboardModule(PgAdminModule):
    def __init__(self, *args, **kwargs):
        super(DashboardModule, self).__init__(*args, **kwargs)

    def get_own_menuitems(self):
        return {}

    def get_own_stylesheets(self):
        """
        Returns:
            list: the stylesheets used by this module.
        """
        stylesheets = []
        return stylesheets

    def get_panels(self):
        return [
            Panel(name='dashboard',
                  priority=1,
                  title=gettext('Dashboard'),
                  icon='',
                  content='',
                  is_closeable=True,
                  is_private=False,
                  limit=1,
                  is_iframe=False,
                  can_hide=True).__dict__
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        help_string = gettext('The number of seconds between graph samples.')

        # Register options for Dashboards
        self.dashboard_preference = Preferences('dashboards',
                                                gettext('Dashboards'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'session_stats_refresh',
            gettext("Session statistics refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=PREF_LABEL_REFRESH_RATES,
            help_str=help_string)

        self.tps_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'tps_stats_refresh',
            gettext("Transaction throughput refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=PREF_LABEL_REFRESH_RATES,
            help_str=help_string)

        self.ti_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'ti_stats_refresh',
            gettext("Tuples in refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=PREF_LABEL_REFRESH_RATES,
            help_str=help_string)

        self.to_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'to_stats_refresh',
            gettext("Tuples out refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=PREF_LABEL_REFRESH_RATES,
            help_str=help_string)

        self.bio_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'bio_stats_refresh',
            gettext("Block I/O statistics refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=PREF_LABEL_REFRESH_RATES,
            help_str=help_string)

        self.display_graphs = self.dashboard_preference.register(
            'display',
            'show_graphs',
            gettext("Show graphs?"),
            'boolean',
            True,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, graphs '
                             'will be displayed on dashboards.'))

        self.display_server_activity = self.dashboard_preference.register(
            'display',
            'show_activity',
            gettext("Show activity?"),
            'boolean',
            True,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, activity tables '
                             'will be displayed on dashboards.'))

        self.long_running_query_threshold = self.dashboard_preference.register(
            'display',
            'long_running_query_threshold',
            gettext('Long running query thresholds'),
            'threshold',
            '2|5',
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('Set the warning and alert threshold value to '
                             'highlight the long-running queries on the '
                             'dashboard.'))

        # Register options for Graphs
        self.graphs_preference = Preferences('graphs', gettext('Graphs'))

        self.graph_data_points = self.graphs_preference.register(
            'graphs',
            'graph_data_points',
            gettext("Show graph data points?"),
            'boolean',
            False,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, data points will be '
                             'visible on graph lines.'))

        self.use_diff_point_style = self.graphs_preference.register(
            'graphs',
            'use_diff_point_style',
            gettext("Use different data point styles?"),
            'boolean',
            False,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, data points will be visible '
                             'in a different style on each graph lines.'))

        self.graph_mouse_track = self.graphs_preference.register(
            'graphs',
            'graph_mouse_track',
            gettext("Show mouse hover tooltip?"),
            'boolean',
            True,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('If set to True, tooltip will appear on mouse '
                             'hover on the graph lines giving the data point '
                             'details'))

        self.graph_line_border_width = self.graphs_preference.register(
            'graphs',
            'graph_line_border_width',
            gettext("Chart line width"),
            'integer',
            1,
            min_val=1,
            max_val=10,
            category_label=PREF_LABEL_DISPLAY,
            help_str=gettext('Set the width of the lines on the line chart.'))

    def get_exposed_url_endpoints(self):
        """
        Returns:
            list: a list of url endpoints exposed to the client.
        """
        return [
            'dashboard.index',
            'dashboard.get_by_sever_id',
            'dashboard.get_by_database_id',
            'dashboard.dashboard_stats',
            'dashboard.dashboard_stats_sid',
            'dashboard.dashboard_stats_did',
            'dashboard.activity',
            'dashboard.get_activity_by_server_id',
            'dashboard.get_activity_by_database_id',
            'dashboard.locks',
            'dashboard.get_locks_by_server_id',
            'dashboard.get_locks_by_database_id',
            'dashboard.prepared',
            'dashboard.get_prepared_by_server_id',
            'dashboard.get_prepared_by_database_id',
            'dashboard.config',
            'dashboard.get_config_by_server_id',
        ]
Пример #12
0
    def register_preferences(cls):
        paths = Preferences('paths', _('Paths'))
        bin_paths = copy.deepcopy(BINARY_PATHS)

        for key in cls.registry:
            st = cls.registry[key]

            if key not in ['pg', 'ppas']:
                continue

            if key == 'pg':
                # Set the DEFAULT_BINARY_PATHS if any
                ServerType.set_default_binary_path(bin_paths['pg_bin_paths'],
                                                   key)

                st.utility_path = paths.register(
                    'bin_paths',
                    'pg_bin_dir',
                    _("PostgreSQL Binary Path"),
                    'selectFile',
                    json.dumps(bin_paths['pg_bin_paths']),
                    category_label=_('Binary paths'))
            elif key == 'ppas':
                # Set the DEFAULT_BINARY_PATHS if any
                ServerType.set_default_binary_path(bin_paths['as_bin_paths'],
                                                   key)

                st.utility_path = paths.register(
                    'bin_paths',
                    'ppas_bin_dir',
                    _("EDB Advanced Server Binary Path"),
                    'selectFile',
                    json.dumps(bin_paths['as_bin_paths']),
                    category_label=_('Binary paths'))

            def path_converter(old_path):
                """
                This function is used to convert old path to the
                new paths which are in JSON format.
                """
                bin_paths_server_based = \
                    copy.deepcopy(BINARY_PATHS['pg_bin_paths'])
                if key == 'ppas':
                    bin_paths_server_based = \
                        copy.deepcopy(BINARY_PATHS['as_bin_paths'])

                if not ServerType.is_binary_path_of_type_json(old_path):
                    set_binary_path(old_path,
                                    bin_paths_server_based,
                                    key,
                                    set_as_default=True)
                else:
                    bin_paths_server_based = json.loads(old_path)

                # Set the DEFAULT_BINARY_PATHS if any
                ServerType.set_default_binary_path(bin_paths_server_based, key)

                return json.dumps(bin_paths_server_based)

            # Run the migrate user preferences.
            paths.migrate_user_preferences(st.utility_path.pid, path_converter)
Пример #13
0
class DashboardModule(PgAdminModule):
    def __init__(self, *args, **kwargs):
        super(DashboardModule, self).__init__(*args, **kwargs)

    def get_own_menuitems(self):
        return {}

    def get_own_javascripts(self):
        return [{
            'name': 'pgadmin.dashboard',
            'path': url_for('dashboard.index') + 'dashboard',
            'when': None
        }]

    def get_own_stylesheets(self):
        """
        Returns:
            list: the stylesheets used by this module.
        """
        stylesheets = [
            url_for('dashboard.static', filename='css/dashboard.css')
        ]
        return stylesheets

    def get_panels(self):
        return [
            Panel(
                name='dashboard',
                priority=1,
                title=gettext('Dashboard'),
                icon='fa fa-tachometer',
                content='',
                isCloseable=True,
                isPrivate=False,
                limit=1,
                isIframe=False,
                canHide=True
            ).__dict__
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.dashboard_preference = Preferences(
            'dashboards', gettext('Dashboards')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'session_stats_refresh',
            gettext("Session statistics refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'tps_stats_refresh',
            gettext("Transaction throughput refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'ti_stats_refresh',
            gettext("Tuples in refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'to_stats_refresh',
            gettext("Tuples out refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'bio_stats_refresh',
            gettext("Block I/O statistics refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.display_graphs = self.dashboard_preference.register(
            'display', 'show_graphs',
            gettext("Show graphs?"), 'boolean', True,
            category_label=gettext('Display'),
            help_str=gettext('If set to True, graphs '
                             'will be displayed on dashboards.')
        )

        self.display_server_activity = self.dashboard_preference.register(
            'display', 'show_activity',
            gettext("Show activity?"), 'boolean', True,
            category_label=gettext('Display'),
            help_str=gettext('If set to True, activity tables '
                             'will be displayed on dashboards.')
        )

    def get_exposed_url_endpoints(self):
        """
        Returns:
            list: a list of url endpoints exposed to the client.
        """
        return [
            'dashboard.index', 'dashboard.get_by_sever_id',
            'dashboard.get_by_database_id',
            'dashboard.session_stats',
            'dashboard.get_session_stats_by_sever_id',
            'dashboard.get_session_stats_by_database_id',
            'dashboard.tps_stats',
            'dashboard.tps_stats_by_server_id',
            'dashboard.tps_stats_by_database_id',
            'dashboard.ti_stats',
            'dashboard.ti_stats_by_server_id',
            'dashboard.ti_stats_by_database_id',
            'dashboard.to_stats',
            'dashboard.to_stats_by_server_id',
            'dashboard.to_stats_by_database_id',
            'dashboard.bio_stats',
            'dashboard.bio_stats_by_server_id',
            'dashboard.bio_stats_by_database_id',
            'dashboard.activity',
            'dashboard.get_activity_by_server_id',
            'dashboard.get_activity_by_database_id',
            'dashboard.locks',
            'dashboard.get_locks_by_server_id',
            'dashboard.get_locks_by_database_id',
            'dashboard.prepared',
            'dashboard.get_prepared_by_server_id',
            'dashboard.get_prepared_by_database_id',
            'dashboard.config',
            'dashboard.get_config_by_server_id',
        ]
Пример #14
0
class DashboardModule(PgAdminModule):
    def __init__(self, *args, **kwargs):
        super(DashboardModule, self).__init__(*args, **kwargs)

    def get_own_menuitems(self):
        return {}

    def get_own_javascripts(self):
        return [{
            'name': 'pgadmin.dashboard',
            'path': url_for('dashboard.index') + 'dashboard',
            'when': None
        }]

    def get_own_stylesheets(self):
        """
        Returns:
            list: the stylesheets used by this module.
        """
        stylesheets = [
            url_for('dashboard.static', filename='css/dashboard.css')
        ]
        return stylesheets

    def get_panels(self):
        return [
            Panel(
                name='dashboard',
                priority=1,
                title=gettext('Dashboard'),
                icon='fa fa-tachometer',
                content='',
                isCloseable=False,
                isPrivate=True,
                isIframe=False)
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.dashboard_preference = Preferences('dashboards', gettext('Dashboards'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'session_stats_refresh',
            gettext("Session statistics refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'tps_stats_refresh',
            gettext("Transaction throughput refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'ti_stats_refresh',
            gettext("Tuples in refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'to_stats_refresh',
            gettext("Tuples out refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'bio_stats_refresh',
            gettext("Block I/O statistics refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )
Пример #15
0
class HelpModule(PgAdminModule):
    def get_own_menuitems(self):
        """Return a (set) of dicts of help menu items, with name, priority,
        URL, target and onclick code."""
        return {'help_items': [
            MenuItem(name='mnu_online_help',
                     label=gettext('Online Help'),
                     priority=100,
                     target='_blank',
                     icon='fa fa-question',
                     url=url_for('help.static', filename='index.html')),

            MenuItem(name='mnu_pgadmin_website',
                     label=gettext('pgAdmin Website'),
                     priority=200,
                     target='_blank',
                     icon='fa fa-external-link',
                     url='https://www.pgadmin.org/'),

            MenuItem(name='mnu_postgresql_website',
                     label=gettext('PostgreSQL Website'),
                     priority=300,
                     target='_blank',
                     icon='fa fa-external-link',
                     url='https://www.postgresql.org/')]}

    def get_panels(self):
        return [
            Panel(
                name='pnl_online_help',
                priority=100,
                isPrivate=True,
                title=gettext('Online Help'),
                icon='fa fa-question').__dict__,

            Panel(
                name='pnl_sql_help',
                priority=200,
                isPrivate=True,
                icon='fa fa-info',
                title=gettext('SQL Help')).__dict__]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.help_preference = Preferences('paths', gettext('Paths'))

        self.pg_help_path = self.help_preference.register(
            'help', 'pg_help_path',
            gettext("PostgreSQL Help Path"), 'text',
            'https://www.postgresql.org/docs/$VERSION$/static/',
            category_label=gettext('Help'),
            help_str=gettext(
                'Path to the PostgreSQL documentation. $VERSION$ will be '
                'replaced with the major.minor version number.'
            )
        )

        self.edbas_help_path = self.help_preference.register(
            'help', 'edbas_help_path',
            gettext("EDB Advanced Server Help Path"), 'text',
            'https://www.enterprisedb.com/docs/en/$VERSION$/pg/',
            category_label=gettext('Help'),
            help_str=gettext(
                'Path to the EDB Advanced Server documentation. $VERSION$ '
                'will be replaced with the major.minor version number.'
            )
        )

    def get_exposed_url_endpoints(self):
        """
        Returns the list of URLs exposed to the client.
        """
        return ['help.static']
Пример #16
0
class DashboardModule(PgAdminModule):
    def __init__(self, *args, **kwargs):
        super(DashboardModule, self).__init__(*args, **kwargs)

    def get_own_menuitems(self):
        return {}

    def get_own_javascripts(self):
        return [{
            'name': 'pgadmin.dashboard',
            'path': url_for('dashboard.index') + 'dashboard',
            'when': None
        }]

    def get_own_stylesheets(self):
        """
        Returns:
            list: the stylesheets used by this module.
        """
        stylesheets = [
            url_for('dashboard.static', filename='css/dashboard.css')
        ]
        return stylesheets

    def get_panels(self):
        return [
            Panel(
                name='dashboard',
                priority=1,
                title=gettext('Dashboard'),
                icon='fa fa-tachometer',
                content='',
                isCloseable=True,
                isPrivate=False,
                limit=1,
                isIframe=False,
                canHide=True
            ).__dict__
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.dashboard_preference = Preferences(
            'dashboards', gettext('Dashboards')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'session_stats_refresh',
            gettext("Session statistics refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'tps_stats_refresh',
            gettext("Transaction throughput refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'ti_stats_refresh',
            gettext("Tuples in refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'to_stats_refresh',
            gettext("Tuples out refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards', 'bio_stats_refresh',
            gettext("Block I/O statistics refresh rate"), 'integer',
            1, min_val=1, max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.')
        )

        self.display_graphs = self.dashboard_preference.register(
            'display', 'show_graphs',
            gettext("Show graphs?"), 'boolean', True,
            category_label=gettext('Display'),
            help_str=gettext('If set to True, graphs '
                             'will be displayed on dashboards.')
        )

        self.display_server_activity = self.dashboard_preference.register(
            'display', 'show_activity',
            gettext("Show activity?"), 'boolean', True,
            category_label=gettext('Display'),
            help_str=gettext('If set to True, activity tables '
                             'will be displayed on dashboards.')
        )

    def get_exposed_url_endpoints(self):
        """
        Returns:
            list: a list of url endpoints exposed to the client.
        """
        return [
            'dashboard.index', 'dashboard.get_by_sever_id',
            'dashboard.get_by_database_id',
            'dashboard.session_stats',
            'dashboard.get_session_stats_by_sever_id',
            'dashboard.get_session_stats_by_database_id',
            'dashboard.tps_stats',
            'dashboard.tps_stats_by_server_id',
            'dashboard.tps_stats_by_database_id',
            'dashboard.ti_stats',
            'dashboard.ti_stats_by_server_id',
            'dashboard.ti_stats_by_database_id',
            'dashboard.to_stats',
            'dashboard.to_stats_by_server_id',
            'dashboard.to_stats_by_database_id',
            'dashboard.bio_stats',
            'dashboard.bio_stats_by_server_id',
            'dashboard.bio_stats_by_database_id',
            'dashboard.activity',
            'dashboard.get_activity_by_server_id',
            'dashboard.get_activity_by_database_id',
            'dashboard.locks',
            'dashboard.get_locks_by_server_id',
            'dashboard.get_locks_by_database_id',
            'dashboard.prepared',
            'dashboard.get_prepared_by_server_id',
            'dashboard.get_prepared_by_database_id',
            'dashboard.config',
            'dashboard.get_config_by_server_id',
        ]
Пример #17
0
class DashboardModule(PgAdminModule):
    def __init__(self, *args, **kwargs):
        super(DashboardModule, self).__init__(*args, **kwargs)

    def get_own_menuitems(self):
        return {}

    def get_own_javascripts(self):
        return [{
            'name': 'pgadmin.dashboard',
            'path': url_for('dashboard.index') + 'dashboard',
            'when': None
        }]

    def get_own_stylesheets(self):
        """
        Returns:
            list: the stylesheets used by this module.
        """
        stylesheets = [
            url_for('dashboard.static', filename='css/dashboard.css')
        ]
        return stylesheets

    def get_panels(self):
        return [
            Panel(name='dashboard',
                  priority=1,
                  title=gettext('Dashboard'),
                  icon='fa fa-tachometer',
                  content='',
                  isCloseable=False,
                  isPrivate=True,
                  isIframe=False)
        ]

    def register_preferences(self):
        """
        register_preferences
        Register preferences for this module.
        """
        # Register options for the PG and PPAS help paths
        self.dashboard_preference = Preferences('dashboards',
                                                gettext('Dashboards'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'session_stats_refresh',
            gettext("Session statistics refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'tps_stats_refresh',
            gettext("Transaction throughput refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'ti_stats_refresh',
            gettext("Tuples in refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'to_stats_refresh',
            gettext("Tuples out refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.'))

        self.session_stats_refresh = self.dashboard_preference.register(
            'dashboards',
            'bio_stats_refresh',
            gettext("Block I/O statistics refresh rate"),
            'integer',
            1,
            min_val=1,
            max_val=999999,
            category_label=gettext('Graphs'),
            help_str=gettext('The number of seconds between graph samples.'))