예제 #1
0
    def show(self) -> None:
        items = self._core_toggles()
        sites.update_site_states_from_dead_sites()

        site_status_info: Dict[sites.SiteId, List] = {}
        try:
            sites.live().set_prepend_site(True)
            for row in sites.live().query(
                "GET status\nColumns: %s" % " ".join([i[0] for i in items])
            ):
                site_id, values = row[0], row[1:]
                site_status_info[site_id] = values
        finally:
            sites.live().set_prepend_site(False)

        for site_id, site_alias in sites.sorted_sites():
            container: ContextManager[bool] = (
                foldable_container(
                    treename="master_control",
                    id_=site_id,
                    isopen=True,
                    title=site_alias,
                    icon="foldable_sidebar",
                )
                if not sites.is_single_local_site()
                else nullcontext(False)
            )
            with container:
                try:
                    self._show_master_control_site(site_id, site_status_info, items)
                except Exception as e:
                    logger.exception("error rendering master control for site %s", site_id)
                    write_snapin_exception(e)
예제 #2
0
    def show(self):
        # type: () -> None
        items = self._core_toggles()
        sites.update_site_states_from_dead_sites()

        site_status_info = {}  # type: Dict[sites.SiteId, List]
        try:
            sites.live().set_prepend_site(True)
            for row in sites.live().query("GET status\nColumns: %s" %
                                          " ".join([i[0] for i in items])):
                site_id, values = row[0], row[1:]
                site_status_info[site_id] = values
        finally:
            sites.live().set_prepend_site(False)

        for site_id, site_alias in config.sorted_sites():
            if not config.is_single_local_site():
                html.begin_foldable_container("master_control", site_id, True,
                                              site_alias)

            try:
                self._show_master_control_site(site_id, site_status_info,
                                               items)
            except Exception as e:
                logger.exception("error rendering master control for site %s",
                                 site_id)
                write_snapin_exception(e)
            finally:
                if not config.is_single_local_site():
                    html.end_foldable_container()