Beispiel #1
0
 def available(self):
     # This filter is also available on slave sites with disabled WATO
     # To determine if this site is a slave we check the existance of the distributed_wato.mk
     # file and the absence of any site configuration
     return (config.wato_enabled or\
            (not wato.is_distributed() and os.path.exists(defaults.check_mk_configdir + "/distributed_wato.mk")))\
             and wato.have_folders()
Beispiel #2
0
def render_wato_foldertree():
    is_slave_site = not wato.is_distributed() and os.path.exists(
        defaults.check_mk_configdir + "/distributed_wato.mk")
    if not is_slave_site:
        if not config.wato_enabled:
            html.write(_("WATO is disabled."))
            return False

    user_folders = compute_foldertree()

    #
    # Render link target selection
    #
    selected_topic, selected_target = config.load_user_file(
        "foldertree", (_('Hosts'), 'allhosts'))

    views.load_views()
    dashboard.load_dashboards()
    topic_views = visuals_by_topic(views.permitted_views().items() +
                                   dashboard.permitted_dashboards().items())
    topics = [(t, t) for t, s in topic_views]
    html.select("topic",
                topics,
                selected_topic,
                onchange='wato_tree_topic_changed(this)')
    html.write('<span class=left>%s</span>' % _('Topic:'))

    for topic, view_list in topic_views:
        targets = []
        for t, title, name, is_view in view_list:
            if config.visible_views and name not in config.visible_views:
                continue
            if config.hidden_views and name in config.hidden_views:
                continue
            if t == topic:
                if not is_view:
                    name = 'dashboard|' + name
                targets.append((name, title))

        attrs = {}
        if topic != selected_topic:
            attrs['style'] = 'display:none'
            default = ''
        else:
            default = selected_target

        html.select("target_%s" % topic,
                    targets,
                    default,
                    attrs=attrs,
                    onchange='wato_tree_target_changed(this)')

    html.write('<span class=left>%s</span>' % _('View:'))

    # Now render the whole tree
    if user_folders:
        render_tree_folder(user_folders.values()[0], 'wato_tree_click')
Beispiel #3
0
def render_wato_foldertree():
    is_slave_site = not wato.is_distributed() and os.path.exists(defaults.check_mk_configdir + "/distributed_wato.mk")
    if not is_slave_site:
        if not config.wato_enabled:
            html.write(_("WATO is disabled."))
            return False
        elif not config.may("wato.use"):
            html.write(_("You are not allowed to use Check_MK's web configuration GUI."))
            return False

    user_folders = compute_foldertree()

    #
    # Render link target selection
    #
    selected_topic, selected_target = config.load_user_file("foldertree", (_('Hosts'), 'allhosts'))

    views.load_views()
    dashboard.load_dashboards()
    topic_views  = visuals_by_topic(views.permitted_views().items() + dashboard.permitted_dashboards().items())
    topics = [ (t, t) for t, s in topic_views ]
    html.select("topic", topics, selected_topic, onchange = 'wato_tree_topic_changed(this)')
    html.write('<span class=left>%s</span>' % _('Topic:'))

    for topic, view_list in topic_views:
        targets = []
        for t, title, name, is_view in view_list:
            if config.visible_views and name not in config.visible_views:
                continue
            if config.hidden_views and name in config.hidden_views:
                continue
            if t == topic:
                if not is_view:
                    name = 'dashboard|' + name
                targets.append((name, title))

        attrs = {}
        if topic != selected_topic:
            attrs['style'] = 'display:none'
            default = ''
        else:
            default = selected_target

        html.select("target_%s" % topic, targets, default, attrs = attrs, onchange = 'wato_tree_target_changed(this)')

    html.write('<span class=left>%s</span>' % _('View:'))

    # Now render the whole tree
    if user_folders:
        render_tree_folder(user_folders.values()[0], 'wato_tree_click')
Beispiel #4
0
 def available(self):
     # This filter is also available on slave sites with disabled WATO
     # To determine if this site is a slave we check the existance of the distributed_wato.mk
     # file and the absence of any site configuration
     return (config.wato_enabled or\
            (not wato.is_distributed() and os.path.exists(cmk.paths.check_mk_config_dir + "/distributed_wato.mk")))\