Skip to content

Commit 2ef2ed7

Browse files
authored
Merge pull request #31 from netcreateorg/dev-bl/d3clean
d3 Renderer Cleanup
2 parents 1cd5270 + 0f539f8 commit 2ef2ed7

28 files changed

+26056
-10167
lines changed

app/system/datastore.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ let NCDATA = {};
3737
DSTOR.Hook("INITIALIZE", () => {
3838
// DBUPDATE_ALL is a local call originating from within the app
3939
// Used to update the full NCDATA object during template updates
40-
UDATA.HandleMessage("DBUPDATE_ALL", function(data) {
40+
UDATA.HandleMessage("DBUPDATE_ALL", function (data) {
4141
DSTOR.UpdateDataPromise(data);
4242
});
4343

4444
// DB_UPDATE is a local call originating from within the app
4545
// Generally used to update individual nodes and edges
46-
UDATA.HandleMessage("DB_UPDATE", function(data) {
46+
UDATA.HandleMessage("DB_UPDATE", function (data) {
4747
DSTOR.UpdateServerDB(data);
4848
});
4949

5050
// DB_INSERT is a local call originating from within the app
5151
// Generally used to add new nodes and edges after an import
52-
UDATA.HandleMessage("DB_INSERT", function(data) {
52+
UDATA.HandleMessage("DB_INSERT", function (data) {
5353
DSTOR.InsertServerDB(data);
5454
});
5555

@@ -58,9 +58,9 @@ DSTOR.Hook("INITIALIZE", () => {
5858
// Unlike DB_INSERT, it'll update existing nodes/edges
5959
UDATA.HandleMessage("DB_MERGE", DSTOR.MergeServerDB);
6060

61-
UDATA.OnAppStateChange('SESSION', function( decodedData ) {
61+
UDATA.OnAppStateChange('SESSION', function (decodedData) {
6262
let { isValid, token } = decodedData;
63-
console.log('Handling SESSION',isValid);
63+
console.log('Handling SESSION', isValid);
6464
if (isValid) DSTOR.SetSessionGroupID(decodedData);
6565
});
6666

@@ -72,30 +72,30 @@ DSTOR.Hook("INITIALIZE", () => {
7272
/*/ datastore needs to set NetMessage GroupID property on behalf of SESSIONS
7373
because SESSION can't include NetMessage (or vice versa)
7474
/*/
75-
DSTOR.SetSessionGroupID = function ( decodedData ) {
75+
DSTOR.SetSessionGroupID = function (decodedData) {
7676
let { token, isValid } = decodedData;
7777
if (isValid) {
7878
NetMessage.GlobalSetGroupID(token);
79-
console.log('setting NetMessage group id',token);
79+
console.log('setting NetMessage group id', token);
8080
} else {
81-
console.warn('will not set bad group id:',token);
81+
console.warn('will not set bad group id:', token);
8282
}
8383
};
8484

8585
/// DB INTERFACE //////////////////////////////////////////////////////////////
8686
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8787
/*/ API: Placeholder DATA access function
8888
/*/
89-
DSTOR.Data = function() {
89+
DSTOR.Data = function () {
9090
return NCDATA;
9191
};
9292
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9393
/*/ API: Write update to database
9494
/*/
95-
DSTOR.UpdateServerDB = function(data) {
95+
DSTOR.UpdateServerDB = function (data) {
9696
// check that network is online
9797
if (UNISYS.IsStandaloneMode()) {
98-
console.warn(PR,`STANDALONE MODE: UpdateServerDB() suppressed!`);
98+
console.warn(PR, `STANDALONE MODE: UpdateServerDB() suppressed!`);
9999
return;
100100
}
101101
// it is!
@@ -125,7 +125,7 @@ DSTOR.PromiseCalculateMaxNodeId = function () {
125125
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
126126
/*/ get a unique NodeID
127127
/*/
128-
DSTOR.PromiseNewNodeID = function() {
128+
DSTOR.PromiseNewNodeID = function () {
129129
return new Promise((resolve, reject) => {
130130
UDATA.NetCall("SRV_DBGETNODEID").then(data => {
131131
if (data.nodeID) {
@@ -144,9 +144,9 @@ DSTOR.PromiseNewNodeID = function() {
144144
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
145145
/*/ get multiple unique NodeIDs
146146
/*/
147-
DSTOR.PromiseNewNodeIDs = function(count) {
147+
DSTOR.PromiseNewNodeIDs = function (count) {
148148
return new Promise((resolve, reject) => {
149-
UDATA.NetCall("SRV_DBGETNODEIDS", {count}).then(data => {
149+
UDATA.NetCall("SRV_DBGETNODEIDS", { count }).then(data => {
150150
if (data.nodeIDs) {
151151
if (DBG) console.log(PR, "server allocated node_id", data.nodeIDs);
152152
resolve(data.nodeIDs);
@@ -174,7 +174,7 @@ DSTOR.PromiseCalculateMaxEdgeId = function () {
174174
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
175175
/*/ get a unique Edge
176176
/*/
177-
DSTOR.PromiseNewEdgeID = function() {
177+
DSTOR.PromiseNewEdgeID = function () {
178178
return new Promise((resolve, reject) => {
179179
UDATA.NetCall("SRV_DBGETEDGEID").then(data => {
180180
if (data.edgeID) {
@@ -193,9 +193,9 @@ DSTOR.PromiseNewEdgeID = function() {
193193
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
194194
/*/ get multiple unique EdgeIDs
195195
/*/
196-
DSTOR.PromiseNewEdgeIDs = function(count) {
196+
DSTOR.PromiseNewEdgeIDs = function (count) {
197197
return new Promise((resolve, reject) => {
198-
UDATA.NetCall("SRV_DBGETEDGEIDS", {count}).then(data => {
198+
UDATA.NetCall("SRV_DBGETEDGEIDS", { count }).then(data => {
199199
if (data.edgeIDs) {
200200
if (DBG) console.log(PR, "server allocated edge_id:", data.edgeIDs);
201201
resolve(data.edgeIDs);
@@ -210,7 +210,7 @@ DSTOR.PromiseNewEdgeIDs = function(count) {
210210
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
211211
/*/ API: Load default data set from a JSON file in /assets/data
212212
/*/
213-
DSTOR.PromiseJSONFile = function(jsonFile) {
213+
DSTOR.PromiseJSONFile = function (jsonFile) {
214214
if (typeof jsonFile !== "string") {
215215
throw new Error("pass arg <filename_in_assets/data>");
216216
}
@@ -256,7 +256,7 @@ DSTOR.PromiseTOMLFile = function (tomlFile) {
256256
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
257257
/*/ API: Load D3 Database
258258
/*/
259-
DSTOR.PromiseD3Data = function() {
259+
DSTOR.PromiseD3Data = function () {
260260
// UDATA.Call() returns a promise
261261
return UDATA.Call("SRV_DBGET", {}); // server.js
262262
};
@@ -265,11 +265,11 @@ DSTOR.PromiseD3Data = function() {
265265
/*/
266266
DSTOR.SaveTemplateFile = template => {
267267
// UDATA.Call() returns a promise
268-
return UDATA.Call("SRV_TEMPLATESAVE", {template}); // server.js
268+
return UDATA.Call("SRV_TEMPLATESAVE", { template }); // server.js
269269
};
270270
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
271271
/*/ API: Get Template File Path.
272-
Called by templateEditor-logic when downloading template file.
272+
Called by templateEditor-mgr when downloading template file.
273273
/*/
274274
DSTOR.GetTemplateTOMLFileName = () => {
275275
return UDATA.Call("SRV_GET_TEMPLATETOML_FILENAME");

0 commit comments

Comments
 (0)