Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions build/app/unisys/server-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ function m_IsInvalidEdge(edgeID) {
return undefined;
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DB.PKT_RequestUnlockAllNodes = function (pkt) {
m_locked_nodes = new Set();
return { unlocked: true };
}
DB.PKT_RequestUnlockAllEdges = function (pkt) {
m_locked_edges = new Set();
return { unlocked: true };
}
DB.PKT_RequestUnlockAll = function (pkt) {
m_locked_nodes = new Set();
m_locked_edges = new Set();
return { unlocked: true };
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DB.PKT_Update = function(pkt) {
let { node, edge, nodeID, replacementNodeID, edgeID } = pkt.Data();
let retval = {};
Expand Down
13 changes: 13 additions & 0 deletions build/app/unisys/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ var UNISYS = {};
return UDB.PKT_RequestUnlockEdge(pkt);
});

UNET.HandleMessage('SRV_DBUNLOCKALLNODES', function (pkt) {
if (DBG) console.log(PR, sprint_message(pkt));
return UDB.PKT_RequestUnlockAllNodes(pkt);
});
UNET.HandleMessage('SRV_DBUNLOCKALLEDGES', function (pkt) {
if (DBG) console.log(PR, sprint_message(pkt));
return UDB.PKT_RequestUnlockAllEdges(pkt);
});
UNET.HandleMessage('SRV_DBUNLOCKALL', function (pkt) {
if (DBG) console.log(PR, sprint_message(pkt));
return UDB.PKT_RequestUnlockAll(pkt);
});

UNET.HandleMessage('SRV_DBGETEDGEID', function (pkt) {
if (DBG) console.log(PR,sprint_message(pkt));
return UDB.PKT_GetNewEdgeID(pkt);
Expand Down
30 changes: 24 additions & 6 deletions build/app/view/netcreate/components/EdgeEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,19 @@ class EdgeEditor extends UNISYS.Component {
/*/ handleSelection ( data ) {
if (DBG) console.log('EdgeEditor',this.props.edgeID,'got SELECTION data',data);


// If we're one of the edges that have been updated, and we're not currently being edited,
// then update the data.
// If we're not currently being edited, then if edges have been updated, update self
let updatedEdge = data.edges.find((edge) => { return edge.id === this.state.formData.id; });
if (!this.state.isEditable && updatedEdge!==undefined) {
if (DBG) console.log('EdgeEditor: Updating edges with', updatedEdge);
this.loadSourceAndTarget();
return;
if (data.edges !== undefined) {
let updatedEdge = data.edges.find((edge) => { return edge.id === this.state.formData.id; });
if (!this.state.isEditable && updatedEdge !== undefined) {
if (DBG) console.log('EdgeEditor: Updating edges with', updatedEdge);
this.loadSourceAndTarget();
return;
}
}

// We're being edited, and the updated node is either our source or target
// Technically we probably ought to also check to make sure we're the current
// activeAutoCompleteId, but we wouldn't be editable if we weren't.
if (this.state.isEditable && data.nodes && data.nodes.length > 0) {
Expand Down Expand Up @@ -899,6 +901,22 @@ class EdgeEditor extends UNISYS.Component {
this.loadSourceAndTarget();
this.onStateChange_SESSION(this.AppState('SESSION'));
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ Release the lock if we're unmounting
/*/ componentWillUnmount() {
if (DBG) console.log('EdgeEditor.componentWillUnMount!');
if (this.state.isEditable) {
this.NetCall('SRV_DBUNLOCKEDGE', { edgeID: this.state.formData.id })
.then((data) => {
if (data.NOP) {
if (DBG) console.log(`SERVER SAYS: ${data.NOP} ${data.INFO}`);
} else if (data.unlocked) {
if (DBG) console.log(`SERVER SAYS: unlock success! you have released Edge ${data.edgeID}`);
this.setState({ dbIsLocked: false });
}
});
}
}
} // class EdgeEditor


Expand Down
4 changes: 2 additions & 2 deletions build/app/view/netcreate/components/EdgeTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ class EdgeTable extends UNISYS.Component {
let styles = `thead, tbody { display: block; }
thead { position: relative; }
tbody { overflow: auto; }
.edgetable td:nth-child(1), .edgetable th:nth-child(1) {width: 2em; min-width: 2em;}
.edgetable td:nth-child(2), .edgetable th:nth-child(2) {width: 2em; min-width: 2em;}
.edgetable td:nth-child(1), .edgetable th:nth-child(1) {width: 3em; min-width: 3em;}
.edgetable td:nth-child(2), .edgetable th:nth-child(2) {width: 3em; min-width: 3em;}
.edgetable td:nth-child(3), .edgetable th:nth-child(3) {width: 4em; min-width: 4em;}
.edgetable td:nth-child(4), .edgetable th:nth-child(4) {width: 6em; min-width: 6em;}
.edgetable td:nth-child(5), .edgetable th:nth-child(5) {width: 14em; min-width: 14em;}
Expand Down
24 changes: 23 additions & 1 deletion build/app/view/netcreate/nc-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,28 @@ JSCLI.AddFunction(function ncPushDatabase(jsonFile) {
}
);
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ Command: Unlock the database. Used to recover from error conditions where
a node or edge is inadvertently left locked.
/*/
JSCLI.AddFunction(
function ncUnlockAll() {
UDATA.NetCall('SRV_DBUNLOCKALL', {});
return "Unlocking all nodes and edges in the database.";
}
);
JSCLI.AddFunction(
function ncUnlockAllNodes() {
UDATA.NetCall('SRV_DBUNLOCKALLNODES', {});
return "Unlocking all nodes in the database.";
}
);
JSCLI.AddFunction(
function ncUnlockAllEdges() {
UDATA.NetCall('SRV_DBUNLOCKALLEDGES', {});
return "Unlocking all edges in the database.";
}
);
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ Command: Token Generator
/*/
JSCLI.AddFunction(function ncMakeTokens(clsId, projId, numGroups) {
Expand All @@ -1044,7 +1066,7 @@ JSCLI.AddFunction(function ncMakeTokens(clsId, projId, numGroups) {
if (clsId.length > 12) return "classId arg1 should be 12 chars or less";
if (projId.length > 12) return "classId arg1 should be 12 chars or less";
if (!Number.isInteger(numGroups)) return "numGroups arg3 must be integer";
if (numGroups < 1) return "numGroups arg3 must be positive integeger";
if (numGroups < 1) return "numGroups arg3 must be positive integer";
// let's do this!
let out = `\nTOKEN LIST for class '${clsId}' project '${projId}'\n\n`;
let pad = String(numGroups).length;
Expand Down