@cryptotaxi247 / netdata-1 / commits / 4b87c9791

added boolean badges units with dash too; fixes #3613

Costa Tsaousis (ktsaou) committed Jul 11, 2018 at 03:04 UTC 4b87c9791abfea586310a9d3929bcdcf59309351
1 file changed +12 -4
src/web_buffer_svg.c
+12 -4
@@ -438,9 +438,13 @@ inline char *format_value_and_unit(char *value_string, size_t value_string_len,
438 hash_hours = 0,
439 hash_hours_ago = 0,
440 hash_onoff = 0,
441 + hash_onoff2 = 0,
442 hash_updown = 0,
443 + hash_updown2 = 0,
444 hash_okerror = 0,
445 + hash_okerror2 = 0,
446 hash_okfailed = 0,
447 + hash_okfailed2 = 0,
448 hash_empty = 0,
449 hash_null = 0,
450 hash_percentage = 0,
@@ -455,9 +459,13 @@ inline char *format_value_and_unit(char *value_string, size_t value_string_len,
459 hash_hours = simple_hash("hours");
460 hash_hours_ago = simple_hash("hours ago");
461 hash_onoff = simple_hash("on/off");
462 + hash_onoff2 = simple_hash("on-off");
463 hash_updown = simple_hash("up/down");
464 + hash_updown2 = simple_hash("up-down");
465 hash_okerror = simple_hash("ok/error");
466 + hash_okerror2 = simple_hash("ok-error");
467 hash_okfailed = simple_hash("ok/failed");
468 + hash_okfailed2 = simple_hash("ok-failed");
469 hash_empty = simple_hash("empty");
470 hash_null = simple_hash("null");
471 hash_percentage = simple_hash("percentage");
@@ -550,22 +558,22 @@ inline char *format_value_and_unit(char *value_string, size_t value_string_len,
558 return value_string;
559 }
560
553 - else if(unlikely(hash_units == hash_onoff && !strcmp(units, "on/off"))) {
561 + else if(unlikely((hash_units == hash_onoff && !strcmp(units, "on/off")) || (hash_units == hash_onoff2 && !strcmp(units, "on-off")))) {
562 snprintfz(value_string, value_string_len, "%s", (value != 0.0)?"on":"off");
563 return value_string;
564 }
565
558 - else if(unlikely(hash_units == hash_updown && !strcmp(units, "up/down"))) {
566 + else if(unlikely((hash_units == hash_updown && !strcmp(units, "up/down")) || (hash_units == hash_updown2 && !strcmp(units, "up-down")))) {
567 snprintfz(value_string, value_string_len, "%s", (value != 0.0)?"up":"down");
568 return value_string;
569 }
570
563 - else if(unlikely(hash_units == hash_okerror && !strcmp(units, "ok/error"))) {
571 + else if(unlikely((hash_units == hash_okerror && !strcmp(units, "ok/error")) || (hash_units == hash_okerror2 && !strcmp(units, "ok-error")))) {
572 snprintfz(value_string, value_string_len, "%s", (value != 0.0)?"ok":"error");
573 return value_string;
574 }
575
568 - else if(unlikely(hash_units == hash_okfailed && !strcmp(units, "ok/failed"))) {
576 + else if(unlikely((hash_units == hash_okfailed && !strcmp(units, "ok/failed")) || (hash_units == hash_okfailed2 && !strcmp(units, "ok-failed")))) {
577 snprintfz(value_string, value_string_len, "%s", (value != 0.0)?"ok":"failed");
578 return value_string;
579 }