From 0c178f86233d005c7695ea36422978c5d6187347 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Thu, 3 Jan 2019 16:21:20 +0100 Subject: [PATCH] cleanup --- .../stackdriver/annotations_query_ctrl.ts | 22 ---- .../specs/query_aggregation_ctrl.test.ts | 120 ------------------ 2 files changed, 142 deletions(-) delete mode 100644 public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts diff --git a/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts b/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts index 0f8a32d254c..4df035719a0 100644 --- a/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts +++ b/public/app/plugins/datasource/stackdriver/annotations_query_ctrl.ts @@ -1,34 +1,12 @@ -import _ from 'lodash'; -import './query_filter_ctrl'; import { react2AngularDirective } from 'app/core/utils/react2angular'; import { AnnotationQueryEditor } from './components/AnnotationQueryEditor'; export class StackdriverAnnotationsQueryCtrl { static templateUrl = 'partials/annotations.editor.html'; annotation: any; - datasource: any; - defaultDropdownValue = 'Select Metric'; - defaultServiceValue = 'All Services'; - - defaults = { - project: { - id: 'default', - name: 'loading project...', - }, - metricType: this.defaultDropdownValue, - service: this.defaultServiceValue, - metric: '', - filters: [], - metricKind: '', - valueType: '', - }; - - /** @ngInject */ constructor() { this.annotation.target = this.annotation.target || {}; - this.annotation.target.refId = 'annotationQuery'; - _.defaultsDeep(this.annotation.target, this.defaults); this.handleQueryChange = this.handleQueryChange.bind(this); react2AngularDirective('annotationQueryEditor', AnnotationQueryEditor, [ diff --git a/public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts b/public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts deleted file mode 100644 index 8cd7493fa3e..00000000000 --- a/public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -// const StackdriverAggregationCtrl = ({}, {}) => {}; - -// describe('StackdriverAggregationCtrl', () => { -// let ctrl; -// describe('aggregation and alignment options', () => { -// describe('when new query result is returned from the server', () => { -// describe('and result is double and gauge and no group by is used', () => { -// beforeEach(async () => { -// ctrl = new StackdriverAggregationCtrl( -// { -// $on: () => {}, -// target: { -// valueType: 'DOUBLE', -// metricKind: 'GAUGE', -// crossSeriesReducer: '', -// groupBys: [], -// }, -// }, -// { -// replace: s => s, -// variables: [{ name: 'someVariable1' }, { name: 'someVariable2' }], -// } -// ); -// }); - -// it('should populate all aggregate options except two', () => { -// ctrl.setAggOptions(); -// expect(ctrl.aggOptions.length).toBe(2); -// const [templateVariableGroup, aggOptionsGroup] = ctrl.aggOptions; -// expect(templateVariableGroup.options.length).toBe(2); -// expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE']) -// ); -// }); - -// it('should populate all alignment options except two', () => { -// ctrl.setAlignOptions(); -// const [templateVariableGroup, alignOptionGroup] = ctrl.aggOptions; -// expect(templateVariableGroup.options.length).toBe(2); -// expect(alignOptionGroup.options.length).toBe(11); -// expect(alignOptionGroup.options.map(o => o.value)).toEqual( -// expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE']) -// ); -// }); -// }); - -// describe('and result is double and delta and no group by is used', () => { -// beforeEach(async () => { -// ctrl = new StackdriverAggregationCtrl( -// { -// $on: () => {}, -// target: { -// valueType: 'DOUBLE', -// metricKind: 'DELTA', -// crossSeriesReducer: '', -// groupBys: [], -// }, -// }, -// { -// replace: s => s, -// variables: [{ name: 'someVariable1' }, { name: 'someVariable2' }], -// } -// ); -// }); - -// it('should populate all alignment options except four', () => { -// ctrl.setAlignOptions(); -// const [templateVariableGroup, alignOptionGroup] = ctrl.alignOptions; -// expect(templateVariableGroup.options.length).toBe(2); -// expect(alignOptionGroup.options.length).toBe(9); -// expect(alignOptionGroup.options.map(o => o.value)).toEqual( -// expect['not'].arrayContaining([ -// 'ALIGN_NEXT_OLDER', -// 'ALIGN_INTERPOLATE', -// 'ALIGN_COUNT_TRUE', -// 'ALIGN_COUNT_FALSE', -// 'ALIGN_FRACTION_TRUE', -// ]) -// ); -// }); -// }); - -// describe('and result is double and gauge and a group by is used', () => { -// beforeEach(async () => { -// ctrl = new StackdriverAggregationCtrl( -// { -// $on: () => {}, -// target: { -// valueType: 'DOUBLE', -// metricKind: 'GAUGE', -// crossSeriesReducer: 'REDUCE_NONE', -// groupBys: ['resource.label.projectid'], -// }, -// }, -// { -// replace: s => s, -// variables: [{ name: 'someVariable1' }], -// } -// ); -// }); - -// it('should populate all aggregate options except three', () => { -// ctrl.setAggOptions(); -// const [templateVariableGroup, aggOptionsGroup] = ctrl.aggOptions; -// expect(ctrl.aggOptions.length).toBe(2); -// expect(templateVariableGroup.options.length).toBe(1); -// expect(aggOptionsGroup.options.length).toBe(10); -// expect(aggOptionsGroup.options.map(o => o.value)).toEqual( -// expect['not'].arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE', 'REDUCE_NONE']) -// ); -// }); - -// it('should select some other reducer than REDUCE_NONE', () => { -// ctrl.setAggOptions(); -// expect(ctrl.target.crossSeriesReducer).not.toBe(''); -// expect(ctrl.target.crossSeriesReducer).not.toBe('REDUCE_NONE'); -// }); -// }); -// }); -// }); -// });