X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=action_list_graphs.c;h=08d0eb49acac11af0bfb543bd037fb5ba593a9c4;hb=e850a3c5fb03dcb0e8698e61db2fd01a845bc6cf;hp=0663b98dbbcfd6f1aad2bd06fc8cf423a0e31e77;hpb=477b8a38dc1b3d0ae5e726f765722c962b2fcb46;p=collection4.git diff --git a/action_list_graphs.c b/action_list_graphs.c index 0663b98..08d0eb4 100644 --- a/action_list_graphs.c +++ b/action_list_graphs.c @@ -4,6 +4,8 @@ #include #include "action_list_graphs.h" +#include "graph.h" +#include "graph_ident.h" #include "graph_list.h" #include "utils_params.h" @@ -20,7 +22,7 @@ static int print_graph_inst_json (__attribute__((unused)) graph_config_t *cfg, / first = user_data; - ident = gl_instance_get_selector (inst); + ident = inst_get_selector (inst); if (ident == NULL) return (-1); @@ -61,41 +63,59 @@ static int list_graphs_json (void) /* {{{ */ return (0); } /* }}} int list_graphs_json */ +struct callback_data_s +{ + graph_config_t *cfg; +}; +typedef struct callback_data_s callback_data_t; + static int print_graph_inst_html (graph_config_t *cfg, /* {{{ */ graph_instance_t *inst, - __attribute__((unused)) void *user_data) + void *user_data) { - char buffer[1024]; + callback_data_t *data = user_data; + char params[1024]; + char desc[1024]; - memset (buffer, 0, sizeof (buffer)); - gl_instance_get_params (cfg, inst, buffer, sizeof (buffer)); + if (data->cfg != cfg) + { + if (data->cfg != NULL) + printf (" \n"); - printf ("
  • %s
  • \n", buffer, buffer); + memset (desc, 0, sizeof (desc)); + graph_get_title (cfg, desc, sizeof (desc)); - return (0); -} /* }}} int print_graph_inst_html */ + printf ("
  • %s\n \n"); return (0); @@ -114,7 +134,7 @@ int action_list_graphs (void) /* {{{ */ if (strcmp ("json", format) == 0) return (list_graphs_json ()); else - return (list_graphs_html ()); + return (list_graphs_html (param ("search"))); } /* }}} int action_list_graphs */ /* vim: set sw=2 sts=2 et fdm=marker : */