aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/Main.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-04-09 13:40:40 -0400
committerbob <bcz@cs.brown.edu>2019-04-09 13:40:40 -0400
commit64c8a689c142c82c4dd3ed074e5e6981ea8ea17c (patch)
tree5edcb9d04ad2983bf63e91260c08ca9607d5a17a /src/client/views/Main.tsx
parent37763de22835e3a4a7ad995eb089d23054109c3d (diff)
added ability to load a new database for Northstar
Diffstat (limited to 'src/client/views/Main.tsx')
-rw-r--r--src/client/views/Main.tsx15
1 files changed, 10 insertions, 5 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"));
+ });
+
}
}