def page_menu_host_entries(mode_name: str, host: CREHost) -> Iterator[PageMenuEntry]: if mode_name != "edit_host": yield PageMenuEntry( title=_("Properties"), icon_name="edit", item=make_simple_link( watolib.folder_preserving_link([("mode", "edit_host"), ("host", host.name())])), ) if mode_name != "inventory": yield PageMenuEntry( title=_("Service configuration"), icon_name="services", item=make_simple_link( watolib.folder_preserving_link([("mode", "inventory"), ("host", host.name())])), ) if mode_name != "diag_host" and not host.is_cluster(): yield PageMenuEntry( title=_("Connection tests"), icon_name="diagnose", item=make_simple_link( watolib.folder_preserving_link([("mode", "diag_host"), ("host", host.name())])), ) if mode_name != "object_parameters" and user.may("wato.rulesets"): yield PageMenuEntry( title=_("Effective parameters"), icon_name="rulesets", item=make_simple_link( watolib.folder_preserving_link([("mode", "object_parameters"), ("host", host.name())])), ) if mode_name == "object_parameters" or mode_name == "edit_host" and user.may( "wato.rulesets"): yield PageMenuEntry( title=_("Rules"), icon_name="rulesets", item=make_simple_link( makeuri_contextless( request, [ ("mode", "rule_search"), ("filled_in", "search"), ("search_p_ruleset_deprecated", "OFF"), ("search_p_rule_host_list_USE", "ON"), ("search_p_rule_host_list", host.name()), ], filename="wato.py", )), ) yield make_host_status_link(host_name=host.name(), view_name="hoststatus") if user.may("wato.rulesets") and host.is_cluster(): yield PageMenuEntry( title=_("Clustered services"), icon_name="rulesets", item=make_simple_link( watolib.folder_preserving_link([("mode", "edit_ruleset"), ("varname", "clustered_services")])), ) if watolib.has_agent_bakery() and user.may("wato.download_agents"): yield PageMenuEntry( title=_("Monitoring agent"), icon_name="agents", item=make_simple_link( watolib.folder_preserving_link([("mode", "agent_of_host"), ("host", host.name())])), ) if mode_name == "edit_host" and not host.locked(): if user.may("wato.rename_hosts"): yield PageMenuEntry( title=_("Rename"), icon_name="rename_host", item=make_simple_link( watolib.folder_preserving_link([("mode", "rename_host"), ("host", host.name())])), ) if user.may("wato.manage_hosts") and user.may("wato.clone_hosts"): yield PageMenuEntry( title=_("Clone"), icon_name="insert", item=make_simple_link(host.clone_url()), ) yield PageMenuEntry( title=_("Delete"), icon_name="delete", item=make_simple_link( make_confirm_link( url=makeactionuri(request, transactions, [("delete", "1")]), message=_( "Do you really want to delete the host <tt>%s</tt>?") % host.name(), )), ) if user.may("wato.auditlog"): yield PageMenuEntry( title=_("Audit log"), icon_name="auditlog", item=make_simple_link( make_object_audit_log_url(host.object_ref())), )
def page_menu_host_entries(mode_name: str, host: CREHost) -> Iterator[PageMenuEntry]: if mode_name != "edit_host": yield PageMenuEntry( title=_("Properties"), icon_name="edit", item=make_simple_link( watolib.folder_preserving_link([("mode", "edit_host"), ("host", host.name())])), ) if mode_name != "inventory": yield PageMenuEntry( title=_("Service configuration"), icon_name="services", item=make_simple_link( watolib.folder_preserving_link([("mode", "inventory"), ("host", host.name())])), ) if mode_name != "diag_host" and not host.is_cluster(): yield PageMenuEntry( title=_("Connection tests"), icon_name="diagnose", item=make_simple_link( watolib.folder_preserving_link([("mode", "diag_host"), ("host", host.name())])), ) if mode_name != "object_parameters" and config.user.may('wato.rulesets'): yield PageMenuEntry( title=_("Effective parameters"), icon_name="rulesets", item=make_simple_link( watolib.folder_preserving_link([("mode", "object_parameters"), ("host", host.name())])), ) yield make_host_status_link(host_name=host.name(), view_name="hoststatus") if config.user.may('wato.rulesets') and host.is_cluster(): yield PageMenuEntry( title=_("Clustered services"), icon_name="rulesets", item=make_simple_link( watolib.folder_preserving_link([("mode", "edit_ruleset"), ("varname", "clustered_services")])), ) if watolib.has_agent_bakery() and config.user.may('wato.download_agents'): yield PageMenuEntry( title=_("Monitoring agent"), icon_name="agents", item=make_simple_link( watolib.folder_preserving_link([("mode", "agent_of_host"), ("host", host.name())])), ) if mode_name == "edit_host" and not host.locked(): if config.user.may("wato.rename_hosts"): yield PageMenuEntry( title=_("Rename"), icon_name="rename_host", item=make_simple_link( watolib.folder_preserving_link([("mode", "rename_host"), ("host", host.name())])), ) if config.user.may("wato.manage_hosts") and config.user.may("wato.clone_hosts"): yield PageMenuEntry( title=_("Clone"), icon_name="insert", item=make_simple_link(host.clone_url()), ) yield PageMenuEntry( title=_("Delete"), icon_name="delete", item=make_simple_link(html.makeactionuri([("delete", "1")])), )