def _show_aux_tag_row(self, table: Table, aux_tag: cmk.utils.tags.AuxTag) -> None: table.row() table.cell(_("Actions"), css="buttons") self._show_aux_tag_icons(aux_tag) table.text_cell(_("Tag"), _u(aux_tag.choice_title)) table.text_cell(_("Used by tags")) _show_aux_tag_used_by_tags(self._get_tags_using_aux_tag(aux_tag)) # TODO: This check shouldn't be necessary if we get our types right. if aux_tag.id is None: raise Exception("uninitialized tag") operation = OperationRemoveAuxTag(aux_tag.id) affected_folders, affected_hosts, affected_rulesets = \ change_host_tags_in_folders(operation, TagCleanupMode.CHECK, watolib.Folder.root_folder()) table.cell(_("Explicitly set on folders")) if affected_folders: _show_affected_folders(affected_folders) table.cell(_("Explicitly set on hosts")) if affected_hosts: _show_affected_hosts(affected_hosts) table.cell(_("Used in rulesets")) if affected_rulesets: _show_affected_rulesets(affected_rulesets)
def _show_tag_row(self, table: Table, tag_group: cmk.utils.tags.TagGroup, tag: cmk.utils.tags.GroupedTag) -> None: table.row() table.cell(_("Actions"), css="buttons") self._show_tag_group_icons(tag_group) table.text_cell(_("Tag group"), _u(tag_group.choice_title)) # TODO: This check shouldn't be necessary if we get our types right. if tag.title is None or tag.id is None or tag_group.id is None: raise Exception("uninitialized tag/tag group") table.text_cell(_("Tag"), _u(tag.title)) operation = OperationReplaceGroupedTags(tag_group.id, remove_tag_ids=[tag.id], replace_tag_ids={}) affected_folders, affected_hosts, affected_rulesets = \ change_host_tags_in_folders(operation, TagCleanupMode.CHECK, watolib.Folder.root_folder()) table.cell(_("Explicitly set on folders")) if affected_folders: _show_affected_folders(affected_folders) table.cell(_("Explicitly set on hosts")) if affected_hosts: _show_affected_hosts(affected_hosts) table.cell(_("Used in rulesets")) if affected_rulesets: _show_affected_rulesets(affected_rulesets)