mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
value formats: another rename and updates code to use new valueFormats func
This commit is contained in:
parent
8aae6e8c09
commit
9e6411bf4b
@ -1,2 +1,2 @@
|
||||
export * from './processTimeSeries';
|
||||
export * from './value_formats/valueFormats';
|
||||
export * from './valueFormats/valueFormats';
|
||||
|
@ -158,7 +158,7 @@ export function getValueFormats() {
|
||||
submenu: cat.formats.map(format => {
|
||||
return {
|
||||
text: format.name,
|
||||
id: format.id,
|
||||
value: format.id,
|
||||
};
|
||||
}),
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import Select from './Select';
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import { getValueFormats } from '@grafana/ui';
|
||||
|
||||
interface Props {
|
||||
onChange: (item: any) => void;
|
||||
@ -16,14 +16,14 @@ export default class UnitPicker extends PureComponent<Props> {
|
||||
render() {
|
||||
const { defaultValue, onChange, width } = this.props;
|
||||
|
||||
const unitGroups = kbn.getUnitFormats();
|
||||
const unitGroups = getValueFormats();
|
||||
|
||||
// Need to transform the data structure to work well with Select
|
||||
const groupOptions = unitGroups.map(group => {
|
||||
const options = group.submenu.map(unit => {
|
||||
return {
|
||||
label: unit.text,
|
||||
value: unit.id,
|
||||
value: unit.value,
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import { getValueFormat, getValueFormatterIndex } from '@grafana/ui';
|
||||
import { getUnitFormats } from '@grafana/ui/src';
|
||||
import { getValueFormat, getValueFormatterIndex, getValueFormats } from '@grafana/ui';
|
||||
|
||||
const kbn: any = {};
|
||||
|
||||
@ -284,9 +283,12 @@ kbn.roundValue = (num, decimals) => {
|
||||
///// FORMAT MENU /////
|
||||
|
||||
kbn.getUnitFormats = () => {
|
||||
return getUnitFormats();
|
||||
return getValueFormats();
|
||||
};
|
||||
|
||||
//
|
||||
// Backward compatible layer for value formats to support old plugins
|
||||
//
|
||||
if (typeof Proxy !== "undefined") {
|
||||
kbn.valueFormats = new Proxy(kbn.valueFormats, {
|
||||
get(target, name, receiver) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import { getValueFormats } from '@grafana/ui';
|
||||
|
||||
export class AxesEditorCtrl {
|
||||
panel: any;
|
||||
@ -15,7 +15,7 @@ export class AxesEditorCtrl {
|
||||
this.panel = this.panelCtrl.panel;
|
||||
this.$scope.ctrl = this;
|
||||
|
||||
this.unitFormats = kbn.getUnitFormats();
|
||||
this.unitFormats = getValueFormats();
|
||||
|
||||
this.logScales = {
|
||||
linear: 1,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import { getValueFormats } from '@grafana/ui';
|
||||
|
||||
export class ColumnOptionsCtrl {
|
||||
panel: any;
|
||||
@ -22,7 +22,7 @@ export class ColumnOptionsCtrl {
|
||||
this.activeStyleIndex = 0;
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
this.unitFormats = kbn.getUnitFormats();
|
||||
this.unitFormats = getValueFormats();
|
||||
this.colorModes = [
|
||||
{ text: 'Disabled', value: null },
|
||||
{ text: 'Cell', value: 'cell' },
|
||||
|
Loading…
Reference in New Issue
Block a user