tech: ran pretttier on all typescript files

This commit is contained in:
Torkel Ödegaard
2017-12-19 16:06:54 +01:00
parent b1621e1e8f
commit fadfc665e4
355 changed files with 20624 additions and 14931 deletions

View File

@@ -1,15 +1,25 @@
import _ from 'lodash';
import angular from 'angular';
import moment from 'moment';
import _ from "lodash";
import angular from "angular";
import moment from "moment";
import * as rangeUtil from 'app/core/utils/rangeutil';
import * as rangeUtil from "app/core/utils/rangeutil";
export class TimePickerCtrl {
static tooltipFormat = 'MMM D, YYYY HH:mm:ss';
static tooltipFormat = "MMM D, YYYY HH:mm:ss";
static defaults = {
time_options: ['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'],
refresh_intervals: ['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'],
time_options: ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"],
refresh_intervals: [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
};
dashboard: any;
@@ -30,9 +40,9 @@ export class TimePickerCtrl {
constructor(private $scope, private $rootScope, private timeSrv) {
this.$scope.ctrl = this;
$rootScope.onAppEvent('shift-time-forward', () => this.move(1), $scope);
$rootScope.onAppEvent('shift-time-backward', () => this.move(-1), $scope);
$rootScope.onAppEvent('refresh', this.onRefresh.bind(this), $scope);
$rootScope.onAppEvent("shift-time-forward", () => this.move(1), $scope);
$rootScope.onAppEvent("shift-time-backward", () => this.move(-1), $scope);
$rootScope.onAppEvent("refresh", this.onRefresh.bind(this), $scope);
// init options
this.panel = this.dashboard.timepicker;
@@ -62,14 +72,14 @@ export class TimePickerCtrl {
}
this.rangeString = rangeUtil.describeTimeRange(timeRaw);
this.absolute = {fromJs: time.from.toDate(), toJs: time.to.toDate()};
this.tooltip = this.dashboard.formatDate(time.from) + ' <br>to<br>';
this.absolute = { fromJs: time.from.toDate(), toJs: time.to.toDate() };
this.tooltip = this.dashboard.formatDate(time.from) + " <br>to<br>";
this.tooltip += this.dashboard.formatDate(time.to);
this.timeRaw = timeRaw;
}
zoom(factor) {
this.$rootScope.appEvent('zoom-out', 2);
this.$rootScope.appEvent("zoom-out", 2);
}
move(direction) {
@@ -92,7 +102,7 @@ export class TimePickerCtrl {
from = range.from.valueOf();
}
this.timeSrv.setTime({from: moment.utc(from), to: moment.utc(to)});
this.timeSrv.setTime({ from: moment.utc(from), to: moment.utc(to) });
}
openDropdown() {
@@ -103,15 +113,18 @@ export class TimePickerCtrl {
this.onRefresh();
this.editTimeRaw = this.timeRaw;
this.timeOptions = rangeUtil.getRelativeTimesList(this.panel, this.rangeString);
this.timeOptions = rangeUtil.getRelativeTimesList(
this.panel,
this.rangeString
);
this.refresh = {
value: this.dashboard.refresh,
options: _.map(this.panel.refresh_intervals, (interval: any) => {
return {text: interval, value: interval};
return { text: interval, value: interval };
})
};
this.refresh.options.unshift({text: 'off'});
this.refresh.options.unshift({ text: "off" });
this.isOpen = true;
}
@@ -125,7 +138,9 @@ export class TimePickerCtrl {
}
absoluteFromChanged() {
this.editTimeRaw.from = this.getAbsoluteMomentForTimezone(this.absolute.fromJs);
this.editTimeRaw.from = this.getAbsoluteMomentForTimezone(
this.absolute.fromJs
);
}
absoluteToChanged() {
@@ -133,29 +148,30 @@ export class TimePickerCtrl {
}
getAbsoluteMomentForTimezone(jsDate) {
return this.dashboard.isTimezoneUtc() ? moment(jsDate).utc() : moment(jsDate);
return this.dashboard.isTimezoneUtc()
? moment(jsDate).utc()
: moment(jsDate);
}
setRelativeFilter(timespan) {
var range = {from: timespan.from, to: timespan.to};
var range = { from: timespan.from, to: timespan.to };
if (this.panel.nowDelay && range.to === 'now') {
range.to = 'now-' + this.panel.nowDelay;
if (this.panel.nowDelay && range.to === "now") {
range.to = "now-" + this.panel.nowDelay;
}
this.timeSrv.setTime(range);
this.isOpen = false;
}
}
export function settingsDirective() {
return {
restrict: 'E',
templateUrl: 'public/app/features/dashboard/timepicker/settings.html',
restrict: "E",
templateUrl: "public/app/features/dashboard/timepicker/settings.html",
controller: TimePickerCtrl,
bindToController: true,
controllerAs: 'ctrl',
controllerAs: "ctrl",
scope: {
dashboard: "="
}
@@ -164,19 +180,25 @@ export function settingsDirective() {
export function timePickerDirective() {
return {
restrict: 'E',
templateUrl: 'public/app/features/dashboard/timepicker/timepicker.html',
restrict: "E",
templateUrl: "public/app/features/dashboard/timepicker/timepicker.html",
controller: TimePickerCtrl,
bindToController: true,
controllerAs: 'ctrl',
controllerAs: "ctrl",
scope: {
dashboard: "="
}
};
}
angular.module('grafana.directives').directive('gfTimePickerSettings', settingsDirective);
angular.module('grafana.directives').directive('gfTimePicker', timePickerDirective);
angular
.module("grafana.directives")
.directive("gfTimePickerSettings", settingsDirective);
angular
.module("grafana.directives")
.directive("gfTimePicker", timePickerDirective);
import {inputDateDirective} from './input_date';
angular.module("grafana.directives").directive('inputDatetime', inputDateDirective);
import { inputDateDirective } from "./input_date";
angular
.module("grafana.directives")
.directive("inputDatetime", inputDateDirective);