diff options
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/Message.ts | 2 | ||||
| -rw-r--r-- | src/server/RouteManager.ts | 1 | ||||
| -rw-r--r-- | src/server/Websocket/Websocket.ts | 3 | ||||
| -rw-r--r-- | src/server/authentication/models/current_user_utils.ts | 73 | ||||
| -rw-r--r-- | src/server/updateProtos.ts | 3 |
5 files changed, 4 insertions, 78 deletions
diff --git a/src/server/Message.ts b/src/server/Message.ts index 81f63656b..01aae5de7 100644 --- a/src/server/Message.ts +++ b/src/server/Message.ts @@ -19,7 +19,7 @@ export class Message<T> { export enum Types { Number, List, Key, Image, Web, Document, Text, Icon, RichText, DocumentReference, - Html, Video, Audio, Ink, PDF, Tuple, HistogramOp, Boolean, Script, Templates + Html, Video, Audio, Ink, PDF, Tuple, Boolean, Script, Templates } export interface Transferable { diff --git a/src/server/RouteManager.ts b/src/server/RouteManager.ts index a8680c0c9..80e4a6741 100644 --- a/src/server/RouteManager.ts +++ b/src/server/RouteManager.ts @@ -2,7 +2,6 @@ import RouteSubscriber from "./RouteSubscriber"; import { DashUserModel } from "./authentication/models/user_model"; import { Request, Response, Express } from 'express'; import { cyan, red, green } from 'colors'; -import { Utils } from "../client/northstar/utils/Utils"; export enum Method { GET, diff --git a/src/server/Websocket/Websocket.ts b/src/server/Websocket/Websocket.ts index 9f9fc9619..947aa4289 100644 --- a/src/server/Websocket/Websocket.ts +++ b/src/server/Websocket/Websocket.ts @@ -199,7 +199,7 @@ export namespace WebSocket { function setField(socket: Socket, newValue: Transferable) { Database.Instance.update(newValue.id, newValue, () => socket.broadcast.emit(MessageStore.SetField.Message, newValue)); - if (newValue.type === Types.Text) { + if (newValue.type === Types.Text) { // if the newValue has sring type, then it's suitable for searching -- pass it to SOLR Search.updateDocument({ id: newValue.id, data: (newValue as any).data }); } } @@ -221,6 +221,7 @@ export namespace WebSocket { "pdf": ["_t", "url"], "audio": ["_t", "url"], "web": ["_t", "url"], + "script": ["_t", value => value.script.originalScript], "RichTextField": ["_t", value => value.Text], "date": ["_d", value => new Date(value.date).toISOString()], "proxy": ["_i", "fieldId"], diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts index 529f8d56d..589055fbe 100644 --- a/src/server/authentication/models/current_user_utils.ts +++ b/src/server/authentication/models/current_user_utils.ts @@ -2,8 +2,6 @@ import { action, computed, observable, reaction } from "mobx"; import * as rp from 'request-promise'; import { DocServer } from "../../../client/DocServer"; import { Docs, DocumentOptions } from "../../../client/documents/Documents"; -import { Attribute, AttributeGroup, Catalog, Schema } from "../../../client/northstar/model/idea/idea"; -import { ArrayUtil } from "../../../client/northstar/utils/ArrayUtil"; import { UndoManager } from "../../../client/util/UndoManager"; import { Doc, DocListCast } from "../../../new_fields/Doc"; import { List } from "../../../new_fields/List"; @@ -419,77 +417,6 @@ export class CurrentUserUtils { throw new Error("There should be a user id! Why does Dash think there isn't one?"); } }); - // try { - // const getEnvironment = await fetch("/assets/env.json", { redirect: "follow", method: "GET", credentials: "include" }); - // NorthstarSettings.Instance.UpdateEnvironment(await getEnvironment.json()); - // await Gateway.Instance.ClearCatalog(); - // const extraSchemas = Cast(CurrentUserUtils.UserDocument.DBSchemas, listSpec("string"), []); - // let extras = await Promise.all(extraSchemas.map(sc => Gateway.Instance.GetSchema("", sc))); - // let catprom = CurrentUserUtils.SetNorthstarCatalog(await Gateway.Instance.GetCatalog(), extras); - // // if (catprom) await Promise.all(catprom); - // } catch (e) { - - // } - } - - /* Northstar catalog ... really just for testing so this should eventually go away */ - // --------------- Northstar hooks ------------- / - static _northstarSchemas: Doc[] = []; - @observable private static _northstarCatalog?: Catalog; - @computed public static get NorthstarDBCatalog() { return this._northstarCatalog; } - - @action static SetNorthstarCatalog(ctlog: Catalog, extras: Catalog[]) { - CurrentUserUtils.NorthstarDBCatalog = ctlog; - // if (ctlog && ctlog.schemas) { - // extras.map(ex => ctlog.schemas!.push(ex)); - // return ctlog.schemas.map(async schema => { - // let schemaDocuments: Doc[] = []; - // let attributesToBecomeDocs = CurrentUserUtils.GetAllNorthstarColumnAttributes(schema); - // await Promise.all(attributesToBecomeDocs.reduce((promises, attr) => { - // promises.push(DocServer.GetRefField(attr.displayName! + ".alias").then(action((field: Opt<Field>) => { - // if (field instanceof Doc) { - // schemaDocuments.push(field); - // } else { - // var atmod = new ColumnAttributeModel(attr); - // let histoOp = new HistogramOperation(schema.displayName!, - // new AttributeTransformationModel(atmod, AggregateFunction.None), - // new AttributeTransformationModel(atmod, AggregateFunction.Count), - // new AttributeTransformationModel(atmod, AggregateFunction.Count)); - // schemaDocuments.push(Docs.Create.HistogramDocument(histoOp, { width: 200, height: 200, title: attr.displayName! })); - // } - // }))); - // return promises; - // }, [] as Promise<void>[])); - // return CurrentUserUtils._northstarSchemas.push(Docs.Create.TreeDocument(schemaDocuments, { width: 50, height: 100, title: schema.displayName! })); - // }); - // } - } - public static set NorthstarDBCatalog(ctlog: Catalog | undefined) { this._northstarCatalog = ctlog; } - - public static AddNorthstarSchema(schema: Schema, schemaDoc: Doc) { - if (this._northstarCatalog && CurrentUserUtils._northstarSchemas) { - this._northstarCatalog.schemas!.push(schema); - CurrentUserUtils._northstarSchemas.push(schemaDoc); - const schemas = Cast(CurrentUserUtils.UserDocument.DBSchemas, listSpec("string"), []); - schemas.push(schema.displayName!); - CurrentUserUtils.UserDocument.DBSchemas = new List<string>(schemas); - } - } - public static GetNorthstarSchema(name: string): Schema | undefined { - return !this._northstarCatalog || !this._northstarCatalog.schemas ? undefined : - ArrayUtil.FirstOrDefault<Schema>(this._northstarCatalog.schemas, (s: Schema) => s.displayName === name); - } - public static GetAllNorthstarColumnAttributes(schema: Schema) { - const recurs = (attrs: Attribute[], g?: AttributeGroup) => { - if (g && g.attributes) { - attrs.push.apply(attrs, g.attributes); - if (g.attributeGroups) { - g.attributeGroups.forEach(ng => recurs(attrs, ng)); - } - } - return attrs; - }; - return recurs([] as Attribute[], schema ? schema.rootAttributeGroup : undefined); } } diff --git a/src/server/updateProtos.ts b/src/server/updateProtos.ts index 90490eb45..e9860bd61 100644 --- a/src/server/updateProtos.ts +++ b/src/server/updateProtos.ts @@ -1,8 +1,7 @@ import { Database } from "./database"; const protos = - ["text", "histogram", "image", "web", "collection", "kvp", - "video", "audio", "pdf", "icon", "import", "linkdoc"]; + ["text", "image", "web", "collection", "kvp", "video", "audio", "pdf", "icon", "import", "linkdoc"]; (async function () { await Promise.all( |
