aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json1
-rw-r--r--src/client/documents/Documents.ts9
-rw-r--r--src/client/northstar/core/filter/FilterModel.ts21
-rw-r--r--src/client/northstar/core/filter/IBaseFilterConsumer.ts2
-rw-r--r--src/client/northstar/operations/HistogramOperation.ts42
-rw-r--r--src/client/views/Main.tsx22
-rw-r--r--src/client/views/nodes/HistogramBox.tsx60
-rw-r--r--src/fields/HistogramField.ts59
-rw-r--r--src/fields/KeyStore.ts2
-rw-r--r--src/server/Message.ts2
-rw-r--r--src/server/ServerUtil.ts3
-rw-r--r--src/server/authentication/models/current_user_utils.ts3
12 files changed, 166 insertions, 60 deletions
diff --git a/package.json b/package.json
index 4f75d139d..27b3eead1 100644
--- a/package.json
+++ b/package.json
@@ -92,6 +92,7 @@
"bluebird": "^3.5.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.3.1",
+ "class-transformer": "^0.2.0",
"connect-flash": "^0.1.1",
"connect-mongo": "^2.0.3",
"cookie-parser": "^1.4.4",
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index bc0a18d50..1d23b8c2c 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -24,6 +24,8 @@ import { VideoBox } from "../views/nodes/VideoBox";
import { WebBox } from "../views/nodes/WebBox";
import { HistogramBox } from "../views/nodes/HistogramBox";
import { FieldView } from "../views/nodes/FieldView";
+import { HistogramField } from "../../fields/HistogramField";
+import { HistogramOperation } from "../northstar/operations/HistogramOperation";
export interface DocumentOptions {
x?: number;
@@ -42,6 +44,7 @@ export interface DocumentOptions {
layoutKeys?: Key[];
viewType?: number;
backgroundColor?: string;
+ northstarSchema?: string;
}
export namespace Documents {
@@ -85,6 +88,7 @@ export namespace Documents {
if (options.ink !== undefined) { doc.Set(KeyStore.Ink, new InkField(options.ink)); }
if (options.layout !== undefined) { doc.SetText(KeyStore.Layout, options.layout); }
if (options.layoutKeys !== undefined) { doc.Set(KeyStore.LayoutKeys, new ListField(options.layoutKeys)); }
+ if (options.northstarSchema !== undefined) { doc.SetText(KeyStore.NorthstarSchema, options.northstarSchema); }
return doc;
}
@@ -120,7 +124,6 @@ export namespace Documents {
}
function GetHistogramPrototype(): Document {
if (!histoProto) {
-
histoProto = setupPrototypeOptions(histoProtoId, "HISTO PROTO", CollectionView.LayoutString("AnnotationsKey"),
{ x: 0, y: 0, width: 300, height: 300, layoutKeys: [KeyStore.Data, KeyStore.Annotations, KeyStore.Caption] });
histoProto.SetText(KeyStore.BackgroundLayout, HistogramBox.LayoutString());
@@ -189,8 +192,8 @@ export namespace Documents {
return assignToDelegate(SetInstanceOptions(GetAudioPrototype(), options, [new URL(url), AudioField]), options);
}
- export function HistogramDocument(options: DocumentOptions = {}) {
- return assignToDelegate(SetInstanceOptions(GetHistogramPrototype(), options, ["", TextField]).MakeDelegate(), options);
+ export function HistogramDocument(histoOp: HistogramOperation, options: DocumentOptions = {}, id?: string) {
+ return assignToDelegate(SetInstanceOptions(GetHistogramPrototype(), options, [histoOp, HistogramField], id).MakeDelegate(), options);
}
export function TextDocument(options: DocumentOptions = {}) {
return assignToDelegate(SetInstanceOptions(GetTextPrototype(), options, ["", TextField]).MakeDelegate(), options);
diff --git a/src/client/northstar/core/filter/FilterModel.ts b/src/client/northstar/core/filter/FilterModel.ts
index 3c4cfc4a7..01bf2a809 100644
--- a/src/client/northstar/core/filter/FilterModel.ts
+++ b/src/client/northstar/core/filter/FilterModel.ts
@@ -1,5 +1,8 @@
import { ValueComparison } from "./ValueComparision";
import { Utils } from "../../utils/Utils";
+import { IBaseFilterProvider } from "./IBaseFilterProvider";
+import { BaseOperation } from "../../operations/BaseOperation";
+import { FilterOperand } from "./FilterOperand";
export class FilterModel {
public ValueComparisons: ValueComparison[];
@@ -36,20 +39,20 @@ export class FilterModel {
return ret;
}
- // public static GetFilterModelsRecursive(filterGraphNode: GraphNode<BaseOperationViewModel, FilterLinkViewModel>,
- // visitedFilterProviders: Set<GraphNode<BaseOperationViewModel, FilterLinkViewModel>>, filterModels: FilterModel[], isFirst: boolean): string {
+ // public static GetFilterModelsRecursive(baseOperation: BaseOperation,
+ // visitedFilterProviders: Set<IBaseFilterProvider>, filterModels: FilterModel[], isFirst: boolean): string {
// let ret = "";
- // if (Utils.isBaseFilterProvider(filterGraphNode.Data)) {
- // visitedFilterProviders.add(filterGraphNode);
- // let filtered = filterGraphNode.Data.FilterModels.filter(fm => fm && fm.ValueComparisons.length > 0);
+ // if (Utils.isBaseFilterProvider(baseOperation)) {
+ // visitedFilterProviders.add(baseOperation);
+ // let filtered = baseOperation.FilterModels.filter(fm => fm && fm.ValueComparisons.length > 0);
// if (!isFirst && filtered.length > 0) {
// filterModels.push(...filtered);
- // ret = "(" + filterGraphNode.Data.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(filterGraphNode.Data) && filterGraphNode.Links != null) {
+ // if (Utils.isBaseFilterConsumer(baseOperation) && baseOperation.Links) {
// let children = new Array<string>();
- // let linkedGraphNodes = filterGraphNode.Links.get(LinkType.Filter);
+ // let linkedGraphNodes = baseOperation.Links.get(LinkType.Filter);
// if (linkedGraphNodes != null) {
// for (let i = 0; i < linkedGraphNodes.length; i++) {
// let linkVm = linkedGraphNodes[i].Data;
@@ -66,7 +69,7 @@ export class FilterModel {
// }
// }
- // let childrenJoined = children.join(filterGraphNode.Data.FilterOperand === FilterOperand.AND ? " && " : " || ");
+ // let childrenJoined = children.join(baseOperation.FilterOperand === FilterOperand.AND ? " && " : " || ");
// if (children.length > 0) {
// if (ret !== "") {
// ret = "(" + ret + " && (" + childrenJoined + "))";
diff --git a/src/client/northstar/core/filter/IBaseFilterConsumer.ts b/src/client/northstar/core/filter/IBaseFilterConsumer.ts
index e687acb8a..3eb32b6db 100644
--- a/src/client/northstar/core/filter/IBaseFilterConsumer.ts
+++ b/src/client/northstar/core/filter/IBaseFilterConsumer.ts
@@ -1,8 +1,10 @@
import { FilterOperand } from '../filter/FilterOperand'
import { IEquatable } from '../../utils/IEquatable'
+import { IBaseFilterProvider } from './IBaseFilterProvider';
export interface IBaseFilterConsumer extends IEquatable {
FilterOperand: FilterOperand;
+ Links: IBaseFilterProvider[];
}
export function instanceOfIBaseFilterConsumer(object: any): object is IBaseFilterConsumer {
diff --git a/src/client/northstar/operations/HistogramOperation.ts b/src/client/northstar/operations/HistogramOperation.ts
index cf2571285..0c38679e5 100644
--- a/src/client/northstar/operations/HistogramOperation.ts
+++ b/src/client/northstar/operations/HistogramOperation.ts
@@ -9,9 +9,15 @@ import { BaseOperation } from "./BaseOperation";
import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils";
import { FilterModel } from "../core/filter/FilterModel";
import { BrushLinkModel } from "../core/brusher/BrushLinkModel";
+import { IBaseFilterConsumer } from "../core/filter/IBaseFilterConsumer";
+import { FilterOperand } from "../core/filter/FilterOperand";
+import { IBaseFilterProvider } from "../core/filter/IBaseFilterProvider";
+import { AttributeModel, ColumnAttributeModel } from "../core/attribute/AttributeModel";
-export class HistogramOperation extends BaseOperation {
+export class HistogramOperation extends BaseOperation implements IBaseFilterConsumer, IBaseFilterProvider {
+ @observable public FilterOperand: FilterOperand = FilterOperand.AND;
+ @observable public Links: IBaseFilterProvider[] = [];
@observable public BrushColors: number[] = [];
@observable public Normalization: number = -1;
@observable public FilterModels: FilterModel[] = [];
@@ -21,12 +27,18 @@ export class HistogramOperation extends BaseOperation {
@observable public BrusherModels: BrushLinkModel<HistogramOperation>[] = [];
@observable public BrushableModels: BrushLinkModel<HistogramOperation>[] = [];
- constructor(x: AttributeTransformationModel, y: AttributeTransformationModel, v: AttributeTransformationModel) {
+ public static Empty = new HistogramOperation(new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())), new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())), new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())));
+
+ Equals(other: Object): boolean {
+ throw new Error("Method not implemented.");
+ }
+
+ constructor(x: AttributeTransformationModel, y: AttributeTransformationModel, v: AttributeTransformationModel, normalized?: number) {
super();
this.X = x;
this.Y = y;
this.V = v;
- reaction(() => this.createOperationParamsCache, () => this.Update());
+ this.Normalization = normalized ? normalized : -1;
}
@computed.struct
@@ -47,20 +59,11 @@ export class HistogramOperation extends BaseOperation {
}
- @computed.struct
- public get SelectionString() {
- return "";
- // let filterModels = new Array<FilterModel>();
- // let rdg = MainManager.Instance.MainViewModel.FilterReverseDependencyGraph;
- // let graphNode: GraphNode<BaseOperationViewModel, FilterLinkViewModel>;
- // if (rdg.has(this.TypedViewModel)) {
- // graphNode = MainManager.Instance.MainViewModel.FilterReverseDependencyGraph.get(this.TypedViewModel);
- // }
- // else {
- // graphNode = new GraphNode<BaseOperationViewModel, FilterLinkViewModel>(this.TypedViewModel);
- // }
- // return FilterModel.GetFilterModelsRecursive(graphNode, new Set<GraphNode<BaseOperationViewModel, FilterLinkViewModel>>(), filterModels, false);
- }
+ // @computed.struct
+ // public get SelectionString() {
+ // let filterModels = new Array<FilterModel>();
+ // return FilterModel.GetFilterModelsRecursive(this, new Set<GraphNode<BaseOperationViewModel, FilterLinkViewModel>>(), filterModels, false);
+ // }
GetAggregateParameters(histoX: AttributeTransformationModel, histoY: AttributeTransformationModel, histoValue: AttributeTransformationModel) {
let allAttributes = new Array<AttributeTransformationModel>(histoX, histoY, histoValue);
@@ -79,11 +82,6 @@ export class HistogramOperation extends BaseOperation {
return [perBinAggregateParameters, globalAggregateParameters];
}
- @computed
- get createOperationParamsCache() {
- return this.CreateOperationParameters();
- }
-
public QRange: QuantitativeBinRange | undefined;
public CreateOperationParameters(): HistogramOperationParameters | undefined {
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 6534cb4f7..3e0e02f42 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -44,10 +44,13 @@ import { CurrentUserUtils } from '../../server/authentication/models/current_use
import { Field, Opt, FieldWaiting } from '../../fields/Field';
import { ListField } from '../../fields/ListField';
import { Gateway, Settings } from '../northstar/manager/Gateway';
-import { Catalog, Schema, Attribute, AttributeGroup } from '../northstar/model/idea/idea';
+import { Catalog, Schema, Attribute, AttributeGroup, AggregateFunction } from '../northstar/model/idea/idea';
import { ArrayUtil } from '../northstar/utils/ArrayUtil';
import '../northstar/model/ModelExtensions'
import '../northstar/utils/Extensions'
+import { HistogramOperation } from '../northstar/operations/HistogramOperation';
+import { AttributeTransformationModel } from '../northstar/core/attribute/AttributeTransformationModel';
+import { ColumnAttributeModel } from '../northstar/core/attribute/AttributeModel';
@observer
export class Main extends React.Component {
@@ -339,7 +342,22 @@ export class Main extends React.Component {
@action SetNorthstarCatalog(ctlog: Catalog) {
if (ctlog && ctlog.schemas) {
CurrentUserUtils.ActiveSchema = ArrayUtil.FirstOrDefault<Schema>(ctlog.schemas!, (s: Schema) => s.displayName === "mimic");
- this._northstarColumns = CurrentUserUtils.GetAllNorthstarColumnAttributes().map(a => Documents.HistogramDocument({ width: 200, height: 200, title: a.displayName! }));
+ CurrentUserUtils.GetAllNorthstarColumnAttributes().map(attr => {
+ Server.GetField(attr.displayName!, action((field: Opt<Field>) => {
+ if (field instanceof Document) {
+ this._northstarColumns.push(field);
+ } else {
+ var atmod = new ColumnAttributeModel(attr);
+ let histoOp = new HistogramOperation(
+ new AttributeTransformationModel(atmod, AggregateFunction.None),
+ new AttributeTransformationModel(atmod, AggregateFunction.Count),
+ new AttributeTransformationModel(atmod, AggregateFunction.Count));
+ this._northstarColumns.push(Documents.HistogramDocument(histoOp, { width: 200, height: 200, title: attr.displayName!, northstarSchema: CurrentUserUtils.ActiveSchema!.displayName! }, attr.displayName!));
+ }
+ }));
+ })
+ console.log("Activating schema " + CurrentUserUtils.ActiveSchema!.displayName!)
+ CurrentUserUtils.ActiveSchemaName = CurrentUserUtils.ActiveSchema!.displayName!;
}
}
async initializeNorthstar(): Promise<void> {
diff --git a/src/client/views/nodes/HistogramBox.tsx b/src/client/views/nodes/HistogramBox.tsx
index 675bf30b2..73d3f3bc3 100644
--- a/src/client/views/nodes/HistogramBox.tsx
+++ b/src/client/views/nodes/HistogramBox.tsx
@@ -1,17 +1,17 @@
import React = require("react")
-import { computed, observable, reaction, runInAction } from "mobx";
+import { computed, observable, reaction, runInAction, action, observe } from "mobx";
import { observer } from "mobx-react";
import Measure from "react-measure";
import { Dictionary } from "typescript-collections";
import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils";
import { Utils as DashUtils } from '../../../Utils';
-import { ColumnAttributeModel } from "../../northstar/core/attribute/AttributeModel";
+import { ColumnAttributeModel, AttributeModel } from "../../northstar/core/attribute/AttributeModel";
import { AttributeTransformationModel } from "../../northstar/core/attribute/AttributeTransformationModel";
import { FilterModel } from '../../northstar/core/filter/FilterModel';
import { NominalVisualBinRange } from "../../northstar/model/binRanges/NominalVisualBinRange";
import { ChartType, VisualBinRange } from '../../northstar/model/binRanges/VisualBinRange';
import { VisualBinRangeHelper } from "../../northstar/model/binRanges/VisualBinRangeHelper";
-import { AggregateBinRange, AggregateFunction, Bin, Brush, DoubleValueAggregateResult, HistogramResult, MarginAggregateParameters, MarginAggregateResult } from "../../northstar/model/idea/idea";
+import { AggregateBinRange, AggregateFunction, Bin, Brush, DoubleValueAggregateResult, HistogramResult, MarginAggregateParameters, MarginAggregateResult, Attribute, BinRange } from "../../northstar/model/idea/idea";
import { ModelHelpers } from "../../northstar/model/ModelHelpers";
import { HistogramOperation } from "../../northstar/operations/HistogramOperation";
import { ArrayUtil } from "../../northstar/utils/ArrayUtil";
@@ -22,6 +22,10 @@ import { StyleConstants } from "../../northstar/utils/StyleContants";
import { FieldView, FieldViewProps } from './FieldView';
import "./HistogramBox.scss";
import { KeyStore } from "../../../fields/KeyStore";
+import { ListField } from "../../../fields/ListField";
+import { Document } from "../../../fields/Document"
+import { HistogramField } from "../../../fields/HistogramField";
+import { FieldWaiting, Opt } from "../../../fields/Field";
@observer
export class HistogramBox extends React.Component<FieldViewProps> {
@@ -38,37 +42,26 @@ export class HistogramBox extends React.Component<FieldViewProps> {
@observable public ChartType: ChartType = ChartType.VerticalBar;
public HitTargets: Dictionary<PIXIRectangle, FilterModel> = new Dictionary<PIXIRectangle, FilterModel>();
- constructor(props: FieldViewProps) {
- super(props);
- }
-
@computed get xaxislines() { return this.renderGridLinesAndLabels(0); }
@computed get yaxislines() { return this.renderGridLinesAndLabels(1); }
componentDidMount() {
- reaction(() => CurrentUserUtils.GetAllNorthstarColumnAttributes().filter(a => a.displayName == this.props.doc.Title),
- (columnAttrs) => columnAttrs.map(a => {
- var atmod = new ColumnAttributeModel(a);
- this.HistoOp = new HistogramOperation(new AttributeTransformationModel(atmod, AggregateFunction.None),
- new AttributeTransformationModel(atmod, AggregateFunction.Count),
- new AttributeTransformationModel(atmod, AggregateFunction.Count));
- this.HistoOp.Update();
- })
- , { fireImmediately: true });
+ reaction(() => [CurrentUserUtils.ActiveSchemaName, this.props.doc.GetText(KeyStore.NorthstarSchema, "?")],
+ () => CurrentUserUtils.ActiveSchemaName == this.props.doc.GetText(KeyStore.NorthstarSchema, "?") && this.activateHistogramOperation(),
+ { fireImmediately: true });
reaction(() => [this.VisualBinRanges && this.VisualBinRanges.slice(), this._panelHeight, this._panelWidth],
() => this.SizeConverter = new SizeConverter({ x: this._panelWidth, y: this._panelHeight }, this.VisualBinRanges, Math.PI / 4));
- reaction(() => [this.HistoOp && this.HistoOp.Result],
- () => {
- if (!this.HistoOp || !(this.HistoOp.Result instanceof HistogramResult) || !this.HistoOp.Result.binRanges)
+ reaction(() => this.HistoOp && this.HistoOp.Result instanceof HistogramResult ? this.HistoOp.Result.binRanges : undefined,
+ (binRanges: BinRange[] | undefined) => {
+ if (!binRanges || !this.HistoOp || !(this.HistoOp!.Result instanceof HistogramResult))
return;
- let binRanges = this.HistoOp.Result.binRanges;
this.ChartType = binRanges[0] instanceof AggregateBinRange ? (binRanges[1] instanceof AggregateBinRange ? ChartType.SinglePoint : ChartType.HorizontalBar) :
binRanges[1] instanceof AggregateBinRange ? ChartType.VerticalBar : ChartType.HeatMap;
this.VisualBinRanges.length = 0;
- this.VisualBinRanges.push(VisualBinRangeHelper.GetVisualBinRange(this.HistoOp.Result.binRanges[0], this.HistoOp.Result, this.HistoOp.X, this.ChartType));
- this.VisualBinRanges.push(VisualBinRangeHelper.GetVisualBinRange(this.HistoOp.Result.binRanges[1], this.HistoOp.Result, this.HistoOp.Y, this.ChartType));
+ this.VisualBinRanges.push(VisualBinRangeHelper.GetVisualBinRange(binRanges[0], this.HistoOp.Result, this.HistoOp.X, this.ChartType));
+ this.VisualBinRanges.push(VisualBinRangeHelper.GetVisualBinRange(binRanges[1], this.HistoOp.Result, this.HistoOp.Y, this.ChartType));
if (!this.HistoOp.Result.isEmpty) {
this.MaxValue = Number.MIN_VALUE;
@@ -89,6 +82,29 @@ export class HistogramBox extends React.Component<FieldViewProps> {
);
}
+ @computed
+ get createOperationParamsCache() {
+ return this.HistoOp!.CreateOperationParameters();
+ }
+
+ activateHistogramOperation() {
+ this.props.doc.GetTAsync(this.props.fieldKey, HistogramField).then((histoOp: Opt<HistogramField>) => {
+ if (histoOp) {
+ runInAction(() => this.HistoOp = histoOp.Data);
+ this.HistoOp!.Update();
+ reaction(() => this.createOperationParamsCache, () => this.HistoOp!.Update());
+ reaction(() => this.props.doc.GetList(KeyStore.LinkedFromDocs, []),
+ () => {
+ let linkFrom: Document[] = this.props.doc.GetData(KeyStore.LinkedFromDocs, ListField, []);
+ this.HistoOp!.Links.length = 0;
+ linkFrom.map(l => this.HistoOp!.Links.push(l.GetData(KeyStore.Data, HistogramField, HistogramOperation.Empty)));
+ },
+ { fireImmediately: true }
+ );
+ }
+ })
+ }
+
drawLine(xFrom: number, yFrom: number, width: number, height: number) {
return <div key={DashUtils.GenerateGuid()} style={{ position: "absolute", width: `${width}px`, height: `${height}px`, background: "lightgray", transform: `translate(${xFrom}px, ${yFrom}px)` }} />;
}
diff --git a/src/fields/HistogramField.ts b/src/fields/HistogramField.ts
new file mode 100644
index 000000000..bb0014ab3
--- /dev/null
+++ b/src/fields/HistogramField.ts
@@ -0,0 +1,59 @@
+import { BasicField } from "./BasicField";
+import { Field, FieldId } from "./Field";
+import { Types } from "../server/Message";
+import { HistogramOperation } from "../client/northstar/operations/HistogramOperation";
+import { action } from "mobx";
+import { AttributeTransformationModel } from "../client/northstar/core/attribute/AttributeTransformationModel";
+import { ColumnAttributeModel } from "../client/northstar/core/attribute/AttributeModel";
+import { CurrentUserUtils } from "../server/authentication/models/current_user_utils";
+
+
+export class HistogramField extends BasicField<HistogramOperation> {
+ constructor(data?: HistogramOperation, id?: FieldId, save: boolean = true) {
+ super(data ? data : HistogramOperation.Empty, save, id);
+ }
+
+ toString(): string {
+ return JSON.stringify(this.Data);
+ }
+
+ Copy(): Field {
+ return new HistogramField(this.Data);
+ }
+
+ ToScriptString(): string {
+ return `new HistogramField("${this.Data}")`;
+ }
+
+ ToJson(): { type: Types, data: string, _id: string } {
+ return {
+ type: Types.HistogramOp,
+ data: JSON.stringify(this.Data),
+ _id: this.Id
+ }
+ }
+
+ @action
+ static FromJson(id: string, data: any): HistogramField {
+ let jp = JSON.parse(data);
+ let X: AttributeTransformationModel | undefined;
+ let Y: AttributeTransformationModel | undefined;
+ let V: AttributeTransformationModel | undefined;
+
+ CurrentUserUtils.GetAllNorthstarColumnAttributes().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 HistogramField(new HistogramOperation(X, Y, V, jp.Normalization), id, false);
+ }
+ return new HistogramField(HistogramOperation.Empty, id, false);
+ }
+} \ No newline at end of file
diff --git a/src/fields/KeyStore.ts b/src/fields/KeyStore.ts
index f9684b212..20e8cd930 100644
--- a/src/fields/KeyStore.ts
+++ b/src/fields/KeyStore.ts
@@ -29,7 +29,6 @@ export namespace KeyStore {
export const Caption = new Key("Caption");
export const ActiveFrame = new Key("ActiveFrame");
export const ActiveWorkspace = new Key("ActiveWorkspace");
- export const ActiveDB = new Key("ActiveDB");
export const DocumentText = new Key("DocumentText");
export const LinkedToDocs = new Key("LinkedToDocs");
export const LinkedFromDocs = new Key("LinkedFromDocs");
@@ -46,4 +45,5 @@ export namespace KeyStore {
export const Archives = new Key("Archives");
export const Updated = new Key("Updated");
export const Workspaces = new Key("Workspaces");
+ export const NorthstarSchema = new Key("NorthstarSchema");
}
diff --git a/src/server/Message.ts b/src/server/Message.ts
index a2d1ab829..05ae0f19a 100644
--- a/src/server/Message.ts
+++ b/src/server/Message.ts
@@ -45,7 +45,7 @@ export class GetFieldArgs {
}
export enum Types {
- Number, List, Key, Image, Web, Document, Text, RichText, DocumentReference, Html, Video, Audio, Ink, PDF, Tuple
+ Number, List, Key, Image, Web, Document, Text, RichText, DocumentReference, Html, Video, Audio, Ink, PDF, Tuple, HistogramOp
}
export class DocumentTransfer implements Transferable {
diff --git a/src/server/ServerUtil.ts b/src/server/ServerUtil.ts
index f10f82deb..f958df04b 100644
--- a/src/server/ServerUtil.ts
+++ b/src/server/ServerUtil.ts
@@ -17,6 +17,7 @@ import { VideoField } from '../fields/VideoField';
import { InkField } from '../fields/InkField';
import { PDFField } from '../fields/PDFField';
import { TupleField } from '../fields/TupleField';
+import { HistogramField } from '../fields/HistogramField';
@@ -50,6 +51,8 @@ export class ServerUtils {
return new Key(data, id, false)
case Types.Image:
return new ImageField(new URL(data), id, false)
+ case Types.HistogramOp:
+ return HistogramField.FromJson(id, data);
case Types.PDF:
return new PDFField(new URL(data), id, false)
case Types.List:
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index 055e4cc97..4b42e40b6 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -8,6 +8,7 @@ import { KeyStore } from "../../../fields/KeyStore";
import { ListField } from "../../../fields/ListField";
import { Documents } from "../../../client/documents/Documents";
import { Schema, Attribute, AttributeGroup } from "../../../client/northstar/model/idea/idea";
+import { observable, computed, action } from "mobx";
export class CurrentUserUtils {
private static curr_email: string;
@@ -16,6 +17,7 @@ export class CurrentUserUtils {
//TODO tfs: these should be temporary...
private static mainDocId: string | undefined;
private static activeSchema: Schema | undefined;
+ @observable public static ActiveSchemaName: string = "";
public static get email(): string {
return this.curr_email;
@@ -37,6 +39,7 @@ export class CurrentUserUtils {
this.mainDocId = id;
}
+
public static get ActiveSchema(): Schema | undefined {
return this.activeSchema;
}