web app can create and join sessions, updated node info panel and edge info panel

This commit is contained in:
Blake J. Harnden 2018-05-09 13:38:46 -07:00
parent cd949340ac
commit b1b05a7eaa
6 changed files with 91 additions and 24 deletions

View file

@ -163,12 +163,24 @@ class CoreNetwork {
async initialSession() {
const session = await this.coreRest.retrieveSession();
console.log('retrieved session: ', session);
const response = await coreRest.getSession();
console.log('session info: ', response);
this.joinedSessionNodes(response.nodes);
await this.joinSession(session.id);
return session;
}
async newSession() {
const session = await this.coreRest.createSession();
this.coreRest.currentSession = session.id;
this.reset();
return session;
}
reset() {
this.nodeId = 0;
this.nodes.clear();
this.edges.clear();
this.links = {};
}
enableNodeCreation(enabled) {
console.log('node created enabled: ', enabled);
this.nodesEnabled = enabled;
@ -194,7 +206,13 @@ class CoreNetwork {
return this.nodeId;
}
joinedSessionNodes(nodes) {
async joinSession(sessionId) {
this.reset();
this.coreRest.currentSession = sessionId;
const session = await coreRest.getSession();
console.log('session info: ', session);
const nodes = session.nodes;
const self = this;
const nodeIds = [0];
@ -229,6 +247,11 @@ class CoreNetwork {
} else {
this.nodeId = 0;
}
return {
id: sessionId,
state: session.state
};
}
createEdgeFromLink(linkData) {