Chore: Replaces moment with Grafanas DateTime (#16919)

* Wip: Initial commit

* Refactor: Replaces moment.utc(

* Refactor: replaces the last isMoment statements

* Refactor: Removes almost all moment imports

* Refactor: Moves moment_wrapper to grafana/ui

* Refactor: Renames momentWrapper

* Refactor: Removes one more moment import

* Refactor: Removes unitOfTime import

* Fix: Fixes Prettier error

* Refactor: Renames DateTimeType to DateTime

* Refactor: Renames isDateTimeType to isDateTime

* Refactor: Renames dateTime to dateTime

* Feature: Bans moment imports and types
This commit is contained in:
Hugo Häggmark
2019-05-08 13:51:44 +02:00
committed by GitHub
parent e7a9afe983
commit ceb9f0855b
86 changed files with 583 additions and 484 deletions

View File

@@ -1,9 +1,9 @@
import _ from 'lodash';
import { QueryCtrl } from 'app/plugins/sdk';
import moment from 'moment';
import { defaultQuery } from './StreamHandler';
import { getBackendSrv } from 'app/core/services/backend_srv';
import { dateTime } from '@grafana/ui/src/utils/moment_wrapper';
export class TestDataQueryCtrl extends QueryCtrl {
static templateUrl = 'partials/query.editor.html';
@@ -20,14 +20,14 @@ export class TestDataQueryCtrl extends QueryCtrl {
this.target.scenarioId = this.target.scenarioId || 'random_walk';
this.scenarioList = [];
this.newPointTime = moment();
this.newPointTime = dateTime();
this.selectedPoint = { text: 'Select point', value: null };
}
getPoints() {
return _.map(this.target.points, (point, index) => {
return {
text: moment(point[1]).format('MMMM Do YYYY, H:mm:ss') + ' : ' + point[0],
text: dateTime(point[1]).format('MMMM Do YYYY, H:mm:ss') + ' : ' + point[0],
value: index,
};
});