diff options
Diffstat (limited to 'src/client/views')
| -rw-r--r-- | src/client/views/Main.tsx | 15 | ||||
| -rw-r--r-- | src/client/views/collections/CollectionBaseView.tsx | 16 | ||||
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 2 |
3 files changed, 17 insertions, 16 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index fd2e23c91..32798631d 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -348,10 +348,10 @@ export class Main extends React.Component { // --------------- Northstar hooks ------------- / - @action SetNorthstarCatalog(ctlog: Catalog) { - CurrentUserUtils.NorthstarDBCatalog = ctlog; + @action AddToNorthstarCatalog(ctlog: Catalog) { + CurrentUserUtils.NorthstarDBCatalog = CurrentUserUtils.NorthstarDBCatalog ? CurrentUserUtils.NorthstarDBCatalog : ctlog; if (ctlog && ctlog.schemas) { - this._northstarSchemas = ctlog.schemas.map(schema => { + this._northstarSchemas.push(...ctlog.schemas.map(schema => { let schemaDoc = Documents.TreeDocument([], { width: 50, height: 100, title: schema.displayName! }); let schemaDocuments = schemaDoc.GetList(KeyStore.Data, [] as Document[]); CurrentUserUtils.GetAllNorthstarColumnAttributes(schema).map(attr => { @@ -369,7 +369,7 @@ export class Main extends React.Component { })); }); return schemaDoc; - }); + })); } } async initializeNorthstar(): Promise<void> { @@ -382,7 +382,12 @@ export class Main extends React.Component { const env = await response.json(); Settings.Instance.Update(env); let cat = Gateway.Instance.ClearCatalog(); - cat.then(async () => this.SetNorthstarCatalog(await Gateway.Instance.GetCatalog())); + cat.then(async () => { + this.AddToNorthstarCatalog(await Gateway.Instance.GetCatalog()); + if (!CurrentUserUtils.GetNorthstarSchema("Book1")) + this.AddToNorthstarCatalog(await Gateway.Instance.GetSchema("http://www.cs.brown.edu/~bcz/Book1.csv")); + }); + } } diff --git a/src/client/views/collections/CollectionBaseView.tsx b/src/client/views/collections/CollectionBaseView.tsx index 4afa7cbf6..4380c8194 100644 --- a/src/client/views/collections/CollectionBaseView.tsx +++ b/src/client/views/collections/CollectionBaseView.tsx @@ -1,17 +1,13 @@ +import { action } from 'mobx'; +import { observer } from 'mobx-react'; import * as React from 'react'; -import { FieldViewProps } from '../nodes/FieldView'; +import { Document } from '../../../fields/Document'; +import { Field, FieldValue, FieldWaiting } from '../../../fields/Field'; import { KeyStore } from '../../../fields/KeyStore'; +import { ListField } from '../../../fields/ListField'; import { NumberField } from '../../../fields/NumberField'; -import { FieldWaiting, Field, FieldValue } from '../../../fields/Field'; import { ContextMenu } from '../ContextMenu'; -import { SelectionManager } from '../../util/SelectionManager'; -import { Document } from '../../../fields/Document'; -import { ListField } from '../../../fields/ListField'; -import { action } from 'mobx'; -import { Transform } from '../../util/Transform'; -import { observer } from 'mobx-react'; -import { CompileScript } from '../../util/Scripting'; -import { ScriptField } from '../../../fields/ScriptField'; +import { FieldViewProps } from '../nodes/FieldView'; export enum CollectionViewType { Invalid, diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index f058aaccc..5cdea0568 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -73,7 +73,7 @@ export class CollectionSubView extends React.Component<SubCollectionViewProps> { draggedDocument.GetTAsync(key, NumberField, (f: Opt<NumberField>) => f ? de.data.droppedDocuments[i].SetNumber(key, f.Data) : null))); } let added = false; - if (de.data.aliasOnDrop) { + if (de.data.aliasOnDrop || de.data.copyOnDrop) { added = de.data.droppedDocuments.reduce((added: boolean, d) => added || this.props.addDocument(d), false); } else if (de.data.moveDocument) { const move = de.data.moveDocument; |
