aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Main.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-03-26 12:37:26 -0400
committerbob <bcz@cs.brown.edu>2019-03-26 12:37:26 -0400
commit8335f0ba0b780a0ed0619e52076f051f122e4865 (patch)
treecac26f0ca29d0852de5012475426e58bd12d4f48 /src/client/views/Main.tsx
parent731cab330389b1730d9700b5452ac75975b79b3c (diff)
added HistogramField
Diffstat (limited to 'src/client/views/Main.tsx')
-rw-r--r--src/client/views/Main.tsx22
1 files changed, 20 insertions, 2 deletions
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> {