X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Faction_show_graph.c;h=5aaf25afc2f4757b5d42739476da078f0491e652;hp=40ebcd305e55b043db41b2e1ba9527c04ffd8496;hb=173727f52463a5e2f60e7363456f90905d67e669;hpb=5e630d84e5baa7b105ff83f81555c1e62f5a68ba diff --git a/src/action_show_graph.c b/src/action_show_graph.c index 40ebcd3..5aaf25a 100644 --- a/src/action_show_graph.c +++ b/src/action_show_graph.c @@ -8,6 +8,7 @@ #include "action_show_graph.h" #include "common.h" +#include "graph_ident.h" #include "graph_list.h" #include "utils_cgi.h" @@ -27,6 +28,54 @@ struct show_graph_data_s }; typedef struct show_graph_data_s show_graph_data_t; +static void show_breadcrump_field (const char *str) /* {{{ */ +{ + if ((str == NULL) || (str[0] == 0)) + printf ("none"); + else if (IS_ANY (str)) + printf ("any"); + else if (IS_ALL (str)) + printf ("all"); + else + { + char *str_html = html_escape (str); + printf ("%s", + script_name (), str_html, str_html); + free (str_html); + } +} /* }}} void show_breadcrump_field */ + +static int show_breadcrump (show_graph_data_t *data) /* {{{ */ +{ + graph_ident_t *ident; + char *prefix; + + if (data->inst != NULL) + { + prefix = "Instance"; + ident = inst_get_selector (data->inst); + } + else + { + prefix = "Graph"; + ident = graph_get_selector (data->cfg); + } + + printf ("
%s: "", prefix); + show_breadcrump_field (ident_get_host (ident)); + printf (" / "); + show_breadcrump_field (ident_get_plugin (ident)); + printf (" – "); + show_breadcrump_field (ident_get_plugin_instance (ident)); + printf (" / "); + show_breadcrump_field (ident_get_type (ident)); + printf (" – "); + show_breadcrump_field (ident_get_type_instance (ident)); + printf (""
\n"); + + return (0); +} /* }}} int show_breadcrump */ + static int show_instance_list_cb (graph_instance_t *inst, /* {{{ */ void *user_data) { @@ -48,7 +97,8 @@ static int show_instance_list_cb (graph_instance_t *inst, /* {{{ */ inst_get_params (data->cfg, inst, params, sizeof (params)); html_escape_buffer (params, sizeof (params)); - printf ("
  • %s
  • \n", + printf ("
  • " + "%s
  • \n", script_name (), params, descr); return (0); @@ -57,19 +107,23 @@ static int show_instance_list_cb (graph_instance_t *inst, /* {{{ */ static int show_instance_list (void *user_data) /* {{{ */ { show_graph_data_t *data = user_data; - graph_instance_t *inst; char title[128]; + char params[1024]; memset (title, 0, sizeof (title)); graph_get_title (data->cfg, title, sizeof (title)); html_escape_buffer (title, sizeof (title)); + memset (params, 0, sizeof (params)); + graph_get_params (data->cfg, params, sizeof (params)); + html_escape_buffer (params, sizeof (params)); + printf ("