コード例 #1
0
    def test_create_dashboard_multi_ds(self, mock_get_dashboard_name):
        """ Test the creation of dashboards with filtered data sources """
        mock_get_dashboard_name.return_value = ''

        config = Config(CONF_FILE)
        task = TaskPanels(config)

        task.execute()
コード例 #2
0
    def test_create_dashboard_stackexchange(self, mock_get_dashboard_name, mock_import_dashboard):
        """ Test the creation of a dashboard which includes stackexchange in data sources """
        mock_get_dashboard_name.return_value = ''

        config = Config(CONF_FILE)
        task = TaskPanels(config)

        task.create_dashboard(None, data_sources=["stackexchange"])
コード例 #3
0
    def test_initialization(self):
        """Test whether attributes are initializated"""

        config = Config(CONF_FILE)
        task = TaskPanels(config)

        self.assertEqual(task.config, config)
コード例 #4
0
def get_panels(config):
    """Execute the panels phase

    :param config: a Mordred config object
    """

    task = TaskPanels(config)
    task.execute()

    task = TaskPanelsMenu(config)
    task.execute()

    logging.info("Panels creation finished!")
コード例 #5
0
def main():
    """This script allows to upload the dashboards in use in the setup.cfg and the top menu. It
    relies on the TaskPanels and TaskPanelsMenu classes.

    Examples:
        Upload dashboards and menu: panels_config --cfg ./setup.cfg --dashboards --menu
        Upload only the dashboards: panels_config --cfg ./setup.cfg --dashboards
        Upload only the top menu:   panels_config --cfg ./setup.cfg --menu
    """
    args = get_params()
    config = Config(args.cfg_path)

    upload_dashboards = args.dashboards
    upload_menu = args.menu

    if upload_dashboards:
        task = TaskPanels(config)
        task.execute()

    if upload_menu:
        task = TaskPanelsMenu(config)
        task.execute()