Skip to content

Commit b1bf9db

Browse files
authored
Merge pull request #39 from netcreateorg/dev-bl/ncnode-ui
New Node and Edge UI Components
2 parents 8951694 + fb6fbb7 commit b1bf9db

26 files changed

Lines changed: 3713 additions & 451 deletions

app/system/util/enum.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,26 @@ ENUM.EDITORTYPE = {
1515
EDGE: 'edge' // parameter sent with packet, listed here for coverage
1616
};
1717

18+
// BUILT-IN FIELDS
19+
ENUM.BUILTIN_FIELDS_NODE = [
20+
'id',
21+
'label',
22+
'provenance',
23+
'degrees',
24+
'created',
25+
'updated',
26+
'revision'
27+
];
28+
ENUM.BUILTIN_FIELDS_EDGE = [
29+
'id',
30+
'source',
31+
'target',
32+
'provenance',
33+
'degrees',
34+
'created',
35+
'updated',
36+
'revision'
37+
];
38+
39+
1840
module.exports = ENUM;

app/unisys/server-database.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,15 @@ DB.PKT_RequestUnlockNode = function (pkt) {
759759
return m_MakeLockError(`nodeID ${nodeID} was not locked so can't unlock`);
760760
};
761761
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
762+
DB.PKT_IsNodeLocked = function (pkt) {
763+
let { nodeID } = pkt.Data();
764+
const uaddr = pkt.s_uaddr;
765+
let errcode = m_IsInvalidNode(nodeID);
766+
if (errcode) return errcode;
767+
const isLocked = m_locked_nodes.has(nodeID);
768+
return { nodeID, locked: isLocked };
769+
};
770+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
762771
function m_IsInvalidNode(nodeID) {
763772
if (!nodeID) return m_MakeLockError(`undefined nodeID`);
764773
nodeID = Number.parseInt(nodeID, 10);
@@ -805,6 +814,15 @@ DB.PKT_RequestUnlockEdge = function (pkt) {
805814
return m_MakeLockError(`edgeID ${edgeID} was not locked so can't unlock`);
806815
};
807816
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
817+
DB.PKT_IsEdgeLocked = function (pkt) {
818+
let { edgeID } = pkt.Data();
819+
const uaddr = pkt.s_uaddr;
820+
let errcode = m_IsInvalidEdge(edgeID);
821+
if (errcode) return errcode;
822+
const isLocked = m_locked_edges.has(edgeID);
823+
return { edgeID, locked: isLocked };
824+
};
825+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
808826
function m_IsInvalidEdge(edgeID) {
809827
if (!edgeID) return m_MakeLockError(`undefined edgeID`);
810828
edgeID = Number.parseInt(edgeID, 10);
@@ -1255,7 +1273,8 @@ DB.RegenerateDefaultTemplate = () => {
12551273
/**
12561274
* Returns object with flags indicating whether the template is being edited,
12571275
* data is being imported, or node or edge are being edited
1258-
* @returns {templateBeingEdited:boolean, importActive:boolean, nodeOrEdgeBeingEdited:boolean}
1276+
* @returns {templateBeingEdited:boolean, importActive:boolean, nodeOrEdgeBeingEdited:boolean,
1277+
* lockedNodes:array, lockedEdges:array }
12591278
*/
12601279
DB.GetEditStatus = () => {
12611280
// If there are any 'template' open editors, then templateBeingEdited is true
@@ -1267,7 +1286,11 @@ DB.GetEditStatus = () => {
12671286
m_open_editors.length > 0 &&
12681287
(m_open_editors.includes(EDITORTYPE.NODE) ||
12691288
m_open_editors.includes(EDITORTYPE.EDGE));
1270-
return { templateBeingEdited, importActive, nodeOrEdgeBeingEdited };
1289+
return {
1290+
templateBeingEdited, importActive, nodeOrEdgeBeingEdited,
1291+
lockedNodes: [...m_locked_nodes.keys()],
1292+
lockedEdges: [...m_locked_edges.keys()]
1293+
};
12711294
};
12721295
/**
12731296
* Register a template, import, node or edge as being actively edited.

0 commit comments

Comments
 (0)