Переглянути джерело

updated libs and fixed new typescript errors

Torkel Ödegaard 8 роки тому
батько
коміт
e98af1b3fa

+ 4 - 4
package.json

@@ -14,8 +14,8 @@
     "@types/enzyme": "^2.8.9",
     "@types/jest": "^21.1.4",
     "@types/node": "^8.0.31",
-    "@types/react": "^16.0.5",
-    "@types/react-dom": "^15.5.4",
+    "@types/react": "^16.0.25",
+    "@types/react-dom": "^16.0.3",
     "angular-mocks": "^1.6.6",
     "autoprefixer": "^6.4.0",
     "awesome-typescript-loader": "^3.2.3",
@@ -128,8 +128,8 @@
     "ngreact": "^0.4.1",
     "perfect-scrollbar": "^1.2.0",
     "prop-types": "^15.6.0",
-    "react": "^16.0.0",
-    "react-dom": "^16.0.0",
+    "react": "^16.1.1",
+    "react-dom": "^16.1.1",
     "react-grid-layout": "^0.16.0",
     "react-sizeme": "^2.3.6",
     "remarkable": "^1.7.1",

+ 0 - 2
public/app/core/specs/backend_srv_specs.ts

@@ -3,14 +3,12 @@ import 'app/core/services/backend_srv';
 
 describe('backend_srv', function() {
   var _backendSrv;
-  var _http;
   var _httpBackend;
 
   beforeEach(angularMocks.module('grafana.core'));
   beforeEach(angularMocks.module('grafana.services'));
   beforeEach(angularMocks.inject(function ($httpBackend, $http, backendSrv) {
     _httpBackend = $httpBackend;
-    _http = $http;
     _backendSrv = backendSrv;
   }));
 

+ 0 - 2
public/app/core/specs/datemath.jest.ts

@@ -84,12 +84,10 @@ describe("DateMath", () => {
 
   describe('rounding', () => {
     var now;
-    var anchored;
 
     beforeEach(() => {
       clock = sinon.useFakeTimers(unix);
       now = moment();
-      anchored = moment(anchor);
     });
 
     _.each(spans, (span) => {

+ 0 - 2
public/app/features/alerting/alert_tab_ctrl.ts

@@ -210,7 +210,6 @@ export class AlertTabCtrl {
     }
 
     let firstTarget;
-    var fixed = false;
     let foundTarget = null;
 
     for (var condition of this.alert.conditions) {
@@ -232,7 +231,6 @@ export class AlertTabCtrl {
         if (firstTarget) {
           condition.query.params[0] = firstTarget.refId;
           foundTarget = firstTarget;
-          fixed = true;
         } else {
           this.error = "Could not find any metric queries";
         }

+ 1 - 2
public/app/features/dashboard/folder_picker/picker.ts

@@ -9,8 +9,7 @@ export class FolderPickerCtrl {
   labelClass: string;
   onChange: any;
   rootName = 'Root';
-
-  private folder: any;
+  folder: any;
 
   /** @ngInject */
   constructor(private backendSrv) {

+ 3 - 0
public/app/features/dashboard/specs/dashboard_srv_specs.ts

@@ -9,4 +9,7 @@ describe('dashboardSrv', function() {
     _dashboardSrv = new DashboardSrv({}, {}, {});
   });
 
+  it("should do something", () => {
+    expect(_dashboardSrv).not.to.be(null);
+  });
 });

+ 0 - 2
public/app/features/dashboard/specs/repeat.jest.ts

@@ -51,10 +51,8 @@ describe('given dashboard with panel repeat in horizontal direction', function()
   });
 
   describe('After a second iteration', function() {
-    var repeatedPanelAfterIteration1;
 
     beforeEach(function() {
-      repeatedPanelAfterIteration1 = dashboard.panels[1];
       dashboard.panels[0].fill = 10;
       dashboard.processRepeats();
     });

+ 0 - 2
public/app/features/dashboard/specs/unsaved_changes_srv_specs.ts

@@ -5,7 +5,6 @@ import 'app/features/dashboard/dashboard_srv';
 describe("unsavedChangesSrv", function() {
   var _unsavedChangesSrv;
   var _dashboardSrv;
-  var _location;
   var _contextSrvStub = { isEditor: true };
   var _rootScope;
   var tracker;
@@ -22,7 +21,6 @@ describe("unsavedChangesSrv", function() {
   beforeEach(angularMocks.inject(function(unsavedChangesSrv, $location, $rootScope, dashboardSrv) {
     _unsavedChangesSrv = unsavedChangesSrv;
     _dashboardSrv = dashboardSrv;
-    _location = $location;
     _rootScope = $rootScope;
   }));
 

+ 0 - 3
public/app/features/playlist/playlist_srv.ts

@@ -9,7 +9,6 @@ class PlaylistSrv {
   private dashboards: any;
   private index: number;
   private interval: any;
-  private playlistId: number;
   private startUrl: string;
   public isPlaying: boolean;
 
@@ -65,7 +64,6 @@ class PlaylistSrv {
 
     this.startUrl = window.location.href;
     this.index = 0;
-    this.playlistId = playlistId;
     this.isPlaying = true;
 
     if (this.$routeParams.kiosk) {
@@ -84,7 +82,6 @@ class PlaylistSrv {
   stop() {
     this.index = 0;
     this.isPlaying = false;
-    this.playlistId = 0;
 
     if (this.cancelPromise) {
       this.$timeout.cancel(this.cancelPromise);

+ 0 - 2
public/app/features/templating/template_srv.ts

@@ -12,7 +12,6 @@ export class TemplateSrv {
   private index = {};
   private grafanaVariables = {};
   private builtIns = {};
-  private filters = {};
 
   constructor() {
     this.builtIns['__interval'] = {text: '1s', value: '1s'};
@@ -26,7 +25,6 @@ export class TemplateSrv {
 
   updateTemplateData() {
     this.index = {};
-    this.filters = {};
 
     for (var i = 0; i < this.variables.length; i++) {
       var variable = this.variables[i];

+ 0 - 3
public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts

@@ -166,8 +166,6 @@ describe('CloudWatchDatasource', function() {
   });
 
   describe('When performing CloudWatch query for extended statistics', function() {
-    var requestParams;
-
     var query = {
       range: { from: 'now-1h', to: 'now' },
       rangeRaw: { from: 1483228800, to: 1483232400 },
@@ -212,7 +210,6 @@ describe('CloudWatchDatasource', function() {
 
     beforeEach(function() {
       ctx.backendSrv.datasourceRequest = function(params) {
-        requestParams = params.data;
         return ctx.$q.when({data: response});
       };
     });

+ 0 - 2
public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts

@@ -112,13 +112,11 @@ describe('ElasticDatasource', function() {
   });
 
   describe('When getting fields', function() {
-    var requestOptions;
 
     beforeEach(function() {
       createDatasource({url: 'http://es.com', index: 'metricbeat'});
 
       ctx.backendSrv.datasourceRequest = function(options) {
-        requestOptions = options;
         return ctx.$q.when({data: {
           metricbeat: {
             mappings: {

+ 0 - 2
public/app/plugins/datasource/graphite/lexer.ts

@@ -167,9 +167,7 @@ Lexer.prototype = {
     this.from = this.char;
 
     // Move to the next non-space character.
-    var start;
     if (/\s/.test(this.peek())) {
-      start = this.char;
 
       while (/\s/.test(this.peek())) {
         this.from += 1;

+ 1 - 0
public/app/plugins/datasource/opentsdb/specs/datasource-specs.ts

@@ -35,6 +35,7 @@ describe('opentsdb', function() {
       expect(requestOptions.url).to.be('/api/suggest');
       expect(requestOptions.params.type).to.be('metrics');
       expect(requestOptions.params.q).to.be('pew');
+      expect(results).not.to.be(null);
     });
 
     it('tag_names(cpu) should generate lookup query', function() {

+ 7 - 0
public/app/plugins/datasource/prometheus/specs/datasource_specs.ts

@@ -228,6 +228,7 @@ describe('PrometheusDatasource', function() {
       );
     });
   });
+
   describe('When resultFormat is table and instant = true', function() {
     var results;
     var urlExpected = 'proxied/api/v1/query?query=' +
@@ -248,11 +249,17 @@ describe('PrometheusDatasource', function() {
         }]
       }
     };
+
     beforeEach(function () {
       ctx.$httpBackend.expect('GET', urlExpected).respond(response);
       ctx.ds.query(query).then(function (data) { results = data; });
       ctx.$httpBackend.flush();
     });
+
+    it("should return result", () => {
+      expect(results).not.to.be(null);
+    });
+
     it('should return table model', function() {
       var table = ctx.ds.transformMetricDataToTable(response.data.result);
       expect(table.type).to.be('table');

+ 2 - 2
public/app/plugins/panel/graph/specs/data_processor.jest.ts

@@ -4,8 +4,8 @@ describe('Graph DataProcessor', function() {
   var panel: any = {
     xaxis: {}
   };
+
   var processor = new DataProcessor(panel);
-  var seriesList;
 
   describe('Given default xaxis options and query that returns docs', () => {
 
@@ -14,7 +14,7 @@ describe('Graph DataProcessor', function() {
       panel.xaxis.name = 'hostname';
       panel.xaxis.values = [];
 
-      seriesList = processor.getSeriesList({
+      processor.getSeriesList({
         dataList: [
           {
             type: 'docs',

+ 0 - 3
public/app/plugins/panel/graph/threshold_manager.ts

@@ -34,7 +34,6 @@ export class ThresholdManager {
     var handleElem = $(evt.currentTarget).parents(".alert-handle-wrapper");
     var handleIndex = $(evt.currentTarget).data("handleIndex");
 
-    var isMoving = false;
     var lastY = null;
     var posTop;
     var plot = this.plot;
@@ -53,7 +52,6 @@ export class ThresholdManager {
     }
 
     function stopped() {
-      isMoving = false;
       // calculate graph level
       var graphValue = plot.c2p({left: 0, top: posTop}).y;
       graphValue = parseInt(graphValue.toFixed(0));
@@ -70,7 +68,6 @@ export class ThresholdManager {
       });
     }
 
-    isMoving = true;
     lastY = null;
     posTop = handleElem.position().top;
 

+ 1 - 2
public/app/plugins/panel/heatmap/heatmap_ctrl.ts

@@ -100,9 +100,8 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
   scaledDecimals: number;
 
   /** @ngInject */
-  constructor($scope, $injector, private $rootScope, timeSrv) {
+  constructor($scope, $injector, timeSrv) {
     super($scope, $injector);
-    this.$rootScope = $rootScope;
     this.timeSrv = timeSrv;
     this.selectionActivated = false;
 

+ 4 - 4
scripts/webpack/webpack.test.js

@@ -13,10 +13,10 @@ config = merge(common, {
     fs: 'empty'
   },
   plugins: [
-    // new webpack.SourceMapDevToolPlugin({
-    //   filename: null, // if no value is provided the sourcemap is inlined
-    //   test: /\.(ts|js)($|\?)/i // process .js and .ts files only
-    // })
+    new webpack.SourceMapDevToolPlugin({
+      filename: null, // if no value is provided the sourcemap is inlined
+      test: /\.(ts|js)($|\?)/i // process .js and .ts files only
+    })
   ]
 });
 

Різницю між файлами не показано, бо вона завелика
+ 313 - 163
yarn.lock


Деякі файли не було показано, через те що забагато файлів було змінено