From f99c4526d94d3e04124c5c48ab4a3da6ca53a458 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 31 Mar 2021 14:58:11 +0200 Subject: Adding upstream version 1.30.0. Signed-off-by: Daniel Baumann --- web/api/web_api_v1.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'web/api/web_api_v1.c') diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c index 73ac15d30..1d8217bbd 100644 --- a/web/api/web_api_v1.c +++ b/web/api/web_api_v1.c @@ -276,6 +276,7 @@ inline int web_client_api_request_v1_alarm_count(RRDHOST *host, struct web_clien inline int web_client_api_request_v1_alarm_log(RRDHOST *host, struct web_client *w, char *url) { uint32_t after = 0; + char *chart = NULL; while(url) { char *value = mystrsep(&url, "&"); @@ -285,12 +286,13 @@ inline int web_client_api_request_v1_alarm_log(RRDHOST *host, struct web_client if(!name || !*name) continue; if(!value || !*value) continue; - if(!strcmp(name, "after")) after = (uint32_t)strtoul(value, NULL, 0); + if (!strcmp(name, "after")) after = (uint32_t)strtoul(value, NULL, 0); + else if (!strcmp(name, "chart")) chart = value; } buffer_flush(w->response.data); w->response.data->contenttype = CT_APPLICATION_JSON; - health_alarm_log2json(host, w->response.data, after); + health_alarm_log2json(host, w->response.data, after, chart); return HTTP_RESP_OK; } @@ -511,6 +513,10 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c rrdhost_unlock(host); if (likely(context_param_list && context_param_list->rd)) // Just set the first one st = context_param_list->rd->rrdset; + else { + if (!chart_label_key) + sql_build_context_param_list(&context_param_list, host, context, NULL); + } } else { st = rrdset_find(host, chart); @@ -518,6 +524,17 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c st = rrdset_find_byname(host, chart); if (likely(st)) st->last_accessed_time = now_realtime_sec(); + else + sql_build_context_param_list(&context_param_list, host, NULL, chart); + } + + if (!st) { + if (likely(context_param_list && context_param_list->rd && context_param_list->rd->rrdset)) + st = context_param_list->rd->rrdset; + else { + free_context_param_list(&context_param_list); + context_param_list = NULL; + } } if (!st && !context_param_list) { @@ -961,6 +978,11 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb) #ifdef ENABLE_ACLK buffer_strcat(wb, "\t\"cloud-available\": true,\n"); +#ifdef ACLK_NG + buffer_strcat(wb, "\t\"aclk-implementation\": \"Next Generation\",\n"); +#else + buffer_strcat(wb, "\t\"aclk-implementation\": \"legacy\",\n"); +#endif #else buffer_strcat(wb, "\t\"cloud-available\": false,\n"); #endif -- cgit v1.2.3