aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/northstar')
-rw-r--r--src/client/northstar/core/BaseObject.ts6
-rw-r--r--src/client/northstar/core/attribute/AttributeModel.ts10
-rw-r--r--src/client/northstar/core/attribute/AttributeTransformationModel.ts19
-rw-r--r--src/client/northstar/core/attribute/CalculatedAttributeModel.ts6
-rw-r--r--src/client/northstar/core/brusher/IBaseBrushable.ts4
-rw-r--r--src/client/northstar/core/brusher/IBaseBrusher.ts2
-rw-r--r--src/client/northstar/core/filter/FilterModel.ts8
-rw-r--r--src/client/northstar/core/filter/IBaseFilterConsumer.ts4
-rw-r--r--src/client/northstar/core/filter/IBaseFilterProvider.ts2
-rw-r--r--src/client/northstar/core/filter/ValueComparision.ts22
-rw-r--r--src/client/northstar/dash-fields/HistogramField.ts10
-rw-r--r--src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts54
-rw-r--r--src/client/northstar/dash-nodes/HistogramBox.tsx48
-rw-r--r--src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx46
-rw-r--r--src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx21
-rw-r--r--src/client/northstar/manager/Gateway.ts56
-rw-r--r--src/client/northstar/model/ModelExtensions.ts32
-rw-r--r--src/client/northstar/model/ModelHelpers.ts18
-rw-r--r--src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts28
-rw-r--r--src/client/northstar/model/binRanges/NominalVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts2
-rw-r--r--src/client/northstar/model/binRanges/VisualBinRange.ts6
-rw-r--r--src/client/northstar/model/binRanges/VisualBinRangeHelper.ts21
-rw-r--r--src/client/northstar/model/idea/MetricTypeMapping.ts28
-rw-r--r--src/client/northstar/operations/BaseOperation.ts17
-rw-r--r--src/client/northstar/operations/HistogramOperation.ts4
-rw-r--r--src/client/northstar/utils/ArrayUtil.ts16
-rw-r--r--src/client/northstar/utils/Extensions.ts6
-rw-r--r--src/client/northstar/utils/GeometryUtil.ts36
-rw-r--r--src/client/northstar/utils/MathUtil.ts50
-rw-r--r--src/client/northstar/utils/SizeConverter.ts18
-rw-r--r--src/client/northstar/utils/StyleContants.ts2
-rw-r--r--src/client/northstar/utils/Utils.ts20
34 files changed, 338 insertions, 292 deletions
diff --git a/src/client/northstar/core/BaseObject.ts b/src/client/northstar/core/BaseObject.ts
index e9e766e31..ed3818071 100644
--- a/src/client/northstar/core/BaseObject.ts
+++ b/src/client/northstar/core/BaseObject.ts
@@ -1,10 +1,10 @@
-import { IEquatable } from '../utils/IEquatable'
-import { IDisposable } from '../utils/IDisposable'
+import { IEquatable } from '../utils/IEquatable';
+import { IDisposable } from '../utils/IDisposable';
export class BaseObject implements IEquatable, IDisposable {
public Equals(other: Object): boolean {
- return this == other;
+ return this === other;
}
public Dispose(): void {
diff --git a/src/client/northstar/core/attribute/AttributeModel.ts b/src/client/northstar/core/attribute/AttributeModel.ts
index 124a5b45a..c89b1617c 100644
--- a/src/client/northstar/core/attribute/AttributeModel.ts
+++ b/src/client/northstar/core/attribute/AttributeModel.ts
@@ -1,5 +1,5 @@
-import { Attribute, DataType, VisualizationHint } from '../../model/idea/idea'
-import { BaseObject } from '../BaseObject'
+import { Attribute, DataType, VisualizationHint } from '../../model/idea/idea';
+import { BaseObject } from '../BaseObject';
import { observable } from "mobx";
export abstract class AttributeModel extends BaseObject {
@@ -34,7 +34,7 @@ export class ColumnAttributeModel extends AttributeModel {
}
public Equals(other: ColumnAttributeModel): boolean {
- return this.Attribute.rawName == other.Attribute.rawName;
+ return this.Attribute.rawName === other.Attribute.rawName;
}
}
@@ -93,7 +93,7 @@ export class BackendAttributeModel extends AttributeModel {
}
public get DisplayName(): string {
- return this._displayName.ReplaceAll("_", " ");;
+ return this._displayName.ReplaceAll("_", " ");
}
public get CodeName(): string {
@@ -105,7 +105,7 @@ export class BackendAttributeModel extends AttributeModel {
}
public Equals(other: BackendAttributeModel): boolean {
- return this.Id == other.Id;
+ return this.Id === other.Id;
}
} \ No newline at end of file
diff --git a/src/client/northstar/core/attribute/AttributeTransformationModel.ts b/src/client/northstar/core/attribute/AttributeTransformationModel.ts
index cc5aa7154..66485183b 100644
--- a/src/client/northstar/core/attribute/AttributeTransformationModel.ts
+++ b/src/client/northstar/core/attribute/AttributeTransformationModel.ts
@@ -1,4 +1,4 @@
-;
+
import { computed, observable } from "mobx";
import { AggregateFunction } from "../../model/idea/idea";
import { AttributeModel } from "./AttributeModel";
@@ -20,16 +20,21 @@ export class AttributeTransformationModel implements IEquatable {
if (this.AggregateFunction === AggregateFunction.Count) {
return "count";
}
- if (this.AggregateFunction === AggregateFunction.Avg)
+ if (this.AggregateFunction === AggregateFunction.Avg) {
displayName = "avg(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.Max)
+ }
+ else if (this.AggregateFunction === AggregateFunction.Max) {
displayName = "max(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.Min)
+ }
+ else if (this.AggregateFunction === AggregateFunction.Min) {
displayName = "min(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.Sum)
+ }
+ else if (this.AggregateFunction === AggregateFunction.Sum) {
displayName = "sum(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.SumE)
+ }
+ else if (this.AggregateFunction === AggregateFunction.SumE) {
displayName = "sumE(" + displayName + ")";
+ }
return displayName;
}
@@ -41,7 +46,7 @@ export class AttributeTransformationModel implements IEquatable {
}
public Equals(other: AttributeTransformationModel): boolean {
- return this.AggregateFunction == other.AggregateFunction &&
+ return this.AggregateFunction === other.AggregateFunction &&
this.AttributeModel.Equals(other.AttributeModel);
}
} \ No newline at end of file
diff --git a/src/client/northstar/core/attribute/CalculatedAttributeModel.ts b/src/client/northstar/core/attribute/CalculatedAttributeModel.ts
index ab96c794d..a197c1305 100644
--- a/src/client/northstar/core/attribute/CalculatedAttributeModel.ts
+++ b/src/client/northstar/core/attribute/CalculatedAttributeModel.ts
@@ -1,5 +1,5 @@
import { BackendAttributeModel, AttributeModel, CodeAttributeModel } from "./AttributeModel";
-import { DataType, VisualizationHint } from '../../model/idea/idea'
+import { DataType, VisualizationHint } from '../../model/idea/idea';
export class CalculatedAttributeManager {
public static AllCalculatedAttributes: Array<AttributeModel> = new Array<AttributeModel>();
@@ -11,7 +11,7 @@ export class CalculatedAttributeManager {
public static CreateBackendAttributeModel(id: string, dataType: DataType, displayName: string, codeName: string, visualizationHints: VisualizationHint[]): BackendAttributeModel {
var filtered = this.AllCalculatedAttributes.filter(am => {
if (am instanceof BackendAttributeModel &&
- am.Id == id) {
+ am.Id === id) {
return true;
}
return false;
@@ -27,7 +27,7 @@ export class CalculatedAttributeManager {
public static CreateCodeAttributeModel(code: string, codeName: string, visualizationHints: VisualizationHint[]): CodeAttributeModel {
var filtered = this.AllCalculatedAttributes.filter(am => {
if (am instanceof CodeAttributeModel &&
- am.CodeName == codeName) {
+ am.CodeName === codeName) {
return true;
}
return false;
diff --git a/src/client/northstar/core/brusher/IBaseBrushable.ts b/src/client/northstar/core/brusher/IBaseBrushable.ts
index 99a36636f..c46db4d22 100644
--- a/src/client/northstar/core/brusher/IBaseBrushable.ts
+++ b/src/client/northstar/core/brusher/IBaseBrushable.ts
@@ -1,6 +1,6 @@
-import { PIXIPoint } from '../../utils/MathUtil'
+import { PIXIPoint } from '../../utils/MathUtil';
import { IEquatable } from '../../utils/IEquatable';
-import { Document } from '../../../../fields/Document'
+import { Document } from '../../../../fields/Document';
export interface IBaseBrushable<T> extends IEquatable {
BrusherModels: Array<Document>;
diff --git a/src/client/northstar/core/brusher/IBaseBrusher.ts b/src/client/northstar/core/brusher/IBaseBrusher.ts
index d7ae65464..d2de6ed62 100644
--- a/src/client/northstar/core/brusher/IBaseBrusher.ts
+++ b/src/client/northstar/core/brusher/IBaseBrusher.ts
@@ -1,4 +1,4 @@
-import { PIXIPoint } from '../../utils/MathUtil'
+import { PIXIPoint } from '../../utils/MathUtil';
import { IEquatable } from '../../utils/IEquatable';
diff --git a/src/client/northstar/core/filter/FilterModel.ts b/src/client/northstar/core/filter/FilterModel.ts
index aee99d2b6..e2ba3f652 100644
--- a/src/client/northstar/core/filter/FilterModel.ts
+++ b/src/client/northstar/core/filter/FilterModel.ts
@@ -15,7 +15,7 @@ export class FilterModel {
public Equals(other: FilterModel): boolean {
if (!Utils.EqualityHelper(this, other)) return false;
- if (!this.isSame(this.ValueComparisons, (other as FilterModel).ValueComparisons)) return false;
+ if (!this.isSame(this.ValueComparisons, (other).ValueComparisons)) return false;
return true;
}
@@ -46,16 +46,16 @@ export class FilterModel {
let filtered = baseOperation.FilterModels.filter(fm => fm && fm.ValueComparisons.length > 0);
if (!isFirst && filtered.length > 0) {
filterModels.push(...filtered);
- ret = "(" + baseOperation.FilterModels.filter(fm => fm != null).map(fm => fm.ToPythonString()).join(" || ") + ")";
+ ret = "(" + baseOperation.FilterModels.filter(fm => fm !== null).map(fm => fm.ToPythonString()).join(" || ") + ")";
}
if (Utils.isBaseFilterConsumer(baseOperation) && baseOperation.Links) {
let children = new Array<string>();
let linkedGraphNodes = baseOperation.Links;
linkedGraphNodes.map(linkVm => {
let filterDoc = linkVm.Get(KeyStore.LinkedFromDocs);
- if (filterDoc && filterDoc != FieldWaiting && filterDoc instanceof Document) {
+ if (filterDoc && filterDoc !== FieldWaiting && filterDoc instanceof Document) {
let filterHistogram = filterDoc.GetT(KeyStore.Data, HistogramField);
- if (filterHistogram && filterHistogram != FieldWaiting) {
+ if (filterHistogram && filterHistogram !== FieldWaiting) {
if (!visitedFilterProviders.has(filterHistogram.Data)) {
let child = FilterModel.GetFilterModelsRecursive(filterHistogram.Data, visitedFilterProviders, filterModels, false);
if (child !== "") {
diff --git a/src/client/northstar/core/filter/IBaseFilterConsumer.ts b/src/client/northstar/core/filter/IBaseFilterConsumer.ts
index 93f66a154..59d7adf4c 100644
--- a/src/client/northstar/core/filter/IBaseFilterConsumer.ts
+++ b/src/client/northstar/core/filter/IBaseFilterConsumer.ts
@@ -1,5 +1,5 @@
-import { FilterOperand } from '../filter/FilterOperand'
-import { IEquatable } from '../../utils/IEquatable'
+import { FilterOperand } from '../filter/FilterOperand';
+import { IEquatable } from '../../utils/IEquatable';
import { Document } from "../../../../fields/Document";
export interface IBaseFilterConsumer extends IEquatable {
diff --git a/src/client/northstar/core/filter/IBaseFilterProvider.ts b/src/client/northstar/core/filter/IBaseFilterProvider.ts
index d082bfe12..fc3301b11 100644
--- a/src/client/northstar/core/filter/IBaseFilterProvider.ts
+++ b/src/client/northstar/core/filter/IBaseFilterProvider.ts
@@ -1,4 +1,4 @@
-import { FilterModel } from '../filter/FilterModel'
+import { FilterModel } from '../filter/FilterModel';
export interface IBaseFilterProvider {
FilterModels: Array<FilterModel>;
diff --git a/src/client/northstar/core/filter/ValueComparision.ts b/src/client/northstar/core/filter/ValueComparision.ts
index 1e729d06e..80b1242a9 100644
--- a/src/client/northstar/core/filter/ValueComparision.ts
+++ b/src/client/northstar/core/filter/ValueComparision.ts
@@ -1,5 +1,5 @@
-import { Predicate } from '../../model/idea/idea'
-import { Utils } from '../../utils/Utils'
+import { Predicate } from '../../model/idea/idea';
+import { Utils } from '../../utils/Utils';
import { AttributeModel } from '../attribute/AttributeModel';
export class ValueComparison {
@@ -15,15 +15,19 @@ export class ValueComparison {
}
public Equals(other: Object): boolean {
- if (!Utils.EqualityHelper(this, other))
+ if (!Utils.EqualityHelper(this, other)) {
return false;
- if (this.Predicate !== (other as ValueComparison).Predicate)
+ }
+ if (this.Predicate !== (other as ValueComparison).Predicate) {
return false;
+ }
let isComplex = (typeof this.Value === "object");
- if (!isComplex && this.Value != (other as ValueComparison).Value)
+ if (!isComplex && this.Value !== (other as ValueComparison).Value) {
return false;
- if (isComplex && !this.Value.Equals((other as ValueComparison).Value))
+ }
+ if (isComplex && !this.Value.Equals((other as ValueComparison).Value)) {
return false;
+ }
return true;
}
@@ -58,13 +62,13 @@ export class ValueComparison {
var rawName = this.attributeModel.CodeName;
switch (this.Predicate) {
case Predicate.STARTS_WITH:
- ret += rawName + " != null && " + rawName + ".StartsWith(" + val + ") ";
+ ret += rawName + " !== null && " + rawName + ".StartsWith(" + val + ") ";
return ret;
case Predicate.ENDS_WITH:
- ret += rawName + " != null && " + rawName + ".EndsWith(" + val + ") ";
+ ret += rawName + " !== null && " + rawName + ".EndsWith(" + val + ") ";
return ret;
case Predicate.CONTAINS:
- ret += rawName + " != null && " + rawName + ".Contains(" + val + ") ";
+ ret += rawName + " !== null && " + rawName + ".Contains(" + val + ") ";
return ret;
default:
ret += rawName + " " + op + " " + val + " ";
diff --git a/src/client/northstar/dash-fields/HistogramField.ts b/src/client/northstar/dash-fields/HistogramField.ts
index 48731f52d..6abde4677 100644
--- a/src/client/northstar/dash-fields/HistogramField.ts
+++ b/src/client/northstar/dash-fields/HistogramField.ts
@@ -16,7 +16,7 @@ export class HistogramField extends BasicField<HistogramOperation> {
omitKeys(obj: any, keys: any) {
var dup: any = {};
for (var key in obj) {
- if (keys.indexOf(key) == -1) {
+ if (keys.indexOf(key) === -1) {
dup[key] = obj[key];
}
}
@@ -41,7 +41,7 @@ export class HistogramField extends BasicField<HistogramOperation> {
data: this.toString(),
_id: this.Id
- }
+ };
}
@action
@@ -54,13 +54,13 @@ export class HistogramField extends BasicField<HistogramOperation> {
let schema = CurrentUserUtils.GetNorthstarSchema(jp.SchemaName);
if (schema) {
CurrentUserUtils.GetAllNorthstarColumnAttributes(schema).map(attr => {
- if (attr.displayName == jp.X.AttributeModel.Attribute.DisplayName) {
+ if (attr.displayName === jp.X.AttributeModel.Attribute.DisplayName) {
X = new AttributeTransformationModel(new ColumnAttributeModel(attr), jp.X.AggregateFunction);
}
- if (attr.displayName == jp.Y.AttributeModel.Attribute.DisplayName) {
+ if (attr.displayName === jp.Y.AttributeModel.Attribute.DisplayName) {
Y = new AttributeTransformationModel(new ColumnAttributeModel(attr), jp.Y.AggregateFunction);
}
- if (attr.displayName == jp.V.AttributeModel.Attribute.DisplayName) {
+ if (attr.displayName === jp.V.AttributeModel.Attribute.DisplayName) {
V = new AttributeTransformationModel(new ColumnAttributeModel(attr), jp.V.AggregateFunction);
}
});
diff --git a/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts b/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts
index 43e768c62..6291ec1fc 100644
--- a/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts
+++ b/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { AttributeTransformationModel } from "../../northstar/core/attribute/AttributeTransformationModel";
import { ChartType } from '../../northstar/model/binRanges/VisualBinRange';
import { AggregateFunction, Bin, Brush, DoubleValueAggregateResult, HistogramResult, MarginAggregateParameters, MarginAggregateResult } from "../../northstar/model/idea/idea";
@@ -29,7 +29,7 @@ export class HistogramBinPrimitiveCollection {
private _histoBox: HistogramBox;
private get histoOp() { return this._histoBox.HistoOp; }
private get histoResult() { return this.histoOp.Result as HistogramResult; }
- private get sizeConverter() { return this._histoBox.SizeConverter!; }
+ private get sizeConverter() { return this._histoBox.SizeConverter; }
public BinPrimitives: Array<HistogramBinPrimitive> = new Array<HistogramBinPrimitive>();
public HitGeom: PIXIRectangle = PIXIRectangle.EMPTY;
@@ -48,28 +48,28 @@ export class HistogramBinPrimitiveCollection {
// adjust brush rects (stacking or not)
var allBrushIndex = ModelHelpers.AllBrushIndex(this.histoResult);
- var filteredBinPrims = this.BinPrimitives.filter(b => b.BrushIndex != allBrushIndex && b.DataValue != 0.0);
+ var filteredBinPrims = this.BinPrimitives.filter(b => b.BrushIndex !== allBrushIndex && b.DataValue !== 0.0);
filteredBinPrims.reduce((sum, fbp) => {
- if (histoBox.ChartType == ChartType.VerticalBar) {
- if (this.histoOp.Y.AggregateFunction == AggregateFunction.Count) {
+ if (histoBox.ChartType === ChartType.VerticalBar) {
+ if (this.histoOp.Y.AggregateFunction === AggregateFunction.Count) {
fbp.Rect = new PIXIRectangle(fbp.Rect.x, fbp.Rect.y - sum, fbp.Rect.width, fbp.Rect.height);
fbp.MarginRect = new PIXIRectangle(fbp.MarginRect.x, fbp.MarginRect.y - sum, fbp.MarginRect.width, fbp.MarginRect.height);
return sum + fbp.Rect.height;
}
- if (this.histoOp.Y.AggregateFunction == AggregateFunction.Avg) {
+ if (this.histoOp.Y.AggregateFunction === AggregateFunction.Avg) {
var w = fbp.Rect.width / 2.0;
fbp.Rect = new PIXIRectangle(fbp.Rect.x + sum, fbp.Rect.y, fbp.Rect.width / filteredBinPrims.length, fbp.Rect.height);
fbp.MarginRect = new PIXIRectangle(fbp.MarginRect.x - w + sum + (fbp.Rect.width / 2.0), fbp.MarginRect.y, fbp.MarginRect.width, fbp.MarginRect.height);
return sum + fbp.Rect.width;
}
}
- else if (histoBox.ChartType == ChartType.HorizontalBar) {
- if (this.histoOp.X.AggregateFunction == AggregateFunction.Count) {
+ else if (histoBox.ChartType === ChartType.HorizontalBar) {
+ if (this.histoOp.X.AggregateFunction === AggregateFunction.Count) {
fbp.Rect = new PIXIRectangle(fbp.Rect.x + sum, fbp.Rect.y, fbp.Rect.width, fbp.Rect.height);
fbp.MarginRect = new PIXIRectangle(fbp.MarginRect.x + sum, fbp.MarginRect.y, fbp.MarginRect.width, fbp.MarginRect.height);
return sum + fbp.Rect.width;
}
- if (this.histoOp.X.AggregateFunction == AggregateFunction.Avg) {
+ if (this.histoOp.X.AggregateFunction === AggregateFunction.Avg) {
var h = fbp.Rect.height / 2.0;
fbp.Rect = new PIXIRectangle(fbp.Rect.x, fbp.Rect.y + sum, fbp.Rect.width, fbp.Rect.height / filteredBinPrims.length);
fbp.MarginRect = new PIXIRectangle(fbp.MarginRect.x, fbp.MarginRect.y - h + sum + (fbp.Rect.height / 2.0), fbp.MarginRect.width, fbp.MarginRect.height);
@@ -79,19 +79,19 @@ export class HistogramBinPrimitiveCollection {
return 0;
}, 0);
this.BinPrimitives = this.BinPrimitives.reverse();
- var f = this.BinPrimitives.filter(b => b.BrushIndex == allBrushIndex);
+ var f = this.BinPrimitives.filter(b => b.BrushIndex === allBrushIndex);
this.HitGeom = f.length > 0 ? f[0].Rect : PIXIRectangle.EMPTY;
}
private setupBrushing(bin: Bin, normalization: number) {
var overlapBrushIndex = ModelHelpers.OverlapBrushIndex(this.histoResult);
var orderedBrushes = [this.histoResult.brushes![0], this.histoResult.brushes![overlapBrushIndex]];
- this.histoResult.brushes!.map(brush => brush.brushIndex != 0 && brush.brushIndex != overlapBrushIndex && orderedBrushes.push(brush));
+ this.histoResult.brushes!.map(brush => brush.brushIndex !== 0 && brush.brushIndex !== overlapBrushIndex && orderedBrushes.push(brush));
return {
orderedBrushes,
maxAxis: orderedBrushes.reduce((prev, Brush) => {
let aggResult = this.getBinValue(normalization, bin, Brush.brushIndex!);
- return aggResult != undefined && aggResult > prev ? aggResult : prev;
+ return aggResult !== undefined && aggResult > prev ? aggResult : prev;
}, Number.MIN_VALUE)
};
}
@@ -99,20 +99,21 @@ export class HistogramBinPrimitiveCollection {
private createHeatmapBinPrimitives(bin: Bin, brush: Brush, brushFactorSum: number): number {
let unNormalizedValue = this.getBinValue(2, bin, brush.brushIndex!);
- if (unNormalizedValue == undefined)
+ if (unNormalizedValue === undefined) {
return brushFactorSum;
+ }
var normalizedValue = (unNormalizedValue - this._histoBox.ValueRange[0]) / (Math.abs((this._histoBox.ValueRange[1] - this._histoBox.ValueRange[0])) < HistogramBinPrimitiveCollection.TOLERANCE ?
unNormalizedValue : this._histoBox.ValueRange[1] - this._histoBox.ValueRange[0]);
- let allUnNormalizedValue = this.getBinValue(2, bin, ModelHelpers.AllBrushIndex(this.histoResult))
+ let allUnNormalizedValue = this.getBinValue(2, bin, ModelHelpers.AllBrushIndex(this.histoResult));
// bcz: are these calls needed?
let [xFrom, xTo] = this.sizeConverter.DataToScreenXAxisRange(this._histoBox.VisualBinRanges, 0, bin);
let [yFrom, yTo] = this.sizeConverter.DataToScreenYAxisRange(this._histoBox.VisualBinRanges, 1, bin);
var returnBrushFactorSum = brushFactorSum;
- if (allUnNormalizedValue != undefined) {
+ if (allUnNormalizedValue !== undefined) {
var brushFactor = (unNormalizedValue / allUnNormalizedValue);
returnBrushFactorSum += brushFactor;
returnBrushFactorSum = Math.min(returnBrushFactorSum, 1.0);
@@ -141,19 +142,20 @@ export class HistogramBinPrimitiveCollection {
private createSinglePointChartBinPrimitives(bin: Bin, brush: Brush): number {
let unNormalizedValue = this.getBinValue(2, bin, brush.brushIndex!);
- if (unNormalizedValue != undefined) {
+ if (unNormalizedValue !== undefined) {
let [xFrom, xTo] = this.sizeConverter.DataToScreenPointRange(0, bin, ModelHelpers.CreateAggregateKey(this.histoOp.Schema!.distinctAttributeParameters, this.histoOp.X, this.histoResult, brush.brushIndex!));
let [yFrom, yTo] = this.sizeConverter.DataToScreenPointRange(1, bin, ModelHelpers.CreateAggregateKey(this.histoOp.Schema!.distinctAttributeParameters, this.histoOp.Y, this.histoResult, brush.brushIndex!));
- if (xFrom != undefined && yFrom != undefined && xTo != undefined && yTo != undefined)
+ if (xFrom !== undefined && yFrom !== undefined && xTo !== undefined && yTo !== undefined) {
this.createBinPrimitive(-1, brush, PIXIRectangle.EMPTY, 0, xFrom, xTo, yFrom, yTo, this.baseColorFromBrush(brush), 1, unNormalizedValue);
+ }
}
return 0;
}
private createVerticalBarChartBinPrimitives(bin: Bin, brush: Brush, binBrushMaxAxis: number, normalization: number): number {
let dataValue = this.getBinValue(1, bin, brush.brushIndex!);
- if (dataValue != undefined) {
+ if (dataValue !== undefined) {
let [yFrom, yValue, yTo] = this.sizeConverter.DataToScreenNormalizedRange(dataValue, normalization, 1, binBrushMaxAxis);
let [xFrom, xTo] = this.sizeConverter.DataToScreenXAxisRange(this._histoBox.VisualBinRanges, 0, bin);
@@ -163,14 +165,14 @@ export class HistogramBinPrimitiveCollection {
this.sizeConverter.DataToScreenY(yValue - yMarginAbsolute) - this.sizeConverter.DataToScreenY(yValue + yMarginAbsolute));
this.createBinPrimitive(1, brush, marginRect, 0, xFrom, xTo, yFrom, yTo,
- this.baseColorFromBrush(brush), normalization != 0 ? 1 : 0.6 * binBrushMaxAxis / this.sizeConverter.DataRanges[1] + 0.4, dataValue);
+ this.baseColorFromBrush(brush), normalization !== 0 ? 1 : 0.6 * binBrushMaxAxis / this.sizeConverter.DataRanges[1] + 0.4, dataValue);
}
return 0;
}
private createHorizontalBarChartBinPrimitives(bin: Bin, brush: Brush, binBrushMaxAxis: number, normalization: number): number {
let dataValue = this.getBinValue(0, bin, brush.brushIndex!);
- if (dataValue != undefined) {
+ if (dataValue !== undefined) {
let [xFrom, xValue, xTo] = this.sizeConverter.DataToScreenNormalizedRange(dataValue, normalization, 0, binBrushMaxAxis);
let [yFrom, yTo] = this.sizeConverter.DataToScreenYAxisRange(this._histoBox.VisualBinRanges, 1, bin);
@@ -181,15 +183,15 @@ export class HistogramBinPrimitiveCollection {
2.0);
this.createBinPrimitive(0, brush, marginRect, 0, xFrom, xTo, yFrom, yTo,
- this.baseColorFromBrush(brush), normalization != 1 ? 1 : 0.6 * binBrushMaxAxis / this.sizeConverter.DataRanges[0] + 0.4, dataValue);
+ this.baseColorFromBrush(brush), normalization !== 1 ? 1 : 0.6 * binBrushMaxAxis / this.sizeConverter.DataRanges[0] + 0.4, dataValue);
}
return 0;
}
public getBinValue(axis: number, bin: Bin, brushIndex: number) {
- var aggregateKey = ModelHelpers.CreateAggregateKey(this.histoOp.Schema!.distinctAttributeParameters, axis == 0 ? this.histoOp.X : axis == 1 ? this.histoOp.Y : this.histoOp.V, this.histoResult, brushIndex);
+ var aggregateKey = ModelHelpers.CreateAggregateKey(this.histoOp.Schema!.distinctAttributeParameters, axis === 0 ? this.histoOp.X : axis === 1 ? this.histoOp.Y : this.histoOp.V, this.histoResult, brushIndex);
let dataValue = ModelHelpers.GetAggregateResult(bin, aggregateKey) as DoubleValueAggregateResult;
- return dataValue != null && dataValue.hasResult ? dataValue.result : undefined;
+ return dataValue !== null && dataValue.hasResult ? dataValue.result : undefined;
}
private getMargin(bin: Bin, brush: Brush, axis: AttributeTransformationModel) {
@@ -218,13 +220,13 @@ export class HistogramBinPrimitiveCollection {
private baseColorFromBrush(brush: Brush): number {
let bc = StyleConstants.BRUSH_COLORS;
- if (brush.brushIndex == ModelHelpers.RestBrushIndex(this.histoResult)) {
+ if (brush.brushIndex === ModelHelpers.RestBrushIndex(this.histoResult)) {
return StyleConstants.HIGHLIGHT_COLOR;
}
- else if (brush.brushIndex == ModelHelpers.OverlapBrushIndex(this.histoResult)) {
+ else if (brush.brushIndex === ModelHelpers.OverlapBrushIndex(this.histoResult)) {
return StyleConstants.OVERLAP_COLOR;
}
- else if (brush.brushIndex == ModelHelpers.AllBrushIndex(this.histoResult)) {
+ else if (brush.brushIndex === ModelHelpers.AllBrushIndex(this.histoResult)) {
return 0x00ff00;
}
else if (bc.length > 0) {
diff --git a/src/client/northstar/dash-nodes/HistogramBox.tsx b/src/client/northstar/dash-nodes/HistogramBox.tsx
index dd6e09900..7df59ef07 100644
--- a/src/client/northstar/dash-nodes/HistogramBox.tsx
+++ b/src/client/northstar/dash-nodes/HistogramBox.tsx
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { action, computed, observable, reaction, runInAction, trace } from "mobx";
import { observer } from "mobx-react";
import Measure from "react-measure";
@@ -25,7 +25,7 @@ import { StyleConstants } from "../utils/StyleContants";
@observer
export class HistogramBox extends React.Component<FieldViewProps> {
- public static LayoutString(fieldStr: string = "DataKey") { return FieldView.LayoutString(HistogramBox, fieldStr) }
+ public static LayoutString(fieldStr: string = "DataKey") { return FieldView.LayoutString(HistogramBox, fieldStr); }
private _dropXRef = React.createRef<HTMLDivElement>();
private _dropYRef = React.createRef<HTMLDivElement>();
private _dropXDisposer?: DragManager.DragDropDisposer;
@@ -55,7 +55,7 @@ export class HistogramBox extends React.Component<FieldViewProps> {
dropX = (e: Event, de: DragManager.DropEvent) => {
if (de.data instanceof DragManager.DocumentDragData) {
let h = de.data.draggedDocuments[0].GetT(KeyStore.Data, HistogramField);
- if (h && h != FieldWaiting) {
+ if (h && h !== FieldWaiting) {
this.HistoOp.X = h.Data.X;
}
e.stopPropagation();
@@ -66,7 +66,7 @@ export class HistogramBox extends React.Component<FieldViewProps> {
dropY = (e: Event, de: DragManager.DropEvent) => {
if (de.data instanceof DragManager.DocumentDragData) {
let h = de.data.draggedDocuments[0].GetT(KeyStore.Data, HistogramField);
- if (h && h != FieldWaiting) {
+ if (h && h !== FieldWaiting) {
this.HistoOp.Y = h.Data.X;
}
e.stopPropagation();
@@ -76,11 +76,11 @@ export class HistogramBox extends React.Component<FieldViewProps> {
@action
xLabelPointerDown = (e: React.PointerEvent) => {
- this.HistoOp.X = new AttributeTransformationModel(this.HistoOp.X.AttributeModel, this.HistoOp.X.AggregateFunction == AggregateFunction.None ? AggregateFunction.Count : AggregateFunction.None);
+ this.HistoOp.X = new AttributeTransformationModel(this.HistoOp.X.AttributeModel, this.HistoOp.X.AggregateFunction === AggregateFunction.None ? AggregateFunction.Count : AggregateFunction.None);
}
@action
yLabelPointerDown = (e: React.PointerEvent) => {
- this.HistoOp.Y = new AttributeTransformationModel(this.HistoOp.Y.AttributeModel, this.HistoOp.Y.AggregateFunction == AggregateFunction.None ? AggregateFunction.Count : AggregateFunction.None);
+ this.HistoOp.Y = new AttributeTransformationModel(this.HistoOp.Y.AttributeModel, this.HistoOp.Y.AggregateFunction === AggregateFunction.None ? AggregateFunction.Count : AggregateFunction.None);
}
componentDidMount() {
@@ -92,15 +92,15 @@ export class HistogramBox extends React.Component<FieldViewProps> {
}
reaction(() => CurrentUserUtils.NorthstarDBCatalog, (catalog?: Catalog) => this.activateHistogramOperation(catalog), { fireImmediately: true });
reaction(() => [this.VisualBinRanges && this.VisualBinRanges.slice()], () => this.SizeConverter.SetVisualBinRanges(this.VisualBinRanges));
- reaction(() => [this.PanelHeight, this.PanelWidth], () => this.SizeConverter.SetIsSmall(this.PanelWidth < 40 && this.PanelHeight < 40))
+ reaction(() => [this.PanelHeight, this.PanelWidth], () => this.SizeConverter.SetIsSmall(this.PanelWidth < 40 && this.PanelHeight < 40));
reaction(() => this.HistogramResult ? this.HistogramResult.binRanges : undefined,
(binRanges: BinRange[] | undefined) => {
if (binRanges) {
this.VisualBinRanges.splice(0, this.VisualBinRanges.length, ...binRanges.map((br, ind) =>
- VisualBinRangeHelper.GetVisualBinRange(this.HistoOp.Schema!.distinctAttributeParameters, br, this.HistogramResult!, ind ? this.HistoOp.Y : this.HistoOp.X, this.ChartType)));
+ VisualBinRangeHelper.GetVisualBinRange(this.HistoOp.Schema!.distinctAttributeParameters, br, this.HistogramResult, ind ? this.HistoOp.Y : this.HistoOp.X, this.ChartType)));
- let valueAggregateKey = ModelHelpers.CreateAggregateKey(this.HistoOp.Schema!.distinctAttributeParameters, this.HistoOp.V, this.HistogramResult!, ModelHelpers.AllBrushIndex(this.HistogramResult!));
- this.ValueRange = Object.values(this.HistogramResult!.bins!).reduce((prev, cur) => {
+ let valueAggregateKey = ModelHelpers.CreateAggregateKey(this.HistoOp.Schema!.distinctAttributeParameters, this.HistoOp.V, this.HistogramResult, ModelHelpers.AllBrushIndex(this.HistogramResult));
+ this.ValueRange = Object.values(this.HistogramResult.bins!).reduce((prev, cur) => {
let value = ModelHelpers.GetAggregateResult(cur, valueAggregateKey) as DoubleValueAggregateResult;
return value && value.hasResult ? [Math.min(prev[0], value.result!), Math.max(prev[1], value.result!)] : prev;
}, [Number.MAX_VALUE, Number.MIN_VALUE]);
@@ -109,26 +109,28 @@ export class HistogramBox extends React.Component<FieldViewProps> {
}
componentWillUnmount() {
- if (this._dropXDisposer)
+ if (this._dropXDisposer) {
this._dropXDisposer();
- if (this._dropYDisposer)
+ }
+ if (this._dropYDisposer) {
this._dropYDisposer();
+ }
}
activateHistogramOperation(catalog?: Catalog) {
if (catalog) {
- this.props.doc.GetTAsync(this.props.fieldKey, HistogramField).then((histoOp: Opt<HistogramField>) => runInAction(() => {
+ this.props.Document.GetTAsync(this.props.fieldKey, HistogramField).then((histoOp: Opt<HistogramField>) => runInAction(() => {
this.HistoOp = histoOp ? histoOp.Data : HistogramOperation.Empty;
- if (this.HistoOp != HistogramOperation.Empty) {
- reaction(() => this.props.doc.GetList(KeyStore.LinkedFromDocs, []), (docs: Document[]) => this.HistoOp.Links.splice(0, this.HistoOp.Links.length, ...docs), { fireImmediately: true });
- reaction(() => this.props.doc.GetList(KeyStore.BrushingDocs, []).length,
+ if (this.HistoOp !== HistogramOperation.Empty) {
+ reaction(() => this.props.Document.GetList(KeyStore.LinkedFromDocs, []), (docs: Document[]) => this.HistoOp.Links.splice(0, this.HistoOp.Links.length, ...docs), { fireImmediately: true });
+ reaction(() => this.props.Document.GetList(KeyStore.BrushingDocs, []).length,
() => {
- let brushingDocs = this.props.doc.GetList(KeyStore.BrushingDocs, [] as Document[]);
- let proto = this.props.doc.GetPrototype() as Document;
+ let brushingDocs = this.props.Document.GetList(KeyStore.BrushingDocs, [] as Document[]);
+ let proto = this.props.Document.GetPrototype() as Document;
this.HistoOp.BrushLinks.splice(0, this.HistoOp.BrushLinks.length, ...brushingDocs.map((brush, i) => {
brush.SetNumber(KeyStore.BackgroundColor, StyleConstants.BRUSH_COLORS[i % StyleConstants.BRUSH_COLORS.length]);
let brushed = brush.GetList(KeyStore.BrushingDocs, [] as Document[]);
- return { l: brush, b: brushed[0].Id == proto.Id ? brushed[1] : brushed[0] }
+ return { l: brush, b: brushed[0].Id === proto.Id ? brushed[1] : brushed[0] };
}));
}, { fireImmediately: true });
reaction(() => this.createOperationParamsCache, () => this.HistoOp.Update(), { fireImmediately: true });
@@ -139,14 +141,14 @@ export class HistogramBox extends React.Component<FieldViewProps> {
render() {
let labelY = this.HistoOp && this.HistoOp.Y ? this.HistoOp.Y.PresentedName : "<...>";
let labelX = this.HistoOp && this.HistoOp.X ? this.HistoOp.X.PresentedName : "<...>";
- var h = this.props.isTopMost ? this.PanelHeight : this.props.doc.GetNumber(KeyStore.Height, 0);
- var w = this.props.isTopMost ? this.PanelWidth : this.props.doc.GetNumber(KeyStore.Width, 0);
+ var h = this.props.isTopMost ? this.PanelHeight : this.props.Document.GetNumber(KeyStore.Height, 0);
+ var w = this.props.isTopMost ? this.PanelWidth : this.props.Document.GetNumber(KeyStore.Width, 0);
let loff = this.SizeConverter.LeftOffset;
let toff = this.SizeConverter.TopOffset;
let roff = this.SizeConverter.RightOffset;
let boff = this.SizeConverter.BottomOffset;
return (
- <Measure onResize={(r: any) => runInAction(() => { this.PanelWidth = r.entry.width; this.PanelHeight = r.entry.height })}>
+ <Measure onResize={(r: any) => runInAction(() => { this.PanelWidth = r.entry.width; this.PanelHeight = r.entry.height; })}>
{({ measureRef }) =>
<div className="histogrambox-container" ref={measureRef} style={{ transform: `translate(-50%, -50%)` }}>
<div className="histogrambox-yaxislabel" onPointerDown={this.yLabelPointerDown} ref={this._dropYRef} >
@@ -168,7 +170,7 @@ export class HistogramBox extends React.Component<FieldViewProps> {
</div>
}
</Measure>
- )
+ );
}
}
diff --git a/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx b/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
index 0918bc0c4..4c5bdb14b 100644
--- a/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
+++ b/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { computed, observable, reaction, runInAction, trace, action } from "mobx";
import { observer } from "mobx-react";
import { Utils as DashUtils } from '../../../Utils';
@@ -28,17 +28,18 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
@computed get selectedPrimitives() { return this._selectedPrims.map(bp => this.drawRect(bp.Rect, bp.BarAxis, undefined, "border")); }
@computed get barPrimitives() {
let histoResult = this.props.HistoBox.HistogramResult;
- if (!histoResult || !histoResult.bins || !this.props.HistoBox.VisualBinRanges.length)
+ if (!histoResult || !histoResult.bins || !this.props.HistoBox.VisualBinRanges.length) {
return (null);
+ }
let allBrushIndex = ModelHelpers.AllBrushIndex(histoResult);
return Object.keys(histoResult.bins).reduce((prims: JSX.Element[], key: string) => {
- let drawPrims = new HistogramBinPrimitiveCollection(histoResult!.bins![key], this.props.HistoBox);
+ let drawPrims = new HistogramBinPrimitiveCollection(histoResult.bins![key], this.props.HistoBox);
let toggle = this.getSelectionToggle(drawPrims.BinPrimitives, allBrushIndex,
- ModelHelpers.GetBinFilterModel(histoResult!.bins![key], allBrushIndex, histoResult!, this.histoOp.X, this.histoOp.Y));
+ ModelHelpers.GetBinFilterModel(histoResult.bins![key], allBrushIndex, histoResult, this.histoOp.X, this.histoOp.Y));
drawPrims.BinPrimitives.filter(bp => bp.DataValue && bp.BrushIndex !== allBrushIndex).map(bp =>
prims.push(...[{ r: bp.Rect, c: bp.Color }, { r: bp.MarginRect, c: StyleConstants.MARGIN_BARS_COLOR }].map(pair => this.drawRect(pair.r, bp.BarAxis, pair.c, "bar", toggle))));
return prims;
- }, [] as JSX.Element[])
+ }, [] as JSX.Element[]);
}
componentDidMount() {
@@ -46,9 +47,10 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
}
private getSelectionToggle(binPrimitives: HistogramBinPrimitive[], allBrushIndex: number, filterModel: FilterModel) {
- let rawAllBrushPrim = ArrayUtil.FirstOrDefault(binPrimitives, bp => bp.BrushIndex == allBrushIndex);
- if (!rawAllBrushPrim)
- return () => { }
+ let rawAllBrushPrim = ArrayUtil.FirstOrDefault(binPrimitives, bp => bp.BrushIndex === allBrushIndex);
+ if (!rawAllBrushPrim) {
+ return () => { };
+ }
let allBrushPrim = rawAllBrushPrim;
return () => runInAction(() => {
if (ArrayUtil.Contains(this.histoOp.FilterModels, filterModel)) {
@@ -59,23 +61,25 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
this._selectedPrims.push(allBrushPrim);
this.histoOp.AddFilterModels([filterModel]);
}
- })
+ });
}
private renderGridLinesAndLabels(axis: number) {
trace();
- if (!this.props.HistoBox.SizeConverter.Initialized)
+ if (!this.props.HistoBox.SizeConverter.Initialized) {
return (null);
+ }
let labels = this.props.HistoBox.VisualBinRanges[axis].GetLabels();
return <svg className="histogramboxprimitives-svgContainer">
{labels.reduce((prims, binLabel, i) => {
let r = this.props.HistoBox.SizeConverter.DataToScreenRange(binLabel.minValue!, binLabel.maxValue!, axis);
- prims.push(this.drawLine(r.xFrom, r.yFrom, axis == 0 ? 0 : r.xTo - r.xFrom, axis == 0 ? r.yTo - r.yFrom : 0));
- if (i == labels.length - 1)
- prims.push(this.drawLine(axis == 0 ? r.xTo : r.xFrom, axis == 0 ? r.yFrom : r.yTo, axis == 0 ? 0 : r.xTo - r.xFrom, axis == 0 ? r.yTo - r.yFrom : 0));
+ prims.push(this.drawLine(r.xFrom, r.yFrom, axis === 0 ? 0 : r.xTo - r.xFrom, axis === 0 ? r.yTo - r.yFrom : 0));
+ if (i === labels.length - 1) {
+ prims.push(this.drawLine(axis === 0 ? r.xTo : r.xFrom, axis === 0 ? r.yFrom : r.yTo, axis === 0 ? 0 : r.xTo - r.xFrom, axis === 0 ? r.yTo - r.yFrom : 0));
+ }
return prims;
}, [] as JSX.Element[])}
- </svg>
+ </svg>;
}
drawLine(xFrom: number, yFrom: number, width: number, height: number) {
@@ -89,9 +93,9 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
}
let trans2Xpercent = `${(xFrom + width) / this.renderDimension * 100}%`;
let trans2Ypercent = `${(yFrom + height) / this.renderDimension * 100}%`;
- let trans1Xpercent = `${xFrom / this.renderDimension * 100}%`
- let trans1Ypercent = `${yFrom / this.renderDimension * 100}%`
- return <line className="histogramboxprimitives-line" key={DashUtils.GenerateGuid()} x1={trans1Xpercent} x2={`${trans2Xpercent}`} y1={trans1Ypercent} y2={`${trans2Ypercent}`} />
+ let trans1Xpercent = `${xFrom / this.renderDimension * 100}%`;
+ let trans1Ypercent = `${yFrom / this.renderDimension * 100}%`;
+ return <line className="histogramboxprimitives-line" key={DashUtils.GenerateGuid()} x1={trans1Xpercent} x2={`${trans2Xpercent}`} y1={trans1Ypercent} y2={`${trans2Ypercent}`} />;
}
drawRect(r: PIXIRectangle, barAxis: number, color: number | undefined, classExt: string, tapHandler: () => void = () => { }) {
if (r.height < 0) {
@@ -102,11 +106,11 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
r.x += r.width;
r.width = -r.width;
}
- let transXpercent = `${r.x / this.renderDimension * 100}%`
- let transYpercent = `${r.y / this.renderDimension * 100}%`
+ let transXpercent = `${r.x / this.renderDimension * 100}%`;
+ let transYpercent = `${r.y / this.renderDimension * 100}%`;
let widthXpercent = `${r.width / this.renderDimension * 100}%`;
let heightYpercent = `${r.height / this.renderDimension * 100}%`;
- return (<rect className={`histogramboxprimitives-${classExt}`} key={DashUtils.GenerateGuid()} onPointerDown={(e: React.PointerEvent) => { if (e.button == 0) tapHandler() }}
+ return (<rect className={`histogramboxprimitives-${classExt}`} key={DashUtils.GenerateGuid()} onPointerDown={(e: React.PointerEvent) => { if (e.button === 0) tapHandler(); }}
x={transXpercent} width={`${widthXpercent}`} y={transYpercent} height={`${heightYpercent}`} fill={color ? `${LABColor.RGBtoHexString(color)}` : "transparent"} />);
}
render() {
@@ -118,6 +122,6 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
{this.barPrimitives}
{this.selectedPrimitives}
</svg>
- </div>
+ </div>;
}
} \ No newline at end of file
diff --git a/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx b/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx
index 93b237deb..5785fe838 100644
--- a/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx
+++ b/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { action, computed, reaction } from "mobx";
import { observer } from "mobx-react";
import { Utils as DashUtils } from '../../../Utils';
@@ -13,7 +13,7 @@ import { HistogramPrimitivesProps } from "./HistogramBoxPrimitives";
export class HistogramLabelPrimitives extends React.Component<HistogramPrimitivesProps> {
componentDidMount() {
reaction(() => [this.props.HistoBox.PanelWidth, this.props.HistoBox.SizeConverter.LeftOffset, this.props.HistoBox.VisualBinRanges.length],
- (fields) => HistogramLabelPrimitives.computeLabelAngle(fields[0] as number, fields[1] as number, this.props.HistoBox), { fireImmediately: true });
+ (fields) => HistogramLabelPrimitives.computeLabelAngle(fields[0], fields[1], this.props.HistoBox), { fireImmediately: true });
}
@action
@@ -32,9 +32,10 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
private renderGridLinesAndLabels(axis: number) {
let sc = this.props.HistoBox.SizeConverter;
let vb = this.props.HistoBox.VisualBinRanges;
- if (!vb.length || !sc.Initialized)
+ if (!vb.length || !sc.Initialized) {
return (null);
- let dim = (axis == 0 ? this.props.HistoBox.PanelWidth : this.props.HistoBox.PanelHeight) / ((axis == 0 && vb[axis] instanceof NominalVisualBinRange) ?
+ }
+ let dim = (axis === 0 ? this.props.HistoBox.PanelWidth : this.props.HistoBox.PanelHeight) / ((axis === 0 && vb[axis] instanceof NominalVisualBinRange) ?
(12 + 5) : // (<number>FontStyles.AxisLabel.fontSize + 5)));
sc.MaxLabelSizes[axis].coords[axis] + 5);
@@ -47,21 +48,21 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
let xStart = (axis === 0 ? r.xFrom + (r.xTo - r.xFrom) / 2.0 : r.xFrom - 10 - textWidth);
let yStart = (axis === 1 ? r.yFrom - textHeight / 2 : r.yFrom);
- if (axis == 0 && vb[axis] instanceof NominalVisualBinRange) {
+ if (axis === 0 && vb[axis] instanceof NominalVisualBinRange) {
let space = (r.xTo - r.xFrom) / sc.RenderDimension * this.props.HistoBox.PanelWidth;
xStart += Math.max(textWidth / 2, (1 - textWidth / space) * textWidth / 2) - textHeight / 2;
}
- let xPercent = axis == 1 ? `${xStart}px` : `${xStart / sc.RenderDimension * 100}%`
- let yPercent = axis == 0 ? `${this.props.HistoBox.PanelHeight - sc.BottomOffset - textHeight}px` : `${yStart / sc.RenderDimension * 100}%`
+ let xPercent = axis === 1 ? `${xStart}px` : `${xStart / sc.RenderDimension * 100}%`;
+ let yPercent = axis === 0 ? `${this.props.HistoBox.PanelHeight - sc.BottomOffset - textHeight}px` : `${yStart / sc.RenderDimension * 100}%`;
prims.push(
<div className="histogramLabelPrimitives-placer" key={DashUtils.GenerateGuid()} style={{ transform: `translate(${xPercent}, ${yPercent})` }}>
- <div className="histogramLabelPrimitives-gridlabel" style={{ transform: `rotate(${axis == 0 ? sc.LabelAngle : 0}rad)` }}>
+ <div className="histogramLabelPrimitives-gridlabel" style={{ transform: `rotate(${axis === 0 ? sc.LabelAngle : 0}rad)` }}>
{label}
</div>
</div>
- )
+ );
}
return prims;
}, [] as JSX.Element[]);
@@ -73,7 +74,7 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
return <div className="histogramLabelPrimitives-container">
{xaxislines}
{yaxislines}
- </div>
+ </div>;
}
} \ No newline at end of file
diff --git a/src/client/northstar/manager/Gateway.ts b/src/client/northstar/manager/Gateway.ts
index 5ae5e4f47..8f3b6b11c 100644
--- a/src/client/northstar/manager/Gateway.ts
+++ b/src/client/northstar/manager/Gateway.ts
@@ -1,4 +1,4 @@
-import { Catalog, OperationReference, Result, CompileResults } from "../model/idea/idea"
+import { Catalog, OperationReference, Result, CompileResults } from "../model/idea/idea";
import { computed, observable, action } from "mobx";
export class Gateway {
@@ -23,6 +23,17 @@ export class Gateway {
}
}
+ public async GetSchema(dbName: string): Promise<Catalog> {
+ try {
+ const json = await this.MakeGetRequest("schema", undefined, dbName);
+ const cat = Catalog.fromJS(json);
+ return cat;
+ }
+ catch (error) {
+ throw new Error("can not reach northstar's backend");
+ }
+ }
+
public async ClearCatalog(): Promise<void> {
try {
const json = await this.MakePostJsonRequest("Datamart/ClearAllAugmentations", {});
@@ -49,7 +60,7 @@ export class Gateway {
public async Compile(data: any): Promise<CompileResults | undefined> {
const json = await this.MakePostJsonRequest("compile", data);
- if (json != null) {
+ if (json !== null) {
const cr = CompileResults.fromJS(json);
return cr;
}
@@ -108,7 +119,7 @@ export class Gateway {
public async StartOperation(data: any): Promise<OperationReference | undefined> {
const json = await this.MakePostJsonRequest("operation", data);
- if (json != null) {
+ if (json !== null) {
const or = OperationReference.fromJS(json);
return or;
}
@@ -116,7 +127,7 @@ export class Gateway {
public async GetResult(data: any): Promise<Result | undefined> {
const json = await this.MakePostJsonRequest("result", data);
- if (json != null) {
+ if (json !== null) {
const res = Result.fromJS(json);
return res;
}
@@ -133,8 +144,15 @@ export class Gateway {
});
}
- public async MakeGetRequest(endpoint: string, signal?: AbortSignal): Promise<any> {
- const url = Gateway.ConstructUrl(endpoint);
+ public async MakeGetRequest(endpoint: string, signal?: AbortSignal, data?: any): Promise<any> {
+ let url = !data ? Gateway.ConstructUrl(endpoint) :
+ (() => {
+ let newUrl = new URL(Gateway.ConstructUrl(endpoint));
+ newUrl.searchParams.append("data", data);
+ return Gateway.ConstructUrl(endpoint) + newUrl.search;
+ return newUrl as any;
+ })();
+
const response = await fetch(url,
{
redirect: "follow",
@@ -163,7 +181,7 @@ export class Gateway {
public static ConstructUrl(appendix: string): string {
let base = Settings.Instance.ServerUrl;
- if (base.slice(-1) == "/") {
+ if (base.slice(-1) === "/") {
base = base.slice(0, -1);
}
let url = base + "/" + Settings.Instance.ServerApiPath + "/" + appendix;
@@ -246,18 +264,18 @@ export class Settings {
else {
this.ServerUrl = environment["SERVER_URL"] ? environment["SERVER_URL"] : document.URL;
}*/
- this.ServerUrl = environment["SERVER_URL"] ? environment["SERVER_URL"] : document.URL;
- this.ServerApiPath = environment["SERVER_API_PATH"];
- this.SampleSize = environment["SAMPLE_SIZE"];
- this.XBins = environment["X_BINS"];
- this.YBins = environment["Y_BINS"];
- this.SplashTimeInMS = environment["SPLASH_TIME_IN_MS"];
- this.ShowFpsCounter = environment["SHOW_FPS_COUNTER"];
- this.ShowShutdownButton = environment["SHOW_SHUTDOWN_BUTTON"];
- this.IsMenuFixed = environment["IS_MENU_FIXED"];
- this.IsDarpa = environment["IS_DARPA"];
- this.IsIGT = environment["IS_IGT"];
- this.DegreeOfParallelism = environment["DEGREE_OF_PARALLISM"];
+ this.ServerUrl = environment.SERVER_URL ? environment.SERVER_URL : document.URL;
+ this.ServerApiPath = environment.SERVER_API_PATH;
+ this.SampleSize = environment.SAMPLE_SIZE;
+ this.XBins = environment.X_BINS;
+ this.YBins = environment.Y_BINS;
+ this.SplashTimeInMS = environment.SPLASH_TIME_IN_MS;
+ this.ShowFpsCounter = environment.SHOW_FPS_COUNTER;
+ this.ShowShutdownButton = environment.SHOW_SHUTDOWN_BUTTON;
+ this.IsMenuFixed = environment.IS_MENU_FIXED;
+ this.IsDarpa = environment.IS_DARPA;
+ this.IsIGT = environment.IS_IGT;
+ this.DegreeOfParallelism = environment.DEGREE_OF_PARALLISM;
}
public static get Instance(): Settings {
diff --git a/src/client/northstar/model/ModelExtensions.ts b/src/client/northstar/model/ModelExtensions.ts
index 9fcba7f1c..29f80d2d1 100644
--- a/src/client/northstar/model/ModelExtensions.ts
+++ b/src/client/northstar/model/ModelExtensions.ts
@@ -1,48 +1,48 @@
-import { AttributeParameters, Brush, MarginAggregateParameters, SingleDimensionAggregateParameters, Solution } from '../model/idea/idea'
-import { Utils } from '../utils/Utils'
+import { AttributeParameters, Brush, MarginAggregateParameters, SingleDimensionAggregateParameters, Solution } from '../model/idea/idea';
+import { Utils } from '../utils/Utils';
-import { FilterModel } from '../core/filter/FilterModel'
+import { FilterModel } from '../core/filter/FilterModel';
-(SingleDimensionAggregateParameters as any).prototype["Equals"] = function (other: Object) {
+(SingleDimensionAggregateParameters as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if (!Utils.EqualityHelper((this as SingleDimensionAggregateParameters).attributeParameters!,
(other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
- if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any)["Equals"]((other as SingleDimensionAggregateParameters).attributeParameters)) return false;
+ if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any).Equals((other as SingleDimensionAggregateParameters).attributeParameters)) return false;
return true;
-}
+};
{
- (AttributeParameters as any).prototype["Equals"] = function (other: AttributeParameters) {
- return (<any>this).constructor.name === (<any>other).constructor.name &&
+ (AttributeParameters as any).prototype.Equals = function (other: AttributeParameters) {
+ return (this).constructor.name === (<any>other).constructor.name &&
this.rawName === other.rawName;
- }
+ };
}
{
- (Solution as any).prototype["Equals"] = function (other: Object) {
+ (Solution as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if ((this as Solution).solutionId !== (other as Solution).solutionId) return false;
return true;
- }
+ };
}
{
- (MarginAggregateParameters as any).prototype["Equals"] = function (other: Object) {
+ (MarginAggregateParameters as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if (!Utils.EqualityHelper((this as SingleDimensionAggregateParameters).attributeParameters!,
(other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
- if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any)["Equals"]((other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
+ if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any).Equals((other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
if ((this as MarginAggregateParameters).aggregateFunction !== (other as MarginAggregateParameters).aggregateFunction) return false;
return true;
- }
+ };
}
{
- (Brush as any).prototype["Equals"] = function (other: Object) {
+ (Brush as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if ((this as Brush).brushEnum !== (other as Brush).brushEnum) return false;
if ((this as Brush).brushIndex !== (other as Brush).brushIndex) return false;
return true;
- }
+ };
} \ No newline at end of file
diff --git a/src/client/northstar/model/ModelHelpers.ts b/src/client/northstar/model/ModelHelpers.ts
index d0711fb69..ac807b41f 100644
--- a/src/client/northstar/model/ModelHelpers.ts
+++ b/src/client/northstar/model/ModelHelpers.ts
@@ -16,7 +16,7 @@ export class ModelHelpers {
public static CreateAggregateKey(distinctAttributeParameters: AttributeParameters | undefined, atm: AttributeTransformationModel, histogramResult: HistogramResult,
brushIndex: number, aggParameters?: SingleDimensionAggregateParameters): AggregateKey {
{
- if (aggParameters == undefined) {
+ if (aggParameters === undefined) {
aggParameters = ModelHelpers.GetAggregateParameter(distinctAttributeParameters, atm);
}
else {
@@ -64,7 +64,7 @@ export class ModelHelpers {
if (aggParams) {
aggregateParameters.push(aggParams);
- var margin = new MarginAggregateParameters()
+ var margin = new MarginAggregateParameters();
margin.aggregateFunction = agg.AggregateFunction;
margin.attributeParameters = ModelHelpers.GetAttributeParameters(agg.AttributeModel);
margin.distinctAttributeParameters = distinctAttributeParameters;
@@ -106,7 +106,7 @@ export class ModelHelpers {
{
rawName: am.CodeName,
visualizationHints: am.VisualizationHints,
- id: (am as BackendAttributeModel).Id
+ id: (am).Id
});
}
else if (am instanceof CodeAttributeModel) {
@@ -114,11 +114,11 @@ export class ModelHelpers {
{
rawName: am.CodeName,
visualizationHints: am.VisualizationHints,
- code: (am as CodeAttributeModel).Code
+ code: (am).Code
});
}
else {
- throw new Exception()
+ throw new Exception();
}
}
@@ -146,7 +146,7 @@ export class ModelHelpers {
}
public static GetAggregateResult(bin: Bin, aggregateKey: AggregateKey) {
- if (aggregateKey.aggregateParameterIndex == -1 || aggregateKey.brushIndex == -1) {
+ if (aggregateKey.aggregateParameterIndex === -1 || aggregateKey.brushIndex === -1) {
return null;
}
return bin.aggregateResults![aggregateKey.aggregateParameterIndex! * bin.ySize! + aggregateKey.brushIndex!];
@@ -157,9 +157,9 @@ export class ModelHelpers {
var ret = new Array<AggregateFunction>();
ret.push(AggregateFunction.None);
ret.push(AggregateFunction.Count);
- if (atm.AttributeModel.DataType == DataType.Float ||
- atm.AttributeModel.DataType == DataType.Double ||
- atm.AttributeModel.DataType == DataType.Int) {
+ if (atm.AttributeModel.DataType === DataType.Float ||
+ atm.AttributeModel.DataType === DataType.Double ||
+ atm.AttributeModel.DataType === DataType.Int) {
ret.push(AggregateFunction.Avg);
ret.push(AggregateFunction.Sum);
}
diff --git a/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts b/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
index 995bf4e0b..120b034f2 100644
--- a/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { AlphabeticBinRange, BinLabel } from '../../model/idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { AlphabeticBinRange, BinLabel } from '../../model/idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class AlphabeticVisualBinRange extends VisualBinRange {
public DataBinRange: AlphabeticBinRange;
diff --git a/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts b/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
index 9313fb1a7..776e643cd 100644
--- a/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { DateTimeBinRange, DateTimeStep, DateTimeStepGranularity } from '../idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { DateTimeBinRange, DateTimeStep, DateTimeStepGranularity } from '../idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class DateTimeVisualBinRange extends VisualBinRange {
public DataBinRange: DateTimeBinRange;
@@ -39,24 +39,24 @@ export class DateTimeVisualBinRange extends VisualBinRange {
public GetLabel(value: number): string {
var dt = DateTimeVisualBinRange.TicksToDate(value);
- if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Second ||
- this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Minute) {
+ if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Second ||
+ this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Minute) {
return ("" + this.pad(dt.getMinutes(), 2) + ":" + this.pad(dt.getSeconds(), 2));
//return dt.ToString("mm:ss");
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Hour) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Hour) {
return (this.pad(dt.getHours(), 2) + ":" + this.pad(dt.getMinutes(), 2));
//return dt.ToString("HH:mm");
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Day) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Day) {
return ((dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear());
//return dt.ToString("MM/dd/yyyy");
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Month) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Month) {
//return dt.ToString("MM/yyyy");
return ((dt.getMonth() + 1) + "/" + dt.getFullYear());
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Year) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Year) {
return "" + dt.getFullYear();
}
return "n/a";
@@ -82,22 +82,22 @@ export class DateTimeVisualBinRange extends VisualBinRange {
public static AddToDateTimeTicks(ticks: number, dateTimeStep: DateTimeStep): number {
var copiedDate = DateTimeVisualBinRange.TicksToDate(ticks);
var returnDate: Date = new Date(Date.now());
- if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Second) {
+ if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Second) {
returnDate = new Date(copiedDate.setSeconds(copiedDate.getSeconds() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Minute) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Minute) {
returnDate = new Date(copiedDate.setMinutes(copiedDate.getMinutes() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Hour) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Hour) {
returnDate = new Date(copiedDate.setHours(copiedDate.getHours() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Day) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Day) {
returnDate = new Date(copiedDate.setDate(copiedDate.getDate() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Month) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Month) {
returnDate = new Date(copiedDate.setMonth(copiedDate.getMonth() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Year) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Year) {
returnDate = new Date(copiedDate.setFullYear(copiedDate.getFullYear() + dateTimeStep.dateTimeStepValue!));
}
return DateTimeVisualBinRange.DateToTicks(returnDate);
diff --git a/src/client/northstar/model/binRanges/NominalVisualBinRange.ts b/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
index 407ff3ea6..42509d797 100644
--- a/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { NominalBinRange, BinLabel } from '../../model/idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { NominalBinRange, BinLabel } from '../../model/idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class NominalVisualBinRange extends VisualBinRange {
public DataBinRange: NominalBinRange;
diff --git a/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts b/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
index 80886416b..c579c8e5f 100644
--- a/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
@@ -1,4 +1,4 @@
-import { QuantitativeBinRange } from '../idea/idea'
+import { QuantitativeBinRange } from '../idea/idea';
import { VisualBinRange } from './VisualBinRange';
import { format } from "d3-format";
diff --git a/src/client/northstar/model/binRanges/VisualBinRange.ts b/src/client/northstar/model/binRanges/VisualBinRange.ts
index f53008f9a..449a22e91 100644
--- a/src/client/northstar/model/binRanges/VisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/VisualBinRange.ts
@@ -1,11 +1,7 @@
-import { BinLabel } from '../../model/idea/idea'
+import { BinLabel } from '../../model/idea/idea';
export abstract class VisualBinRange {
- constructor() {
-
- }
-
public abstract AddStep(value: number): number;
public abstract GetValueFromIndex(index: number): number;
diff --git a/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts b/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
index 53d585bb4..9671e55f8 100644
--- a/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
+++ b/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
@@ -16,18 +16,18 @@ export class VisualBinRangeHelper {
public static GetNonAggregateVisualBinRange(dataBinRange: BinRange): VisualBinRange {
if (dataBinRange instanceof NominalBinRange) {
- return new NominalVisualBinRange(dataBinRange as NominalBinRange);
+ return new NominalVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof QuantitativeBinRange) {
- return new QuantitativeVisualBinRange(dataBinRange as QuantitativeBinRange);
+ return new QuantitativeVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof AlphabeticBinRange) {
- return new AlphabeticVisualBinRange(dataBinRange as AlphabeticBinRange);
+ return new AlphabeticVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof DateTimeBinRange) {
- return new DateTimeVisualBinRange(dataBinRange as DateTimeBinRange);
+ return new DateTimeVisualBinRange(dataBinRange);
}
- throw new Exception()
+ throw new Exception();
}
public static GetVisualBinRange(distinctAttributeParameters: AttributeParameters | undefined, dataBinRange: BinRange, histoResult: HistogramResult, attr: AttributeTransformationModel, chartType: ChartType): VisualBinRange {
@@ -39,8 +39,7 @@ export class VisualBinRangeHelper {
var aggregateKey = ModelHelpers.CreateAggregateKey(distinctAttributeParameters, attr, histoResult, ModelHelpers.AllBrushIndex(histoResult));
var minValue = Number.MAX_VALUE;
var maxValue = Number.MIN_VALUE;
- for (var b = 0; b < histoResult.brushes!.length; b++) {
- var brush = histoResult.brushes![b];
+ for (const brush of histoResult.brushes!) {
aggregateKey.brushIndex = brush.brushIndex;
for (var key in histoResult.bins) {
if (histoResult.bins.hasOwnProperty(key)) {
@@ -52,16 +51,16 @@ export class VisualBinRangeHelper {
}
}
}
- };
+ }
let visualBinRange = QuantitativeVisualBinRange.Initialize(minValue, maxValue, 10, false);
- if (chartType == ChartType.HorizontalBar || chartType == ChartType.VerticalBar) {
+ if (chartType === ChartType.HorizontalBar || chartType === ChartType.VerticalBar) {
visualBinRange = QuantitativeVisualBinRange.Initialize(Math.min(0, minValue),
- Math.max(0, (visualBinRange as QuantitativeVisualBinRange).DataBinRange.maxValue!),
+ Math.max(0, (visualBinRange).DataBinRange.maxValue!),
SETTINGS_X_BINS, false);
}
- else if (chartType == ChartType.SinglePoint) {
+ else if (chartType === ChartType.SinglePoint) {
visualBinRange = QuantitativeVisualBinRange.Initialize(Math.min(0, minValue), Math.max(0, maxValue),
SETTINGS_X_BINS, false);
}
diff --git a/src/client/northstar/model/idea/MetricTypeMapping.ts b/src/client/northstar/model/idea/MetricTypeMapping.ts
index 11e0c871a..e9759cf16 100644
--- a/src/client/northstar/model/idea/MetricTypeMapping.ts
+++ b/src/client/northstar/model/idea/MetricTypeMapping.ts
@@ -5,20 +5,20 @@ import { Dictionary } from 'typescript-collections';
export class MetricTypeMapping {
public static GetMetricInterpretation(metricType: MetricType): MetricInterpretation {
- if (metricType == MetricType.Accuracy ||
- metricType == MetricType.F1 ||
- metricType == MetricType.F1Macro ||
- metricType == MetricType.F1Micro ||
- metricType == MetricType.JaccardSimilarityScore ||
- metricType == MetricType.ObjectDetectionAveragePrecision ||
- metricType == MetricType.Precision ||
- metricType == MetricType.PrecisionAtTopK ||
- metricType == MetricType.NormalizedMutualInformation ||
- metricType == MetricType.Recall ||
- metricType == MetricType.RocAucMacro ||
- metricType == MetricType.RocAuc ||
- metricType == MetricType.RocAucMicro ||
- metricType == MetricType.RSquared) {
+ if (metricType === MetricType.Accuracy ||
+ metricType === MetricType.F1 ||
+ metricType === MetricType.F1Macro ||
+ metricType === MetricType.F1Micro ||
+ metricType === MetricType.JaccardSimilarityScore ||
+ metricType === MetricType.ObjectDetectionAveragePrecision ||
+ metricType === MetricType.Precision ||
+ metricType === MetricType.PrecisionAtTopK ||
+ metricType === MetricType.NormalizedMutualInformation ||
+ metricType === MetricType.Recall ||
+ metricType === MetricType.RocAucMacro ||
+ metricType === MetricType.RocAuc ||
+ metricType === MetricType.RocAucMicro ||
+ metricType === MetricType.RSquared) {
return MetricInterpretation.HigherIsBetter;
}
return MetricInterpretation.LowerIsBetter;
diff --git a/src/client/northstar/operations/BaseOperation.ts b/src/client/northstar/operations/BaseOperation.ts
index f545b2c58..c6d5f0a15 100644
--- a/src/client/northstar/operations/BaseOperation.ts
+++ b/src/client/northstar/operations/BaseOperation.ts
@@ -1,4 +1,4 @@
-import { FilterModel } from '../core/filter/FilterModel'
+import { FilterModel } from '../core/filter/FilterModel';
import { ErrorResult, Exception, OperationParameters, OperationReference, Result, ResultParameters } from '../model/idea/idea';
import { action, computed, observable } from "mobx";
import { Gateway } from '../manager/Gateway';
@@ -29,11 +29,11 @@ export abstract class BaseOperation {
// let filterModels: FilterModel[] = [];
// return FilterModel.GetFilterModelsRecursive(this, new Set<GraphNode<BaseOperationViewModel, FilterLinkViewModel>>(), filterModels, true)
// if (this.OverridingFilters.length > 0) {
- // return "(" + this.OverridingFilters.filter(fm => fm != null).map(fm => fm.ToPythonString()).join(" || ") + ")";
+ // return "(" + this.OverridingFilters.filter(fm => fm !== null).map(fm => fm.ToPythonString()).join(" || ") + ")";
// }
// let rdg = MainManager.Instance.MainViewModel.FilterReverseDependencyGraph;
// let sliceModel = this.TypedViewModel.IncomingSliceModel;
- // if (sliceModel != null && sliceModel.Source != null && instanceOfIBaseFilterProvider(sliceModel.Source) && rdg.has(sliceModel.Source)) {
+ // if (sliceModel !== null && sliceModel.Source !== null && instanceOfIBaseFilterProvider(sliceModel.Source) && rdg.has(sliceModel.Source)) {
// let filterModels = sliceModel.Source.FilterModels.map(f => f);
// return FilterModel.GetFilterModelsRecursive(rdg.get(sliceModel.Source), new Set<GraphNode<BaseOperationViewModel, FilterLinkViewModel>>(), filterModels, false);
// }
@@ -62,8 +62,9 @@ export abstract class BaseOperation {
}
let operationParameters = this.CreateOperationParameters();
- if (this.Result)
- this.Result.progress = 0; // bcz: used to set Result to undefined, but that causes the display to blink
+ if (this.Result) {
+ this.Result.progress = 0;
+ } // bcz: used to set Result to undefined, but that causes the display to blink
this.Error = "";
let salt = Math.random().toString();
this.RequestSalt = salt;
@@ -97,10 +98,10 @@ export abstract class BaseOperation {
pollPromise.Start(async () => {
let result = await Gateway.Instance.GetResult(resultParameters.toJSON());
if (result instanceof ErrorResult) {
- throw new Error((result as ErrorResult).message);
+ throw new Error((result).message);
}
- if (this.RequestSalt == pollPromise.RequestSalt) {
- if (result && (!this.Result || this.Result.progress != result.progress)) {
+ if (this.RequestSalt === pollPromise.RequestSalt) {
+ if (result && (!this.Result || this.Result.progress !== result.progress)) {
/*if (operationViewModel.Result !== null && operationViewModel.Result !== undefined) {
let t1 = performance.now();
console.log((t1 - start) + " milliseconds.");
diff --git a/src/client/northstar/operations/HistogramOperation.ts b/src/client/northstar/operations/HistogramOperation.ts
index 840520235..760106023 100644
--- a/src/client/northstar/operations/HistogramOperation.ts
+++ b/src/client/northstar/operations/HistogramOperation.ts
@@ -62,7 +62,7 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
@computed
public get FilterString(): string {
let filterModels: FilterModel[] = [];
- return FilterModel.GetFilterModelsRecursive(this, new Set<IBaseFilterProvider>(), filterModels, true)
+ return FilterModel.GetFilterModelsRecursive(this, new Set<IBaseFilterProvider>(), filterModels, true);
}
@computed
@@ -71,7 +71,7 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
let brushes: string[] = [];
this.BrushLinks.map(brushLink => {
let brushHistogram = brushLink.b.GetT(KeyStore.Data, HistogramField);
- if (brushHistogram && brushHistogram != FieldWaiting) {
+ if (brushHistogram && brushHistogram !== FieldWaiting) {
let filterModels: FilterModel[] = [];
brushes.push(FilterModel.GetFilterModelsRecursive(brushHistogram.Data, new Set<IBaseFilterProvider>(), filterModels, false));
}
diff --git a/src/client/northstar/utils/ArrayUtil.ts b/src/client/northstar/utils/ArrayUtil.ts
index f35c98317..12b8d8e77 100644
--- a/src/client/northstar/utils/ArrayUtil.ts
+++ b/src/client/northstar/utils/ArrayUtil.ts
@@ -7,14 +7,14 @@ export class ArrayUtil {
return false;
}
let isComplex = typeof arr1[0] === "object";
- for (let i = 0; i < arr1.length; i++) {
- if (isComplex && "Equals" in arr1[i]) {
- if (arr1[i].Equals(arr2)) {
+ for (const ele of arr1) {
+ if (isComplex && "Equals" in ele) {
+ if (ele.Equals(arr2)) {
return true;
}
}
else {
- if (arr1[i] === arr2) {
+ if (ele === arr2) {
return true;
}
}
@@ -50,7 +50,7 @@ export class ArrayUtil {
if (filtered.length > 0) {
return filtered[0];
}
- throw new Exception()
+ throw new Exception();
}
public static FirstOrDefault<T>(arr: T[], predicate: (x: any) => boolean): T | undefined {
@@ -63,9 +63,9 @@ export class ArrayUtil {
public static Distinct(arr: any[]): any[] {
let ret = [];
- for (let i = 0; i < arr.length; i++) {
- if (!ArrayUtil.Contains(ret, arr[i])) {
- ret.push(arr[i]);
+ for (const ele of arr) {
+ if (!ArrayUtil.Contains(ret, ele)) {
+ ret.push(ele);
}
}
return ret;
diff --git a/src/client/northstar/utils/Extensions.ts b/src/client/northstar/utils/Extensions.ts
index 7c2b7fc9d..df14d4da0 100644
--- a/src/client/northstar/utils/Extensions.ts
+++ b/src/client/northstar/utils/Extensions.ts
@@ -6,7 +6,7 @@ interface String {
String.prototype.ReplaceAll = function (toReplace: string, replacement: string): string {
var target = this;
return target.split(toReplace).join(replacement);
-}
+};
String.prototype.Truncate = function (length: number, replacement: string): String {
var target = this;
@@ -14,7 +14,7 @@ String.prototype.Truncate = function (length: number, replacement: string): Stri
target = target.slice(0, Math.max(0, length - replacement.length)) + replacement;
}
return target;
-}
+};
interface Math {
log10(val: number): number;
@@ -22,7 +22,7 @@ interface Math {
Math.log10 = function (val: number): number {
return Math.log(val) / Math.LN10;
-}
+};
declare interface ObjectConstructor {
assign(...objects: Object[]): Object;
diff --git a/src/client/northstar/utils/GeometryUtil.ts b/src/client/northstar/utils/GeometryUtil.ts
index d5f3ba631..d5220c479 100644
--- a/src/client/northstar/utils/GeometryUtil.ts
+++ b/src/client/northstar/utils/GeometryUtil.ts
@@ -8,15 +8,19 @@ export class GeometryUtil {
let minY: number = Number.MAX_VALUE;
let maxX: number = Number.MIN_VALUE;
let maxY: number = Number.MIN_VALUE;
- for (var i = 0; i < points.length; i++) {
- if (points[i].x < minX)
- minX = points[i].x;
- if (points[i].y < minY)
- minY = points[i].y;
- if (points[i].x > maxX)
- maxX = points[i].x;
- if (points[i].y > maxY)
- maxY = points[i].y;
+ for (const point of points) {
+ if (point.x < minX) {
+ minX = point.x;
+ }
+ if (point.y < minY) {
+ minY = point.y;
+ }
+ if (point.x > maxX) {
+ maxX = point.x;
+ }
+ if (point.y > maxY) {
+ maxY = point.y;
+ }
}
return new PIXIRectangle(minX * scale - padding, minY * scale - padding, (maxX - minX) * scale + padding * 2, (maxY - minY) * scale + padding * 2);
}
@@ -35,7 +39,7 @@ export class GeometryUtil {
nx = (cos * (x - cx)) + (sin * (y - cy)) + cx,
ny = (cos * (y - cy)) - (sin * (x - cx)) + cy;
return new PIXIPoint(nx, ny);
- }
+ };
return points.map(p => rotate(center.x, center.y, p.x, p.y, angle));
}
@@ -54,9 +58,9 @@ export class GeometryUtil {
return [];
}
- for (let v = 0; v < points.length; v++) {
- x = points[v].x;
- y = points[v].y;
+ for (const point of points) {
+ x = point.x;
+ y = point.y;
sum_x += x;
sum_y += y;
sum_xx += x * x;
@@ -68,8 +72,8 @@ export class GeometryUtil {
let b = (sum_y / count) - (m * sum_x) / count;
let result: PIXIPoint[] = new Array<PIXIPoint>();
- for (let v = 0; v < points.length; v++) {
- x = points[v].x;
+ for (const point of points) {
+ x = point.x;
y = x * m + b;
result.push(new PIXIPoint(x, y));
}
@@ -85,7 +89,7 @@ export class GeometryUtil {
// var xi = vs[i].x, yi = vs[i].y;
// var xj = vs[j].x, yj = vs[j].y;
- // var intersect = ((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
+ // var intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
// if (intersect)
// inside = !inside;
// }
diff --git a/src/client/northstar/utils/MathUtil.ts b/src/client/northstar/utils/MathUtil.ts
index bb7e73871..4b44f40c3 100644
--- a/src/client/northstar/utils/MathUtil.ts
+++ b/src/client/northstar/utils/MathUtil.ts
@@ -16,11 +16,11 @@ export class PIXIRectangle {
public x: number;
public y: number;
public width: number;
- public height: number
- public get left() { return this.x }
+ public height: number;
+ public get left() { return this.x; }
public get right() { return this.x + this.width; }
- public get top() { return this.y }
- public get bottom() { return this.top + this.height }
+ public get top() { return this.y; }
+ public get bottom() { return this.top + this.height; }
public static get EMPTY() { return new PIXIRectangle(0, 0, -1, -1); }
constructor(x: number, y: number, width: number, height: number) {
this.x = x;
@@ -93,7 +93,7 @@ export class MathUtil {
public static DistToLineSegment(v: PIXIPoint, w: PIXIPoint, p: PIXIPoint) {
// Return minimum distance between line segment vw and point p
var l2 = MathUtil.DistSquared(v, w); // i.e. |w-v|^2 - avoid a sqrt
- if (l2 == 0.0) return MathUtil.Dist(p, v); // v == w case
+ if (l2 === 0.0) return MathUtil.Dist(p, v); // v === w case
// Consider the line extending the segment, parameterized as v + t (w - v).
// We find projection of point p onto the line.
// It falls where t = [(p-v) . (w-v)] / |w-v|^2
@@ -117,7 +117,7 @@ export class MathUtil {
var b2 = ps2.x - pe2.x;
var delta = a1 * b2 - a2 * b1;
- if (delta == 0) {
+ if (delta === 0) {
return undefined;
}
var c2 = a2 * ps2.x + b2 * ps2.y;
@@ -127,14 +127,18 @@ export class MathUtil {
}
public static PointInPIXIRectangle(p: PIXIPoint, rect: PIXIRectangle): boolean {
- if (p.x < rect.left - this.EPSILON)
+ if (p.x < rect.left - this.EPSILON) {
return false;
- if (p.x > rect.right + this.EPSILON)
+ }
+ if (p.x > rect.right + this.EPSILON) {
return false;
- if (p.y < rect.top - this.EPSILON)
+ }
+ if (p.y < rect.top - this.EPSILON) {
return false;
- if (p.y > rect.bottom + this.EPSILON)
+ }
+ if (p.y > rect.bottom + this.EPSILON) {
return false;
+ }
return true;
}
@@ -145,23 +149,27 @@ export class MathUtil {
var r3 = new PIXIPoint(rect.right, rect.bottom);
var r4 = new PIXIPoint(rect.left, rect.bottom);
var ret = new Array<PIXIPoint>();
- var dist = this.Dist(lineFrom, lineTo)
+ var dist = this.Dist(lineFrom, lineTo);
var inter = this.LineSegmentIntersection(lineFrom, lineTo, r1, r2);
- if (inter != null && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ if (inter && this.PointInPIXIRectangle(inter, rect) &&
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
inter = this.LineSegmentIntersection(lineFrom, lineTo, r2, r3);
- if (inter != null && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ if (inter && this.PointInPIXIRectangle(inter, rect) &&
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
inter = this.LineSegmentIntersection(lineFrom, lineTo, r3, r4);
- if (inter != null && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ if (inter && this.PointInPIXIRectangle(inter, rect) &&
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
inter = this.LineSegmentIntersection(lineFrom, lineTo, r4, r1);
- if (inter != null && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ if (inter && this.PointInPIXIRectangle(inter, rect) &&
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
return ret;
}
@@ -178,7 +186,7 @@ export class MathUtil {
}
public static Dot(p1: PIXIPoint, p2: PIXIPoint): number {
- return p1.x * p2.x + p1.y * p2.y
+ return p1.x * p2.x + p1.y * p2.y;
}
public static Normalize(p1: PIXIPoint) {
@@ -193,7 +201,7 @@ export class MathUtil {
public static DistSquared(p1: PIXIPoint, p2: PIXIPoint): number {
const a = p1.x - p2.x;
const b = p1.y - p2.y;
- return (a * a + b * b)
+ return (a * a + b * b);
}
public static RectIntersectsRect(r1: PIXIRectangle, r2: PIXIRectangle): boolean {
diff --git a/src/client/northstar/utils/SizeConverter.ts b/src/client/northstar/utils/SizeConverter.ts
index bb91ed4a7..a52890ed9 100644
--- a/src/client/northstar/utils/SizeConverter.ts
+++ b/src/client/northstar/utils/SizeConverter.ts
@@ -32,8 +32,8 @@ export class SizeConverter {
this.Initialized++;
var xLabels = visualBinRanges[0].GetLabels();
var yLabels = visualBinRanges[1].GetLabels();
- var xLabelStrings = xLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length });
- var yLabelStrings = yLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length });
+ var xLabelStrings = xLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length; });
+ var yLabelStrings = yLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length; });
var metricsX = { width: 75 }; // RenderUtils.MeasureText(FontStyles.Default.fontFamily.toString(), 12, // FontStyles.AxisLabel.fontSize as number,
//xLabelStrings[0]!.slice(0, 20)) // StyleConstants.MAX_CHAR_FOR_HISTOGRAM_LABELS));
@@ -54,7 +54,7 @@ export class SizeConverter {
}
public DataToScreenNormalizedRange(dataValue: number, normalization: number, axis: number, binBrushMaxAxis: number) {
- var value = normalization != 1 - axis || binBrushMaxAxis == 0 ? dataValue : (dataValue - 0) / (binBrushMaxAxis - 0) * this.DataRanges[axis];
+ var value = normalization !== 1 - axis || binBrushMaxAxis === 0 ? dataValue : (dataValue - 0) / (binBrushMaxAxis - 0) * this.DataRanges[axis];
var from = this.DataToScreenCoord(Math.min(0, value), axis);
var to = this.DataToScreenCoord(Math.max(0, value), axis);
return [from, value, to];
@@ -62,19 +62,20 @@ export class SizeConverter {
public DataToScreenPointRange(axis: number, bin: Bin, aggregateKey: AggregateKey) {
var value = ModelHelpers.GetAggregateResult(bin, aggregateKey) as DoubleValueAggregateResult;
- if (value && value.hasResult)
+ if (value && value.hasResult) {
return [this.DataToScreenCoord(value.result!, axis) - 5,
this.DataToScreenCoord(value.result!, axis) + 5];
+ }
return [undefined, undefined];
}
public DataToScreenXAxisRange(visualBinRanges: VisualBinRange[], index: number, bin: Bin) {
var value = visualBinRanges[0].GetValueFromIndex(bin.binIndex!.indices![index]);
- return [this.DataToScreenX(value), this.DataToScreenX(visualBinRanges[index].AddStep(value))]
+ return [this.DataToScreenX(value), this.DataToScreenX(visualBinRanges[index].AddStep(value))];
}
public DataToScreenYAxisRange(visualBinRanges: VisualBinRange[], index: number, bin: Bin) {
var value = visualBinRanges[1].GetValueFromIndex(bin.binIndex!.indices![index]);
- return [this.DataToScreenY(value), this.DataToScreenY(visualBinRanges[index].AddStep(value))]
+ return [this.DataToScreenY(value), this.DataToScreenY(visualBinRanges[index].AddStep(value))];
}
public DataToScreenX(x: number): number {
@@ -85,8 +86,9 @@ export class SizeConverter {
return flip ? (this.RenderDimension) - retY : retY;
}
public DataToScreenCoord(v: number, axis: number) {
- if (axis == 0)
+ if (axis === 0) {
return this.DataToScreenX(v);
+ }
return this.DataToScreenY(v);
}
public DataToScreenRange(minVal: number, maxVal: number, axis: number) {
@@ -94,6 +96,6 @@ export class SizeConverter {
let xTo = this.DataToScreenX(axis === 0 ? maxVal : this.DataMaxs[0]);
let yFrom = this.DataToScreenY(axis === 1 ? minVal : this.DataMins[1]);
let yTo = this.DataToScreenY(axis === 1 ? maxVal : this.DataMaxs[1]);
- return { xFrom, yFrom, xTo, yTo }
+ return { xFrom, yFrom, xTo, yTo };
}
} \ No newline at end of file
diff --git a/src/client/northstar/utils/StyleContants.ts b/src/client/northstar/utils/StyleContants.ts
index ac8617e3b..e9b6e0297 100644
--- a/src/client/northstar/utils/StyleContants.ts
+++ b/src/client/northstar/utils/StyleContants.ts
@@ -11,7 +11,7 @@ export class StyleConstants {
static OPERATOR_MENU_LARGE: number = 35;
static OPERATOR_MENU_SMALL: number = 25;
- static BRUSH_PALETTE: number[] = [0x42b43c, 0xfa217f, 0x6a9c75, 0xfb5de7, 0x25b8ea, 0x9b5bc4, 0xda9f63, 0xe23209, 0xfb899b, 0x94a6fd]
+ static BRUSH_PALETTE: number[] = [0x42b43c, 0xfa217f, 0x6a9c75, 0xfb5de7, 0x25b8ea, 0x9b5bc4, 0xda9f63, 0xe23209, 0xfb899b, 0x94a6fd];
static GAP: number = 3;
static BACKGROUND_COLOR: number = 0xF3F3F3;
diff --git a/src/client/northstar/utils/Utils.ts b/src/client/northstar/utils/Utils.ts
index b35dce820..d071dec62 100644
--- a/src/client/northstar/utils/Utils.ts
+++ b/src/client/northstar/utils/Utils.ts
@@ -1,7 +1,7 @@
-import { IBaseBrushable } from '../core/brusher/IBaseBrushable'
-import { IBaseFilterConsumer } from '../core/filter/IBaseFilterConsumer'
-import { IBaseFilterProvider } from '../core/filter/IBaseFilterProvider'
-import { AggregateFunction } from '../model/idea/idea'
+import { IBaseBrushable } from '../core/brusher/IBaseBrushable';
+import { IBaseFilterConsumer } from '../core/filter/IBaseFilterConsumer';
+import { IBaseFilterProvider } from '../core/filter/IBaseFilterProvider';
+import { AggregateFunction } from '../model/idea/idea';
export class Utils {
@@ -27,17 +27,17 @@ export class Utils {
public static isBaseBrushable<T>(obj: Object): obj is IBaseBrushable<T> {
let typed = <IBaseBrushable<T>>obj;
- return typed != null && typed.BrusherModels !== undefined;
+ return typed !== null && typed.BrusherModels !== undefined;
}
public static isBaseFilterProvider(obj: Object): obj is IBaseFilterProvider {
let typed = <IBaseFilterProvider>obj;
- return typed != null && typed.FilterModels !== undefined;
+ return typed !== null && typed.FilterModels !== undefined;
}
public static isBaseFilterConsumer(obj: Object): obj is IBaseFilterConsumer {
let typed = <IBaseFilterConsumer>obj;
- return typed != null && typed.FilterOperand !== undefined;
+ return typed !== null && typed.FilterOperand !== undefined;
}
public static EncodeQueryData(data: any): string {
@@ -63,9 +63,9 @@ export class Utils {
public static GetQueryVariable(variable: string) {
let query = window.location.search.substring(1);
let vars = query.split("&");
- for (let i = 0; i < vars.length; i++) {
- let pair = vars[i].split("=");
- if (decodeURIComponent(pair[0]) == variable) {
+ for (const variable of vars) {
+ let pair = variable.split("=");
+ if (decodeURIComponent(pair[0]) === variable) {
return decodeURIComponent(pair[1]);
}
}