mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Refactor: move some files to @grafana/data (#17952)
* moving to data WIP * more refactoring * add missing test * mock full path * remove sinon from grafana-ui
This commit is contained in:
committed by
Torkel Ödegaard
parent
baed5d7bd9
commit
3f15170914
@@ -5,7 +5,7 @@ import React, { PureComponent } from 'react';
|
||||
import { Select, SelectOptionItem } from '@grafana/ui';
|
||||
|
||||
// Types
|
||||
import { DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||
import { DataSourceSelectItem } from '@grafana/ui';
|
||||
|
||||
export interface Props {
|
||||
onChange: (ds: DataSourceSelectItem) => void;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import coreModule from '../core_module';
|
||||
import * as rangeUtil from '@grafana/ui/src/utils/rangeutil';
|
||||
import * as rangeUtil from '@grafana/data/src/utils/rangeutil';
|
||||
|
||||
function ngModelOnBlur() {
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
||||
import angular from 'angular';
|
||||
import coreModule from '../core_module';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { dateTime } from '@grafana/ui/src/utils/moment_wrapper';
|
||||
import { dateTime } from '@grafana/data';
|
||||
|
||||
coreModule.filter('stringSort', () => {
|
||||
return (input: any) => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import _ from 'lodash';
|
||||
import ansicolor from 'vendor/ansicolor/ansicolor';
|
||||
|
||||
import { colors } from '@grafana/ui';
|
||||
|
||||
import {
|
||||
colors,
|
||||
TimeSeries,
|
||||
Labels,
|
||||
LogLevel,
|
||||
@@ -21,10 +22,10 @@ import {
|
||||
LogsParser,
|
||||
LogLabelStatsModel,
|
||||
LogsDedupStrategy,
|
||||
} from '@grafana/ui';
|
||||
} from '@grafana/data';
|
||||
import { getThemeColor } from 'app/core/utils/colors';
|
||||
import { hasAnsiCodes } from 'app/core/utils/text';
|
||||
import { dateTime, toUtc } from '@grafana/ui/src/utils/moment_wrapper';
|
||||
import { dateTime, toUtc } from '@grafana/data';
|
||||
|
||||
export const LogLevelColor = {
|
||||
[LogLevel.critical]: colors[7],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DataFrame, FieldType, LogsModel, LogsMetaKind, LogsDedupStrategy, LogLevel } from '@grafana/ui';
|
||||
import { DataFrame, FieldType, LogsModel, LogsMetaKind, LogsDedupStrategy, LogLevel } from '@grafana/data';
|
||||
import {
|
||||
dedupLogRows,
|
||||
calculateFieldStats,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as rangeUtil from '@grafana/ui/src/utils/rangeutil';
|
||||
import * as rangeUtil from '@grafana/data/src/utils/rangeutil';
|
||||
import _ from 'lodash';
|
||||
import { dateTime } from '@grafana/ui/src/utils/moment_wrapper';
|
||||
import { dateTime } from '@grafana/data';
|
||||
|
||||
describe('rangeUtil', () => {
|
||||
describe('Can get range grouped list of ranges', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import { Column, TableData } from '@grafana/ui';
|
||||
import { Column, TableData } from '@grafana/data';
|
||||
|
||||
/**
|
||||
* Extends the standard Column class with variables that get
|
||||
|
||||
@@ -12,7 +12,8 @@ import {
|
||||
} from './explore';
|
||||
import { ExploreUrlState, ExploreMode } from 'app/types/explore';
|
||||
import store from 'app/core/store';
|
||||
import { DataQueryError, LogsDedupStrategy } from '@grafana/ui';
|
||||
import { LogsDedupStrategy } from '@grafana/data';
|
||||
import { DataQueryError } from '@grafana/ui';
|
||||
|
||||
const DEFAULT_EXPLORE_STATE: ExploreUrlState = {
|
||||
datasource: null,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Libraries
|
||||
import _ from 'lodash';
|
||||
import { from } from 'rxjs';
|
||||
import { toUtc } from '@grafana/ui/src/utils/moment_wrapper';
|
||||
import { isLive } from '@grafana/ui/src/components/RefreshPicker/RefreshPicker';
|
||||
|
||||
// Services & Utils
|
||||
import * as dateMath from '@grafana/ui/src/utils/datemath';
|
||||
import * as dateMath from '@grafana/data/src/utils/datemath';
|
||||
import { renderUrl } from 'app/core/utils/url';
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import store from 'app/core/store';
|
||||
@@ -13,21 +12,24 @@ import { getNextRefIdChar } from './query';
|
||||
|
||||
// Types
|
||||
import {
|
||||
TimeRange,
|
||||
RawTimeRange,
|
||||
TimeZone,
|
||||
IntervalValues,
|
||||
DataQuery,
|
||||
DataSourceApi,
|
||||
TimeFragment,
|
||||
DataQueryError,
|
||||
LogRowModel,
|
||||
LogsModel,
|
||||
LogsDedupStrategy,
|
||||
DataSourceJsonData,
|
||||
DataQueryRequest,
|
||||
DataStreamObserver,
|
||||
} from '@grafana/ui';
|
||||
import {
|
||||
toUtc,
|
||||
TimeRange,
|
||||
RawTimeRange,
|
||||
TimeZone,
|
||||
IntervalValues,
|
||||
TimeFragment,
|
||||
LogRowModel,
|
||||
LogsModel,
|
||||
LogsDedupStrategy,
|
||||
} from '@grafana/data';
|
||||
import {
|
||||
ExploreUrlState,
|
||||
HistoryItem,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { isBoolean, isNumber, sortedUniq, sortedIndexOf, unescape as htmlUnescaped } from 'lodash';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { isNullOrUndefined } from 'util';
|
||||
import { dateTime } from '@grafana/ui/src/utils/moment_wrapper';
|
||||
import { dateTime } from '@grafana/data';
|
||||
|
||||
const DEFAULT_DATETIME_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ';
|
||||
const POINT_TIME_INDEX = 1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { toUtc, AbsoluteTimeRange } from '@grafana/ui';
|
||||
import { toUtc, AbsoluteTimeRange } from '@grafana/data';
|
||||
|
||||
import { getShiftedTimeRange, getZoomedTimeRange } from './timePicker';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TimeRange, toUtc, AbsoluteTimeRange } from '@grafana/ui';
|
||||
import { TimeRange, toUtc, AbsoluteTimeRange } from '@grafana/data';
|
||||
|
||||
export const getShiftedTimeRange = (direction: number, origRange: TimeRange): AbsoluteTimeRange => {
|
||||
const range = {
|
||||
|
||||
Reference in New Issue
Block a user