mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
committed by
Torkel Ödegaard
parent
49f0f0e89e
commit
219d711597
@@ -190,9 +190,12 @@
|
||||
"@babel/polyfill": "7.2.5",
|
||||
"@torkelo/react-select": "2.4.1",
|
||||
"@types/angular-route": "1.7.0",
|
||||
"@types/d3-scale-chromatic": "1.3.1",
|
||||
"@types/enzyme-adapter-react-16": "1.0.5",
|
||||
"@types/react-redux": "^7.0.8",
|
||||
"@types/redux-logger": "3.0.7",
|
||||
"@types/reselect": "2.2.0",
|
||||
"@types/slate": "0.44.11",
|
||||
"angular": "1.6.6",
|
||||
"angular-bindonce": "0.3.1",
|
||||
"angular-native-dragdrop": "1.2.2",
|
||||
|
||||
@@ -52,7 +52,7 @@ export interface QueryFieldState {
|
||||
typeaheadIndex: number;
|
||||
typeaheadPrefix: string;
|
||||
typeaheadText: string;
|
||||
value: Value;
|
||||
value: any;
|
||||
lastExecutedValue: Value;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export const makeFragment = (text: string, syntax?: string) => {
|
||||
Block.create({
|
||||
type: 'code_line',
|
||||
nodes: [Text.create(line)],
|
||||
})
|
||||
} as any)
|
||||
);
|
||||
|
||||
const block = Block.create({
|
||||
@@ -24,7 +24,7 @@ export const makeFragment = (text: string, syntax?: string) => {
|
||||
},
|
||||
type: 'code_block',
|
||||
nodes: lines,
|
||||
});
|
||||
} as any);
|
||||
|
||||
return Document.create({
|
||||
nodes: [block],
|
||||
@@ -37,5 +37,5 @@ export const makeValue = (text: string, syntax?: string) => {
|
||||
return Value.create({
|
||||
document: fragment,
|
||||
SCHEMA,
|
||||
});
|
||||
} as any);
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ export const makeFragment = text => {
|
||||
Block.create({
|
||||
type: 'paragraph',
|
||||
nodes: [Text.create(line)],
|
||||
})
|
||||
} as any)
|
||||
);
|
||||
|
||||
const fragment = Document.create({
|
||||
|
||||
@@ -10,7 +10,7 @@ export class AxesEditorCtrl {
|
||||
xNameSegment: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private $scope) {
|
||||
constructor(private $scope: any) {
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
this.$scope.ctrl = this;
|
||||
@@ -48,7 +48,7 @@ export class AxesEditorCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
setUnitFormat(axis, subItem) {
|
||||
setUnitFormat(axis: { format: any }, subItem: { value: any }) {
|
||||
axis.format = subItem.value;
|
||||
this.panelCtrl.render();
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ export const colorModes = {
|
||||
export function getColorModes() {
|
||||
return _.map(Object.keys(colorModes), key => {
|
||||
return {
|
||||
key: key,
|
||||
key,
|
||||
value: colorModes[key].title,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function getColor(timeRegion, theme: GrafanaThemeType): TimeRegionColorDefinition {
|
||||
function getColor(timeRegion: any, theme: GrafanaThemeType): TimeRegionColorDefinition {
|
||||
if (Object.keys(colorModes).indexOf(timeRegion.colorMode) === -1) {
|
||||
timeRegion.colorMode = 'red';
|
||||
}
|
||||
@@ -71,14 +71,14 @@ export class TimeRegionManager {
|
||||
plot: any;
|
||||
timeRegions: any;
|
||||
|
||||
constructor(private panelCtrl, private theme: GrafanaThemeType = GrafanaThemeType.Dark) {}
|
||||
constructor(private panelCtrl: any, private theme: GrafanaThemeType = GrafanaThemeType.Dark) {}
|
||||
|
||||
draw(plot) {
|
||||
draw(plot: any) {
|
||||
this.timeRegions = this.panelCtrl.panel.timeRegions;
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
addFlotOptions(options, panel) {
|
||||
addFlotOptions(options: any, panel: any) {
|
||||
if (!panel.timeRegions || panel.timeRegions.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { GraphLegendEditorLegendOptions } from './GraphLegendEditor';
|
||||
export interface SeriesOptions {
|
||||
color?: string;
|
||||
yAxis?: number;
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface GraphOptions {
|
||||
showBars: boolean;
|
||||
|
||||
@@ -90,7 +90,14 @@ coreModule.directive('heatmapLegend', () => {
|
||||
};
|
||||
});
|
||||
|
||||
function drawColorLegend(elem, colorScheme, rangeFrom, rangeTo, maxValue, minValue) {
|
||||
function drawColorLegend(
|
||||
elem: JQuery,
|
||||
colorScheme: any,
|
||||
rangeFrom: number,
|
||||
rangeTo: number,
|
||||
maxValue: number,
|
||||
minValue: number
|
||||
) {
|
||||
const legendElem = $(elem).find('svg');
|
||||
const legend = d3.select(legendElem.get(0));
|
||||
clearLegend(elem);
|
||||
@@ -121,7 +128,14 @@ function drawColorLegend(elem, colorScheme, rangeFrom, rangeTo, maxValue, minVal
|
||||
drawLegendValues(elem, rangeFrom, rangeTo, maxValue, minValue, legendWidth, valuesRange);
|
||||
}
|
||||
|
||||
function drawOpacityLegend(elem, options, rangeFrom, rangeTo, maxValue, minValue) {
|
||||
function drawOpacityLegend(
|
||||
elem: JQuery,
|
||||
options: { cardColor: null },
|
||||
rangeFrom: number,
|
||||
rangeTo: number,
|
||||
maxValue: any,
|
||||
minValue: number
|
||||
) {
|
||||
const legendElem = $(elem).find('svg');
|
||||
const legend = d3.select(legendElem.get(0));
|
||||
clearLegend(elem);
|
||||
@@ -153,7 +167,15 @@ function drawOpacityLegend(elem, options, rangeFrom, rangeTo, maxValue, minValue
|
||||
drawLegendValues(elem, rangeFrom, rangeTo, maxValue, minValue, legendWidth, valuesRange);
|
||||
}
|
||||
|
||||
function drawLegendValues(elem, rangeFrom, rangeTo, maxValue, minValue, legendWidth, valuesRange) {
|
||||
function drawLegendValues(
|
||||
elem: JQuery,
|
||||
rangeFrom: number,
|
||||
rangeTo: number,
|
||||
maxValue: any,
|
||||
minValue: any,
|
||||
legendWidth: number,
|
||||
valuesRange: number[]
|
||||
) {
|
||||
const legendElem = $(elem).find('svg');
|
||||
const legend = d3.select(legendElem.get(0));
|
||||
|
||||
@@ -188,7 +210,7 @@ function drawLegendValues(elem, rangeFrom, rangeTo, maxValue, minValue, legendWi
|
||||
.remove();
|
||||
}
|
||||
|
||||
function drawSimpleColorLegend(elem, colorScale) {
|
||||
function drawSimpleColorLegend(elem: JQuery, colorScale: any) {
|
||||
const legendElem = $(elem).find('svg');
|
||||
clearLegend(elem);
|
||||
|
||||
@@ -215,7 +237,7 @@ function drawSimpleColorLegend(elem, colorScale) {
|
||||
}
|
||||
}
|
||||
|
||||
function drawSimpleOpacityLegend(elem, options) {
|
||||
function drawSimpleOpacityLegend(elem: JQuery, options: { colorScale: string; exponent: number; cardColor: string }) {
|
||||
const legendElem = $(elem).find('svg');
|
||||
clearLegend(elem);
|
||||
|
||||
@@ -224,7 +246,7 @@ function drawSimpleOpacityLegend(elem, options) {
|
||||
const legendHeight = legendElem.attr('height');
|
||||
|
||||
if (legendWidth) {
|
||||
let legendOpacityScale;
|
||||
let legendOpacityScale: any;
|
||||
if (options.colorScale === 'linear') {
|
||||
legendOpacityScale = d3
|
||||
.scaleLinear()
|
||||
@@ -261,13 +283,13 @@ function drawSimpleOpacityLegend(elem, options) {
|
||||
}
|
||||
}
|
||||
|
||||
function clearLegend(elem) {
|
||||
function clearLegend(elem: JQuery) {
|
||||
const legendElem = $(elem).find('svg');
|
||||
legendElem.empty();
|
||||
}
|
||||
|
||||
function getSvgElemX(elem) {
|
||||
const svgElem = elem.get(0);
|
||||
function getSvgElemX(elem: JQuery) {
|
||||
const svgElem: any = elem.get(0) as any;
|
||||
if (svgElem && svgElem.x && svgElem.x.baseVal) {
|
||||
return svgElem.x.baseVal.value;
|
||||
} else {
|
||||
@@ -275,8 +297,8 @@ function getSvgElemX(elem) {
|
||||
}
|
||||
}
|
||||
|
||||
function getSvgElemHeight(elem) {
|
||||
const svgElem = elem.get(0);
|
||||
function getSvgElemHeight(elem: JQuery) {
|
||||
const svgElem: any = elem.get(0);
|
||||
if (svgElem && svgElem.height && svgElem.height.baseVal) {
|
||||
return svgElem.height.baseVal.value;
|
||||
} else {
|
||||
@@ -284,7 +306,7 @@ function getSvgElemHeight(elem) {
|
||||
}
|
||||
}
|
||||
|
||||
function buildLegendTicks(rangeFrom, rangeTo, maxValue, minValue) {
|
||||
function buildLegendTicks(rangeFrom: number, rangeTo: number, maxValue: number, minValue: number) {
|
||||
const range = rangeTo - rangeFrom;
|
||||
const tickStepSize = tickStep(rangeFrom, rangeTo, 3);
|
||||
const ticksNum = Math.ceil(range / tickStepSize);
|
||||
@@ -316,12 +338,12 @@ function buildLegendTicks(rangeFrom, rangeTo, maxValue, minValue) {
|
||||
return ticks;
|
||||
}
|
||||
|
||||
function isValueCloseTo(val, valueTo, step) {
|
||||
function isValueCloseTo(val: number, valueTo: number, step: number) {
|
||||
const diff = Math.abs(val - valueTo);
|
||||
return diff < step * 0.3;
|
||||
}
|
||||
|
||||
function getFirstCloseTick(minValue, step) {
|
||||
function getFirstCloseTick(minValue: number, step: number) {
|
||||
if (minValue < 0) {
|
||||
return Math.floor(minValue / step) * step;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as d3 from 'd3';
|
||||
import * as d3ScaleChromatic from 'd3-scale-chromatic';
|
||||
|
||||
export function getColorScale(colorScheme: any, lightTheme: boolean, maxValue: number, minValue = 0): (d: any) => any {
|
||||
//@ts-ignore
|
||||
const colorInterpolator = d3ScaleChromatic[colorScheme.value];
|
||||
const colorScaleInverted = colorScheme.invert === 'always' || colorScheme.invert === (lightTheme ? 'light' : 'dark');
|
||||
|
||||
@@ -11,7 +12,11 @@ export function getColorScale(colorScheme: any, lightTheme: boolean, maxValue: n
|
||||
return d3.scaleSequential(colorInterpolator).domain([start, end]);
|
||||
}
|
||||
|
||||
export function getOpacityScale(options, maxValue, minValue = 0) {
|
||||
export function getOpacityScale(
|
||||
options: { cardColor?: null; colorScale?: any; exponent?: any },
|
||||
maxValue: number,
|
||||
minValue = 0
|
||||
) {
|
||||
let legendOpacityScale;
|
||||
if (options.colorScale === 'linear') {
|
||||
legendOpacityScale = d3
|
||||
|
||||
@@ -49,7 +49,7 @@ const rootReducers = {
|
||||
...organizationReducers,
|
||||
};
|
||||
|
||||
export function addRootReducer(reducers) {
|
||||
export function addRootReducer(reducers: any) {
|
||||
Object.assign(rootReducers, ...reducers);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ComponentClass } from 'react';
|
||||
import { Value } from 'slate';
|
||||
import {
|
||||
RawTimeRange,
|
||||
DataQuery,
|
||||
@@ -283,7 +282,7 @@ export interface HistoryItem<TQuery extends DataQuery = DataQuery> {
|
||||
|
||||
export abstract class LanguageProvider {
|
||||
datasource: any;
|
||||
request: (url) => Promise<any>;
|
||||
request: (url: any) => Promise<any>;
|
||||
/**
|
||||
* Returns startTask that resolves with a task list when main syntax is loaded.
|
||||
* Task list consists of secondary promises that load more detailed language features.
|
||||
@@ -297,7 +296,8 @@ export interface TypeaheadInput {
|
||||
prefix: string;
|
||||
wrapperClasses: string[];
|
||||
labelKey?: string;
|
||||
value?: Value;
|
||||
//Should be Value from slate
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export interface TypeaheadOutput {
|
||||
|
||||
43
yarn.lock
43
yarn.lock
@@ -1839,9 +1839,10 @@
|
||||
dependencies:
|
||||
"@types/d3-dsv" "*"
|
||||
|
||||
"@types/d3-scale-chromatic@*":
|
||||
"@types/d3-scale-chromatic@*", "@types/d3-scale-chromatic@1.3.1":
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-1.3.1.tgz#a294ae688634027870f0307bf8802f863aa2ddb3"
|
||||
integrity sha512-Ny3rLbV5tnmqgW7w/poCcef4kXP8mHPo/p8EjTS5d9OUk8MlqAeRaM8eF7Vyv7QMLiIXNE94Pa1cMLSPkXQBoQ==
|
||||
|
||||
"@types/d3-scale@*":
|
||||
version "2.1.1"
|
||||
@@ -1965,7 +1966,7 @@
|
||||
"@types/d3-voronoi" "*"
|
||||
"@types/d3-zoom" "*"
|
||||
|
||||
"@types/enzyme-adapter-react-16@^1.0.5":
|
||||
"@types/enzyme-adapter-react-16@1.0.5":
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.0.5.tgz#1bf30a166f49be69eeda4b81e3f24113c8b4e9d5"
|
||||
integrity sha512-K7HLFTkBDN5RyRmU90JuYt8OWEY2iKUn43SDWEoBOXd/PowUWjLZ3Q6qMBiQuZeFYK/TOstaZxsnI0fXoAfLpg==
|
||||
@@ -2213,6 +2214,13 @@
|
||||
"@types/prop-types" "*"
|
||||
csstype "^2.2.0"
|
||||
|
||||
"@types/redux-logger@3.0.7":
|
||||
version "3.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/redux-logger/-/redux-logger-3.0.7.tgz#163f6f6865c69c21d56f9356dc8d741718ec0db0"
|
||||
integrity sha512-oV9qiCuowhVR/ehqUobWWkXJjohontbDGLV88Be/7T4bqMQ3kjXwkFNL7doIIqlbg3X2PC5WPziZ8/j/QHNQ4A==
|
||||
dependencies:
|
||||
redux "^3.6.0"
|
||||
|
||||
"@types/remarkable@1.7.4":
|
||||
version "1.7.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/remarkable/-/remarkable-1.7.4.tgz#0faee73dc42cf21d718e20065a0961e53fa8e570"
|
||||
@@ -2316,6 +2324,14 @@
|
||||
version "7.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-7.0.11.tgz#6f28f005a36e779b7db0f1359b9fb9eef72aae88"
|
||||
|
||||
"@types/slate@0.44.11":
|
||||
version "0.44.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/slate/-/slate-0.44.11.tgz#152568096d1a089fa4c5bb03de1cf044a377206c"
|
||||
integrity sha512-UnOGipgkE1+rq3L4JjsTO0b02FbT6b59+0/hkW/QFBDvCcxCSAdwdr9HYjXkMSCSVlcsEfdC/cz+XOaB+tGvlg==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
immutable "^3.8.2"
|
||||
|
||||
"@types/stack-utils@^1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
|
||||
@@ -2345,6 +2361,11 @@
|
||||
"@types/react" "*"
|
||||
"@types/webpack-env" "*"
|
||||
|
||||
"@types/systemjs@^0.20.6":
|
||||
version "0.20.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/systemjs/-/systemjs-0.20.6.tgz#79838d2b4bce9c014330efa0b4c7b9345e830a72"
|
||||
integrity sha512-p3yv9sBBJXi3noUG216BpUI7VtVBUAvBIfZNTiDROUY31YBfsFHM4DreS7XMekN8IjtX0ysvCnm6r3WnirnNeA==
|
||||
|
||||
"@types/tether-drop@1.4.8":
|
||||
version "1.4.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/tether-drop/-/tether-drop-1.4.8.tgz#8d64288e673259d1bc28518250b80b5ef43af0bc"
|
||||
@@ -7834,7 +7855,7 @@ immer@^1.12.0:
|
||||
version "1.12.1"
|
||||
resolved "https://registry.yarnpkg.com/immer/-/immer-1.12.1.tgz#40c6e5b292c00560836c2993bda3a24379d466f5"
|
||||
|
||||
immutable@3.8.2:
|
||||
immutable@3.8.2, immutable@^3.8.2:
|
||||
version "3.8.2"
|
||||
resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3"
|
||||
|
||||
@@ -9436,7 +9457,7 @@ lockfile@^1.0.4:
|
||||
dependencies:
|
||||
signal-exit "^3.0.2"
|
||||
|
||||
lodash-es@^4.17.11:
|
||||
lodash-es@^4.17.11, lodash-es@^4.2.1:
|
||||
version "4.17.11"
|
||||
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0"
|
||||
|
||||
@@ -9559,7 +9580,7 @@ lodash.without@~4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
|
||||
|
||||
lodash@4.17.11, lodash@>4.17.4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.1.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@^4.7.0, lodash@^4.8.0, lodash@~4.17.10, lodash@~4.17.5:
|
||||
lodash@4.17.11, lodash@>4.17.4, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.1.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.7.0, lodash@^4.8.0, lodash@~4.17.10, lodash@~4.17.5:
|
||||
version "4.17.11"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
|
||||
|
||||
@@ -12904,6 +12925,16 @@ redux@4.0.1, redux@^4.0.0:
|
||||
loose-envify "^1.4.0"
|
||||
symbol-observable "^1.2.0"
|
||||
|
||||
redux@^3.6.0:
|
||||
version "3.7.2"
|
||||
resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b"
|
||||
integrity sha512-pNqnf9q1hI5HHZRBkj3bAngGZW/JMCmexDlOxw4XagXY2o1327nHH54LoTjiPJ0gizoqPDRqWyX/00g0hD6w+A==
|
||||
dependencies:
|
||||
lodash "^4.2.1"
|
||||
lodash-es "^4.2.1"
|
||||
loose-envify "^1.1.0"
|
||||
symbol-observable "^1.0.3"
|
||||
|
||||
reflect.ownkeys@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz#749aceec7f3fdf8b63f927a04809e90c5c0b3460"
|
||||
@@ -14505,7 +14536,7 @@ swap-case@^1.1.0:
|
||||
lower-case "^1.1.1"
|
||||
upper-case "^1.1.1"
|
||||
|
||||
symbol-observable@^1.0.4, symbol-observable@^1.1.0, symbol-observable@^1.2.0:
|
||||
symbol-observable@^1.0.3, symbol-observable@^1.0.4, symbol-observable@^1.1.0, symbol-observable@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user