diff options
Diffstat (limited to 'src/client/northstar/dash-fields/HistogramField.ts')
-rw-r--r-- | src/client/northstar/dash-fields/HistogramField.ts | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/client/northstar/dash-fields/HistogramField.ts b/src/client/northstar/dash-fields/HistogramField.ts deleted file mode 100644 index 076516977..000000000 --- a/src/client/northstar/dash-fields/HistogramField.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { observable } from "mobx"; -import { custom, serializable } from "serializr"; -import { ColumnAttributeModel } from "../../../client/northstar/core/attribute/AttributeModel"; -import { AttributeTransformationModel } from "../../../client/northstar/core/attribute/AttributeTransformationModel"; -import { HistogramOperation } from "../../../client/northstar/operations/HistogramOperation"; -import { ObjectField } from "../../../new_fields/ObjectField"; -import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils"; -import { OmitKeys } from "../../../Utils"; -import { Deserializable } from "../../util/SerializationHelper"; -import { Copy, ToScriptString, ToString } from "../../../new_fields/FieldSymbols"; - -function serialize(field: HistogramField) { - const obj = OmitKeys(field, ['Links', 'BrushLinks', 'Result', 'BrushColors', 'FilterModels', 'FilterOperand']).omit; - return obj; -} - -function deserialize(jp: any) { - let X: AttributeTransformationModel | undefined; - let Y: AttributeTransformationModel | undefined; - let V: AttributeTransformationModel | undefined; - - const schema = CurrentUserUtils.GetNorthstarSchema(jp.SchemaName); - if (schema) { - CurrentUserUtils.GetAllNorthstarColumnAttributes(schema).map(attr => { - 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) { - Y = new AttributeTransformationModel(new ColumnAttributeModel(attr), jp.Y.AggregateFunction); - } - if (attr.displayName === jp.V.AttributeModel.Attribute.DisplayName) { - V = new AttributeTransformationModel(new ColumnAttributeModel(attr), jp.V.AggregateFunction); - } - }); - if (X && Y && V) { - return new HistogramOperation(jp.SchemaName, X, Y, V, jp.Normalization); - } - } - return HistogramOperation.Empty; -} - -@Deserializable("histogramField") -export class HistogramField extends ObjectField { - @serializable(custom(serialize, deserialize)) @observable public readonly HistoOp: HistogramOperation; - constructor(data?: HistogramOperation) { - super(); - this.HistoOp = data ? data : HistogramOperation.Empty; - } - - toString(): string { - return JSON.stringify(OmitKeys(this.HistoOp, ['Links', 'BrushLinks', 'Result', 'BrushColors', 'FilterModels', 'FilterOperand']).omit); - } - - [Copy]() { - // const y = this.HistoOp; - // const z = this.HistoOp.Copy; - return new HistogramField(HistogramOperation.Duplicate(this.HistoOp)); - } - - [ToScriptString]() { - return this.toString(); - } - [ToString]() { - return this.toString(); - } -}
\ No newline at end of file |