diff options
author | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-03-08 23:42:40 -0500 |
---|---|---|
committer | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-03-08 23:42:40 -0500 |
commit | 8ea26fc316685f0a3d1b81b7c2e8bd612acbb99c (patch) | |
tree | 1e7bc0ec6960330b72b503f534684edfd8b13b1c /src | |
parent | f4a01b9b394a5bdc48e57923567249bb05cb71ff (diff) |
workspace persistencegit add -Agit add -A
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/Main.tsx | 11 | ||||
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 2 | ||||
-rw-r--r-- | src/server/authentication/controllers/WorkspacesMenu.tsx | 14 | ||||
-rw-r--r-- | src/server/index.ts | 1 |
4 files changed, 21 insertions, 7 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index da7e17f1f..cb13e172e 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -35,6 +35,11 @@ export class Main extends React.Component { this.initEventListeners(); Documents.initProtos(() => { + // retrieve all workspace documents from the server + request.get(this.contextualize("getAllWorkspaceIds"), (error, res, body) => { + let ids = JSON.parse(body) as string[]; + Server.GetFields(ids, action((fields: { [id: string]: Field }) => this.userWorkspaces = ids.map(id => fields[id] as Document))); + }) this.initAuthenticationRouters(); }); } @@ -54,6 +59,7 @@ export class Main extends React.Component { // Load the user's active workspace, or create a new one if initial session after signup request.get(this.contextualize("getActiveWorkspaceId"), (error, response, body) => { if (body) { + console.log("FROM THE TOP, SOMEONE'S ALREADY BEEN HERE"); Server.GetField(body, field => { if (field instanceof Document) { this.openDocument(field); @@ -62,6 +68,7 @@ export class Main extends React.Component { } }); } else { + console.log("FROM THE TOP, WE THINK THERE'S NO CURRENT USER"); this.createNewWorkspace(); } }); @@ -69,7 +76,7 @@ export class Main extends React.Component { @action createNewWorkspace = (): void => { - let mainDoc = Documents.DockDocument(JSON.stringify({ content: [{ type: 'row', content: [] }] }), { title: "main container" }); + let mainDoc = Documents.DockDocument(JSON.stringify({ content: [{ type: 'row', content: [] }] }), { title: `Main Container ${this.userWorkspaces.length}` }); let newId = mainDoc.Id; request.post(this.contextualize("addWorkspaceId"), { body: { target: newId }, @@ -86,6 +93,7 @@ export class Main extends React.Component { this.openDocument(mainDoc); }, 0); this.userWorkspaces.push(mainDoc); + console.log(this.userWorkspaces.length); } @action @@ -94,6 +102,7 @@ export class Main extends React.Component { body: { target: doc.Id }, json: true }); + console.log(`OPENING ${doc.Id}`); this.mainContainer = doc; this.mainContainer.GetAsync(KeyStore.ActiveFrame, field => this.mainfreeform = field as Document); } diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 19a455b74..0052e9316 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -212,7 +212,7 @@ export class DocumentView extends React.Component<DocumentViewProps> { SelectionManager.SelectDoc(this, e.ctrlKey); } - @computed get mainContent() { + get mainContent() { return <JsxParser components={{ FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView, CollectionView, WebBox, KeyValueBox }} bindings={this._documentBindings} diff --git a/src/server/authentication/controllers/WorkspacesMenu.tsx b/src/server/authentication/controllers/WorkspacesMenu.tsx index ebc4f5a10..00de34d7a 100644 --- a/src/server/authentication/controllers/WorkspacesMenu.tsx +++ b/src/server/authentication/controllers/WorkspacesMenu.tsx @@ -46,20 +46,23 @@ export class WorkspacesMenu extends React.Component<WorkspaceMenuProps> { height: "auto", borderRadius: 5, position: "absolute", - top: 50, - left: this.workspacesExposed ? 8 : -500, + top: 55, + left: this.workspacesExposed ? 11 : -500, background: "white", border: "black solid 2px", transition: "all 1s ease", zIndex: 15, padding: 10, + paddingRight: 12, }}> <img src="https://bit.ly/2IBBkxk" style={{ width: 20, height: 20, - marginBottom: 10, + marginTop: 3, + marginLeft: 3, + marginBottom: 3, cursor: "grab" }} onClick={this.addNewWorkspace} @@ -72,7 +75,10 @@ export class WorkspacesMenu extends React.Component<WorkspaceMenuProps> { color: s.Id === this.props.active.Id ? "darkblue" : "black", cursor: "grab" }} - onClick={() => this.props.open(s)} + onClick={() => { + this.props.open(s); + console.log(this.props.allWorkspaces.length); + }} >{s.Title}</li> )} </div> diff --git a/src/server/index.ts b/src/server/index.ts index 40e1f6686..3e0c28f14 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -117,7 +117,6 @@ addSecureRoute(Method.Get, "home", (user, req, res) => { }, res => res.redirect("/login")) addSecureRoute(Method.Get, "getActiveWorkspaceId", (user, req, res) => { - console.log(`/getActiveWorkspaceId in index.ts ${user.activeWorkspaceId}`); res.send(user.activeWorkspaceId || ""); }, () => { }); |