Closed brollb closed 4 years ago
This is actually a non-issue since the core can be used in the browser:
// Get the core, rootNode from the WebGME client
const {core, rootNode} = await new Promise(
(resolve, reject) => client.getCoreInstance(logger, (err, result) => err ? reject(err) : resolve(result))
);
// Load the node to edit and importer
const nodeToChange = await core.loadByPath(rootNode, nodeId);
const importer = new Importer(core, rootNode);
await importer.apply(nodeToChange, newState);
// Save using the core
const {rootHash, objects} = core.persist(rootNode);
const branch = this.client.getActiveBranchName();
const startCommit = this.client.getActiveCommitHash();
const project = this.client.getProjectObject();
const commitMsg = `Saved trained neural network: ${snapshot.attributes.name}`;
await project.makeCommit(
branch,
[startCommit],
rootHash,
objects,
commitMsg
);
JSON importer should support creation using the client rather than the core. This would enable it to be used from the browser.