Browse Source

uppercase literals

master
Alexey Velikiy 6 years ago
parent
commit
18d5ea29b5
  1. 1
      src/colors.ts
  2. 12
      src/models/analytic_unit.ts
  3. 2
      src/models/segment_array.ts
  4. 10
      src/module.ts
  5. 10
      src/partials/tab_analytics.html

1
src/colors.ts

@ -1,4 +1,3 @@
import _ from 'lodash';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
export const PALETTE_ROWS = 4; export const PALETTE_ROWS = 4;

12
src/models/analytic_unit.ts

@ -39,7 +39,7 @@ export class AnalyticUnit {
this._panelObject = {}; this._panelObject = {};
} }
_.defaults(this._panelObject, { _.defaults(this._panelObject, {
name: 'AnalyticUnitName', confidence: 0.2, color: ANALYTIC_UNIT_COLORS[0], type: 'general' name: 'AnalyticUnitName', confidence: 0.2, color: ANALYTIC_UNIT_COLORS[0], type: 'GENERAL'
}); });
//this._metric = new Metric(_panelObject.metric); //this._metric = new Metric(_panelObject.metric);
@ -96,10 +96,10 @@ export class AnalyticUnit {
get status() { return this._status; } get status() { return this._status; }
set status(value) { set status(value) {
if( if(
value !== 'ready' && value !== 'READY' &&
value !== 'learning' && value !== 'LEARNING' &&
value !== 'pending' && value !== 'PENDING' &&
value !== 'failed' value !== 'FAILED'
) { ) {
throw new Error('Unsupported status value: ' + value); throw new Error('Unsupported status value: ' + value);
} }
@ -110,7 +110,7 @@ export class AnalyticUnit {
set error(value) { this._error = value; } set error(value) { this._error = value; }
get isActiveStatus() { get isActiveStatus() {
return this.status !== 'ready' && this.status !== 'failed'; return this.status !== 'READY' && this.status !== 'FAILED';
} }
get panelObject() { return this._panelObject; } get panelObject() { return this._panelObject; }

2
src/models/segment_array.ts

@ -1,8 +1,6 @@
import { SegmentsSet } from './segment_set'; import { SegmentsSet } from './segment_set';
import { Segment, SegmentId } from './segment'; import { Segment, SegmentId } from './segment';
import _ from 'lodash';
export class SegmentArray<T extends Segment> implements SegmentsSet<T> { export class SegmentArray<T extends Segment> implements SegmentsSet<T> {
private _segments: T[]; private _segments: T[];

10
src/module.ts

@ -27,11 +27,11 @@ const BACKEND_VARIABLE_NAME = 'HASTIC_SERVER_URL';
class GraphCtrl extends MetricsPanelCtrl { class GraphCtrl extends MetricsPanelCtrl {
static template = template; static template = template;
ANALYTIC_TYPES: Array<{name: string, value: string}> = [ ANALYTIC_TYPES: Array<{name: string, value: string}> = [
{ name: 'General', value: 'general' }, { name: 'General', value: 'GENERAL' },
{ name: 'Peaks', value: 'peak' }, { name: 'Peaks', value: 'PEAK' },
{ name: 'Jumps', value: 'jump' }, { name: 'Jumps', value: 'JUMP' },
{ name: 'Drops', value: 'drop' }, { name: 'Drops', value: 'DROP' },
{ name: 'Custom', value: 'custom' } { name: 'Custom', value: 'CUSTOM' }
]; ];
hiddenSeries: any = {}; hiddenSeries: any = {};

10
src/partials/tab_analytics.html

@ -35,10 +35,10 @@
/> />
</span> </span>
<label class="gf-form-label" ng-style="analyticUnit.status === 'learning' && { 'cursor': 'not-allowed' }"> <label class="gf-form-label" ng-style="analyticUnit.status === 'LEARNING' && { 'cursor': 'not-allowed' }">
<a class="pointer" tabindex="1" <a class="pointer" tabindex="1"
ng-click="ctrl.onToggleLabelingMode(analyticUnit.id)" ng-click="ctrl.onToggleLabelingMode(analyticUnit.id)"
ng-disabled="analyticUnit.status === 'learning'" ng-disabled="analyticUnit.status === 'LEARNING'"
> >
<i class="fa fa-bar-chart" ng-if="!analyticUnit.saving"></i> <i class="fa fa-bar-chart" ng-if="!analyticUnit.saving"></i>
<i class="fa fa-spinner fa-spin" ng-if="analyticUnit.saving"></i> <i class="fa fa-spinner fa-spin" ng-if="analyticUnit.saving"></i>
@ -107,9 +107,9 @@
</label> </label>
<label> <label>
<i ng-if="analyticUnit.status === 'learning'" class="grafana-tip fa fa-leanpub ng-scope" bs-tooltip="'Learning'"></i> <i ng-if="analyticUnit.status === 'LEARNING'" class="grafana-tip fa fa-leanpub ng-scope" bs-tooltip="'Learning'"></i>
<i ng-if="analyticUnit.status === 'pending'" class="grafana-tip fa fa-list-ul ng-scope" bs-tooltip="'Pending'"></i> <i ng-if="analyticUnit.status === 'PENDING'" class="grafana-tip fa fa-list-ul ng-scope" bs-tooltip="'Pending'"></i>
<i ng-if="analyticUnit.status === 'failed'" class="grafana-tip fa fa-exclamation-circle ng-scope" bs-tooltip="'Error: ' + analyticUnit.error"></i> <i ng-if="analyticUnit.status === 'FAILED'" class="grafana-tip fa fa-exclamation-circle ng-scope" bs-tooltip="'Error: ' + analyticUnit.error"></i>
</label> </label>
</div> </div>

Loading…
Cancel
Save