From de0c98771f9c61be411bbb1d3307e54b0563a27d Mon Sep 17 00:00:00 2001 From: Ryan Showalter Date: Mon, 22 Mar 2021 08:28:39 -0700 Subject: [PATCH] Units: add inches (in) and pounds (lb) (#32196) --- .../panel_tests_polystat.json | 24 +++++++++++++++++++ .../panel-polystat/polystat_test.json | 24 +++++++++++++++++++ .../src/valueFormats/categories.ts | 2 ++ 3 files changed, 50 insertions(+) diff --git a/devenv/dev-dashboards-without-uid/panel_tests_polystat.json b/devenv/dev-dashboards-without-uid/panel_tests_polystat.json index 986ede8c252..fd44872f36d 100644 --- a/devenv/dev-dashboards-without-uid/panel_tests_polystat.json +++ b/devenv/dev-dashboards-without-uid/panel_tests_polystat.json @@ -685,6 +685,10 @@ "text": "meter (m)", "value": "lengthm" }, + { + "text": "inch (in)", + "value": "lengthin" + }, { "text": "feet (ft)", "value": "lengthft" @@ -727,6 +731,10 @@ "text": "gram (g)", "value": "massg" }, + { + "text": "pound (lb)", + "value": "masslb" + }, { "text": "kilogram (kg)", "value": "masskg" @@ -1788,6 +1796,10 @@ "text": "meter (m)", "value": "lengthm" }, + { + "text": "inch (in)", + "value": "lengthin" + }, { "text": "feet (ft)", "value": "lengthft" @@ -1830,6 +1842,10 @@ "text": "gram (g)", "value": "massg" }, + { + "text": "pound (lb)", + "value": "masslb" + }, { "text": "kilogram (kg)", "value": "masskg" @@ -2871,6 +2887,10 @@ "text": "meter (m)", "value": "lengthm" }, + { + "text": "inch (in)", + "value": "lengthin" + }, { "text": "feet (ft)", "value": "lengthft" @@ -2913,6 +2933,10 @@ "text": "gram (g)", "value": "massg" }, + { + "text": "pound (lb)", + "value": "masslb" + }, { "text": "kilogram (kg)", "value": "masskg" diff --git a/devenv/dev-dashboards/panel-polystat/polystat_test.json b/devenv/dev-dashboards/panel-polystat/polystat_test.json index c2b60deaecb..9e1d2c26b15 100644 --- a/devenv/dev-dashboards/panel-polystat/polystat_test.json +++ b/devenv/dev-dashboards/panel-polystat/polystat_test.json @@ -685,6 +685,10 @@ "text": "meter (m)", "value": "lengthm" }, + { + "text": "inch (in)", + "value": "lengthin" + }, { "text": "feet (ft)", "value": "lengthft" @@ -727,6 +731,10 @@ "text": "gram (g)", "value": "massg" }, + { + "text": "pound (lb)", + "value": "masslb" + }, { "text": "kilogram (kg)", "value": "masskg" @@ -1788,6 +1796,10 @@ "text": "meter (m)", "value": "lengthm" }, + { + "text": "inch (in)", + "value": "lengthin" + }, { "text": "feet (ft)", "value": "lengthft" @@ -1830,6 +1842,10 @@ "text": "gram (g)", "value": "massg" }, + { + "text": "pound (lb)", + "value": "masslb" + }, { "text": "kilogram (kg)", "value": "masskg" @@ -2871,6 +2887,10 @@ "text": "meter (m)", "value": "lengthm" }, + { + "text": "inch (in)", + "value": "lengthin" + }, { "text": "feet (ft)", "value": "lengthft" @@ -2913,6 +2933,10 @@ "text": "gram (g)", "value": "massg" }, + { + "text": "pound (lb)", + "value": "masslb" + }, { "text": "kilogram (kg)", "value": "masskg" diff --git a/packages/grafana-data/src/valueFormats/categories.ts b/packages/grafana-data/src/valueFormats/categories.ts index dcf8ded5bfb..79dfb956082 100644 --- a/packages/grafana-data/src/valueFormats/categories.ts +++ b/packages/grafana-data/src/valueFormats/categories.ts @@ -280,6 +280,7 @@ export const getCategories = (): ValueFormatCategory[] => [ formats: [ { name: 'milligram (mg)', id: 'massmg', fn: SIPrefix('g', -1) }, { name: 'gram (g)', id: 'massg', fn: SIPrefix('g') }, + { name: 'pound (lb)', id: 'masslb', fn: toFixedUnit('lb') }, { name: 'kilogram (kg)', id: 'masskg', fn: SIPrefix('g', 1) }, { name: 'metric ton (t)', id: 'masst', fn: toFixedUnit('t') }, ], @@ -288,6 +289,7 @@ export const getCategories = (): ValueFormatCategory[] => [ name: 'Length', formats: [ { name: 'millimeter (mm)', id: 'lengthmm', fn: SIPrefix('m', -1) }, + { name: 'inch (in)', id: 'lengthin', fn: toFixedUnit('in') }, { name: 'feet (ft)', id: 'lengthft', fn: toFixedUnit('ft') }, { name: 'meter (m)', id: 'lengthm', fn: SIPrefix('m') }, { name: 'kilometer (km)', id: 'lengthkm', fn: SIPrefix('m', 1) },