From e4e41474b145b1ba9bf155d33fadc80ac73251e0 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Wed, 14 Nov 2018 11:06:02 +0100 Subject: [PATCH] first stuff --- .../app/core/components/Picker/UnitPicker.tsx | 68 +++++++++++++++++++ .../features/dashboard/dashgrid/DataPanel.tsx | 6 +- .../dashboard/dashgrid/PanelChrome.tsx | 3 - public/app/plugins/panel/gauge/module.tsx | 18 ++++- public/app/viz/GaugeOptions.tsx | 16 ----- 5 files changed, 85 insertions(+), 26 deletions(-) create mode 100644 public/app/core/components/Picker/UnitPicker.tsx delete mode 100644 public/app/viz/GaugeOptions.tsx diff --git a/public/app/core/components/Picker/UnitPicker.tsx b/public/app/core/components/Picker/UnitPicker.tsx new file mode 100644 index 00000000000..3983f0842c9 --- /dev/null +++ b/public/app/core/components/Picker/UnitPicker.tsx @@ -0,0 +1,68 @@ +import React, { PureComponent } from 'react'; +import Select from 'react-select'; +import ResetStyles from 'app/core/components/Picker/ResetStyles'; +import DescriptionOption from './DescriptionOption'; +import kbn from '../../utils/kbn'; + +interface Props { + width: number; + className?: string; + onSelected: (item: any) => {} | void; + placeholder?: string; +} + +export class UnitPicker extends PureComponent { + formatGroupLabel = data => { + console.log('format', data); + + const groupStyles = { + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + }; + + const groupBadgeStyles = { + backgroundColor: '#EBECF0', + borderRadius: '2em', + color: '#172B4D', + display: 'inline-block', + fontSize: 12, + fontWeight: 400, + lineHeight: '1', + minWidth: 1, + padding: '0.16666666666667em 0.5em', + textAlign: 'center', + } as React.CSSProperties; + + return ( +
+ {data.label} + {data.submenu.length} +
+ ); + }; + + render() { + const { className, onSelected, placeholder, width } = this.props; + + const options = kbn.getUnitFormats(); + + return ( +