Skip to content

Commit f074c1e

Browse files
committed
refactor(lodash): changed how lodash is referenced from typescript
1 parent e95170e commit f074c1e

File tree

19 files changed

+42
-66
lines changed

19 files changed

+42
-66
lines changed

public/app/core/controllers/grafana_ctrl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
///<reference path="../../headers/common.d.ts" />
22

3-
import config = require('app/core/config');
4-
import store = require('app/core/store');
5-
3+
import config from 'app/core/config';
4+
import store from 'app/core/store';
5+
import _ from 'lodash';
66
import angular from 'angular';
77
import $ from 'jquery';
88
import coreModule from '../core_module';

public/app/core/controllers/signup_ctrl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path="../../headers/common.d.ts" />
22

3-
import angular = require('angular');
4-
import config = require('app/core/config');
3+
import angular from 'angular';
4+
import config from 'app/core/config';
55
import coreModule from '../core_module';
66

77
export class SignUpCtrl {

public/app/core/directives/array_join.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
///<reference path="../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
4-
3+
import _ from 'lodash';
54
import angular from 'angular';
65
import coreModule from '../core_module';
76

public/app/core/filters/filters.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
///<reference path="../../headers/common.d.ts" />
22

3-
import jquery = require('jquery');
4-
import _ = require('lodash');
5-
3+
import jquery from 'jquery';
4+
import _ from 'lodash';
65
import angular from 'angular';
76
import moment from 'moment';
87
import coreModule from '../core_module';

public/app/core/time_series2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path="../headers/common.d.ts" />
22

3-
import _ = require('lodash');
4-
import kbn = require('app/core/utils/kbn');
3+
import kbn from 'app/core/utils/kbn';
4+
import _ from 'lodash';
55

66
function matchSeriesOverride(aliasOrRegex, seriesAlias) {
77
if (!aliasOrRegex) { return false; }

public/app/core/utils/datemath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
///<reference path="../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
3+
import _ from 'lodash';
44
import moment from 'moment';
55

66
var units = ['y', 'M', 'w', 'd', 'h', 'm', 's'];

public/app/core/utils/rangeutil.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
///<reference path="../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
4-
3+
import _ from 'lodash';
54
import angular from 'angular';
65
import moment from 'moment';
76
import * as dateMath from './datemath';

public/app/features/dashboard/timepicker/timepicker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
///<reference path="../../../headers/common.d.ts" />
22
///<amd-dependency path="./input_date" name="inputDate" />
33

4-
import _ = require('lodash');
5-
import kbn = require('app/core/utils/kbn');
6-
4+
import _ from 'lodash';
5+
import kbn from 'app/core/utils/kbn';
76
import angular from 'angular';
87
import moment from 'moment';
8+
99
import * as dateMath from 'app/core/utils/datemath';
1010
import * as rangeUtil from 'app/core/utils/rangeutil';
1111

public/app/grafana.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ import 'app/core/core';
1212

1313
import $ from 'jquery';
1414
import angular from 'angular';
15-
import _ = require('lodash');
16-
import bootstrap = require('bootstrap');
17-
import kbn = require('app/core/utils/kbn');
18-
import config = require('app/core/config');
15+
import config from 'app/core/config';
16+
import _ from 'lodash';
1917

2018
export class GrafanaApp {
2119
registerFunctions: any;

public/app/headers/common.d.ts

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
///<reference path="lodash/lodash.d.ts" />
21
///<reference path="../../vendor/npm/angular2/typings/tsd.d.ts" />
32
///<reference path="../../vendor/npm/angular2/manual_typings/globals.d.ts" />
43

4+
declare var System: any;
5+
56
// dummy modules
67
declare module 'app/core/config' {
78
var config : any;
8-
export = config;
9+
export default config;
910
}
1011

11-
declare var System: any;
12+
declare module 'lodash' {
13+
var lodash: any;
14+
export default lodash;
15+
}
1216

1317
declare module 'moment' {
14-
var moment : any;
18+
var moment: any;
1519
export default moment;
1620
}
1721

@@ -27,35 +31,12 @@ declare module 'jquery' {
2731

2832
declare module 'app/core/utils/kbn' {
2933
var kbn: any;
30-
export = kbn;
34+
export default kbn;
3135
}
3236

3337
declare module 'app/core/store' {
3438
var store : any;
35-
export = store;
36-
}
37-
38-
declare module 'angular-route' {
39-
var kbn : any;
40-
export = kbn;
39+
export default store;
4140
}
4241

43-
declare module 'angular-sanitize' {
44-
var kbn : any;
45-
export = kbn;
46-
}
47-
48-
declare module 'bootstrap' {
49-
var kbn : any;
50-
export = kbn;
51-
}
5242

53-
declare module 'angular-strap' {
54-
var kbn : any;
55-
export = kbn;
56-
}
57-
58-
declare module 'angular-dragdrop' {
59-
var kbn : any;
60-
export = kbn;
61-
}

public/app/plugins/datasource/influxdb/influx_query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
3+
import _ from 'lodash';
44
import queryPart from './query_part';
55

66
export default class InfluxQuery {

public/app/plugins/datasource/influxdb/query_part.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
3+
import _ from 'lodash';
44

55
var index = [];
66
var categories = {

public/app/plugins/panels/table/controller.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import angular = require('angular');
4-
import _ = require('lodash');
5-
import moment = require('moment');
3+
import angular from 'angular';
4+
import _ from 'lodash';
5+
import moment from 'moment';
66
import PanelMeta from 'app/features/panel/panel_meta2';
7-
87
import {transformDataToTable} from './transformers';
98

109
export class TablePanelCtrl {

public/app/plugins/panels/table/editor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
4-
import kbn = require('app/core/utils/kbn');
53

4+
import _ from 'lodash';
65
import $ from 'jquery';
76
import moment from 'moment';
87
import angular from 'angular';
8+
99
import {transformers} from './transformers';
10+
import kbn from 'app/core/utils/kbn';
1011

1112
export class TablePanelEditorCtrl {
1213

public/app/plugins/panels/table/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
43
import kbn = require('app/core/utils/kbn');
54

5+
import _ from 'lodash';
66
import $ from 'jquery';
77
import moment from 'moment';
88
import angular from 'angular';

public/app/plugins/panels/table/renderer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import _ = require('lodash');
4-
import kbn = require('app/core/utils/kbn');
3+
import _ from 'lodash';
54
import moment from 'moment';
5+
import kbn from 'app/core/utils/kbn';
66

77
export class TableRenderer {
88
formaters: any[];

public/app/plugins/panels/table/transformers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
///<reference path="../../../headers/common.d.ts" />
22

3-
import moment = require('moment');
4-
import _ = require('lodash');
3+
import _ from 'lodash';
4+
import moment from 'moment';
55
import flatten from '../../../core/utils/flatten';
66
import TimeSeries from '../../../core/time_series2';
77
import TableModel from '../../../core/table_model';

public/test/core/utils/datemath_specs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'
22

33
import * as dateMath from 'app/core/utils/datemath';
4-
import * as _ from 'lodash';
54
import moment from 'moment';
5+
import _ from 'lodash';
66

77
describe("DateMath", () => {
88
var spans = ['s', 'm', 'h', 'd', 'w', 'M', 'y'];

public/test/core/utils/rangeutil_specs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'
22

33
import * as rangeUtil from 'app/core/utils/rangeutil';
4-
import * as _ from 'lodash';
4+
import _ from 'lodash';
55
import moment from 'moment';
66

77
describe("rangeUtil", () => {

0 commit comments

Comments
 (0)