Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ad6e322
config-ip-heartbeat: Server now sends periodic heartbeat to any conne…
benloh Aug 8, 2020
ee36b7d
config-ip-heartbeat: client will now show "Server Disconnected" if a …
benloh Aug 8, 2020
de4de00
config-ip-filter: Lint
benloh Aug 9, 2020
bdb4ab7
config-ip-filter: d3 set opacity to 0 if `isFilteredOut`
benloh Aug 9, 2020
65ebf82
config-ip-filter: Add filter functions to nc-logic.
benloh Aug 9, 2020
b391b26
config-ip-filter: Add rudimentary filter panel.
benloh Aug 9, 2020
1fbb7ba
config-ip-filter: Add "Clear Filters" button.
benloh Aug 10, 2020
38057f3
config-ip-filter: Show multiple filter groups.
benloh Aug 10, 2020
18012f2
config-ip-filter: Add filter actions.
benloh Aug 10, 2020
06fadef
config-ip-filter: Enumerate filter constants.
benloh Aug 10, 2020
b6ec3fd
config-ip-filter: Move `filter-logic` to its own module.
benloh Aug 10, 2020
ca7b888
config-ip-filter: Add separate key label filter parameters. (templat…
benloh Aug 10, 2020
c3b304b
config-ip-filter: Filter by different template node field keys.
benloh Aug 10, 2020
89cfa84
config-ip-filter: Add HACK to convert old attribute data. (Historica…
benloh Aug 10, 2020
58400f8
config-ip-filter: Add 'not-contains' filter.
benloh Aug 10, 2020
1c4b521
config-ip-filter: Add transitiion animation to opacity change.
benloh Aug 12, 2020
9567e81
config-ip-filter: Rename operator "EMPTY" as "NO_OP" because changing…
benloh Aug 12, 2020
21ec7cf
config-ip-filter: Rough first pass at working filter. Only the first…
benloh Aug 12, 2020
25c58f2
config-ip-filter: Working basic mulitiple filter for nodes and edges.
benloh Aug 12, 2020
1c317be
config-ip-filter: Convert StringFilter to React.Component class.
benloh Aug 13, 2020
b42d039
config-ip-filter: Rough pass at reading filters from templates. Works.
benloh Aug 13, 2020
8548014
config-ip-label: Convert FILITERDEFS to FDATA, streamline data model.
benloh Aug 13, 2020
cfc9e4e
config-ip-filter: Remove padding from InfoPanel.
benloh Aug 13, 2020
ef97d49
config-ip-filter: Add Number filter.
benloh Aug 13, 2020
d2a088c
config-ip-filter: Add number filter for edges.
benloh Aug 13, 2020
0328336
config-ip-filter: Add Select filter.
benloh Aug 13, 2020
a853ed7
config-ip-filter: Add "Clear Filter" and rdfc (really deep fast clone)
benloh Aug 14, 2020
4e08f74
config-ip-filter: Add "Clear Filter", part 2
benloh Aug 14, 2020
8ed38a4
config-ip-filter: If property is hidden in template, don't create a f…
benloh Aug 14, 2020
5d1eed9
config-ip-filter: Documentation and linting.
benloh Aug 14, 2020
8cfaf61
config-ip-filter: Add Storybook.
benloh Aug 14, 2020
c619a34
config-ip-filter: Tighten layout. Reduce height of filter fields.
benloh Aug 14, 2020
fc5d375
config-ip-filter: Keep infopanel dragbar from dragging into the tabpenl
benloh Aug 14, 2020
f649cb4
config-ip-filter: Hide tabcontent overflow to prevent two scrollbars …
benloh Aug 14, 2020
0d02cde
config-ip-filter: Reconfigure brunch to not compile storybook files t…
benloh Aug 14, 2020
997e69d
config-ip-filter: Show filter summary when filters tab is closed.
benloh Aug 14, 2020
a9ad2e1
config-ip-filter: Fix bad quotes in template comments.
benloh Aug 14, 2020
6a0f3be
config-ip-filter: Hyphenate "significance" instead of hiding the over…
benloh Aug 14, 2020
8648e3d
config-ip-filter: Server disconnect now allows manipulating graph, bu…
benloh Aug 14, 2020
f669699
config-ip-filter: Disable Edge on disconnect.
benloh Aug 14, 2020
62294cd
config-ip-filter: Check for source/target node removal before saving …
benloh Aug 15, 2020
b5f23c8
config-ip-filter: Bug fix: SOURCE_UPDATE call no longer triggers erro…
benloh Aug 15, 2020
24edcd7
config-ip-filter: Hyphenate and remove padding so node and edge label…
benloh Aug 15, 2020
e2ec17a
config-ip-filter: Update nvmrc node version from 10.9.0 to 10.22.0
benloh Aug 18, 2020
8c7d32c
config-ip-filter: Fix bad 'citation' HACKMAP reference.
benloh Aug 18, 2020
017100a
config-ip-filter: HACKMAP_EDGES "Citation" should be "Citations" to m…
benloh Aug 19, 2020
ae49169
config-ip-filter: Change default template label to "Citations" to mat…
benloh Aug 20, 2020
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
2 changes: 1 addition & 1 deletion build/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.9.0
v10.22.0
17 changes: 17 additions & 0 deletions build/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require("path");

module.exports = {
"stories": [
"../app/**/*.stories.js"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
],
"webpackFinal": (config) => {
config.resolve.modules.push(
path.resolve(__dirname, '../app/')
);
return config;
}
}
4 changes: 4 additions & 0 deletions build/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
}
30 changes: 24 additions & 6 deletions build/app/assets/templates/_default.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{

"_comments": [ "/// NetCreate Template File ///",
"/// IMPORTANT: As of 8/7/2020, the following funcationality is available: ///",
"_comments": [ "/// NetCreate Template File ///",
"/// RELEASE NOTES: As of 8/13/2020, a 'type' specification needs to added to each ///",
"/// nodePrompt and edgePrompt for filters to work. Valid types are: ///",
"/// 'string', 'number', 'select', and 'node'. The 'node' type is only valid for ///",
"/// 'source' and 'target' objects for edges. ///",
"/// RELEASE NOTES: As of 8/7/2020, the following functionality is available: ///",
"/// * `requireLogin: true` will require users to login to view graphs. If the ///",
"/// parameter is `false` or missing, graphs are public, and login is not required ///",
"/// IMPORTANT: As of 1/31/2019, the following functionality is available: ///",
"/// RELEASE NOTES: As of 1/31/2019, the following functionality is available: ///",
"/// * `label` parameter for each field may be customized ///",
"/// * `hidden` parameter may be used to hide fields ///",
"/// * changing the order of the `options` WILL change their order on selections ///",
Expand All @@ -28,6 +32,7 @@

"nodePrompts": {
"label": {
"type": "string",
"label": "Label",
"help": "A short title for the node",
"includeInGraphTooltip": true,
Expand All @@ -36,6 +41,7 @@
"_cmt4": "/// `Label` is always required and cannot be hidden"
},
"type": {
"type": "select",
"label": "Type",
"help": "Multiple people are a 'Group'",
"includeInGraphTooltip": true,
Expand Down Expand Up @@ -75,29 +81,34 @@
]
},
"degrees": {
"type": "number",
"label": "Degrees",
"help": "Number of edges.",
"includeInGraphTooltip": true,
"hidden": false
},
"notes": {
"type": "string",
"label": "Significance",
"help": "Add some details.",
"help": "Add some details.",
"includeInGraphTooltip": true,
"hidden": false
},
"info": {
"type": "number",
"label": "Geocode or Date",
"help": "Use latitude/longitude or a date mm/dd/yyy",
"includeInGraphTooltip": true,
"hidden": true
},
"updated":{
"type": "string",
"label": "Last update",
"includeInGraphTooltip": true,
"_cmt4": "//updated is included in the edge tables if in admin mode, and in the graph tooltip if indicated here. Probably those should be more consistent."
},
"delete": {
"type": "hidden",
"hidden": false
}
},
Expand All @@ -107,11 +118,13 @@
"edgePrompts": {
"edgeIsLockedMessage": "This edge is currently being edited by someone else, please try again later.",
"source": {
"type": "node",
"label": "Source",
"help": "",
"hidden": false
},
"type": {
"type": "select",
"label": "Type",
"help": "",
"hidden": false,
Expand Down Expand Up @@ -147,26 +160,31 @@
]
},
"target": {
"type": "node",
"label": "Target",
"help": "",
"hidden": false
},
"notes": {
"type": "string",
"label": "Signficance",
"help": "",
"hidden": false
},
"info": {
"type": "number",
"label": "Approximate Date of Interaction",
"help": "",
"hidden": true
"hidden": false
},
"citation": {
"label": "Citation",
"type": "string",
"label": "Citations",
"help": "Enter Chapter number.",
"hidden": false
},
"category": {
"type": "string",
"label": "Category",
"help": "",
"hidden": true
Expand Down
34 changes: 34 additions & 0 deletions build/app/unisys/client-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ const DBG = { connect: true, handle: false };
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const SETTINGS = require("settings");
const NetMessage = require("unisys/common-netmessage-class");
const DEFS = require("./common-defs");
const PROMPTS = require("system/util/prompts");

const PR = PROMPTS.Pad("NETWORK");
const WARN = PROMPTS.Pad("!!!");
const ERR_NM_REQ = "arg1 must be NetMessage instance";
Expand All @@ -37,6 +39,9 @@ const M_NOCONNECT = 6;
var m_status = M0_INIT;
var m_options = {};

// hearbeat
var m_hearbeat_timer;

/// API METHODS ///////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var NETWORK = {};
Expand Down Expand Up @@ -149,9 +154,38 @@ function m_HandleRegistrationMessage(msgEvent) {
m_status = M4_READY;
// (4) network is initialized
if (typeof m_options.success === "function") m_options.success();
// (5) initialize heartbeat timer
m_ResetHearbeatTimer();
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ If a 'hearbeat' message is not received from the server every 5 seconds
we assume the network connection has gone down. The timeout should be
greater than the server heartbeat interval set in
server-network.js:m_StartHeartbeat()

The UNISYSDisconnect handler only goes down when the server closes the
connection. In order to detect the internet connection going down
(e.g. wifi) we need to check to see if we are peridically receiving
a heartbeat message from the server.
/*/
function m_ResetHearbeatTimer() {
clearTimeout(m_hearbeat_timer);
m_hearbeat_timer = setTimeout(function heartbeatStopped() {
if (DBG.handle) console.log(PR, 'heartbeat not received before time ran out -- YOURE DEAD!');
NetMessage.GlobalOfflineMode();
}, DEFS.SERVER_HEARTBEAT_INTERVAL + 1000);
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function m_HandleMessage(msgEvent) {

// Check Hearbeat
if (msgEvent.data === 'heartbeat') {
if (DBG.handle) console.log(PR, '...got hearbeat! Reset timer');
m_ResetHearbeatTimer();
return;
}

// Handle Regular Message
let pkt = new NetMessage(msgEvent.data);
let msg = pkt.Message();
if (pkt.IsOwnResponse()) {
Expand Down
2 changes: 2 additions & 0 deletions build/app/unisys/common-defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const DBG = true;
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var DEFS = {};

DEFS.SERVER_HEARTBEAT_INTERVAL = 5000;

/// EXPORT MODULE DEFINITION //////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
module.exports = DEFS;
11 changes: 11 additions & 0 deletions build/app/unisys/component/SessionShell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ class SessionShell extends UNISYS.Component {
isValid: false
};
this.previousIsValid = false; // to track changes in loggedIn status

// This will invalidate the token when the server is disconnected
// but this can be a problem for projects that require login
// to view the graph.
// this.OnDisconnect(() => {
// const token = this.props.match.params.token;
// const decoded = SESSION.DecodeToken(token, window.NC_CONFIG.dataset);
// // invalidate the token and announce it
// decoded.isValid = false;
// this.SetAppState("SESSION", decoded);
// });
}

/// ROUTE RENDER FUNCTIONS ////////////////////////////////////////////////////
Expand Down
21 changes: 20 additions & 1 deletion build/app/unisys/server-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var FSE = require('fs-extra');
var NetMessage = require('../unisys/common-netmessage-class');
const LOGGER = require('../unisys/server-logger');
var DB = require('../unisys/server-database');
var DEFS = require('./common-defs');

/// CONSTANTS /////////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -46,7 +47,8 @@ var mu_sid_counter = 0; // for generating unique socket ids
var m_server_handlers = new Map(); // message map storing sets of functions
var m_message_map = new Map(); // message map storing other handlers
var m_socket_msgs_list = new Map(); // message map by uaddr

// heartbeat
var m_heartbeat_interval;

/// API MEHTHODS //////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -177,7 +179,24 @@ const SERVER_UADDR = NetMessage.DefaultServerUADDR(); // is 'SVR_01'
socket.on('close', () => {
m_SocketDelete(socket);
});

// start heartbeat
m_StartHeartbeat();
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ When a new socket is connected, we send a periodic heartbeat to let them
know we're still here, and so client can detect when network is lost.
/*/ function m_StartHeartbeat() {
if (DBG) console.log(PR, 'starting heartbeat');
if (m_heartbeat_interval) return; // already started
m_heartbeat_interval = setInterval(function sendHeartbeat() {
mu_sockets.forEach((socket, key, map) => {
if (DBG) console.log(PR, 'sending heartbeat to', socket.UADDR);
socket.send('heartbeat');
});
}, DEFS.SERVER_HEARTBEAT_INTERVAL);
}

/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ When a new socket connection happens, send back the special registration
packet (WIP)
Expand Down
11 changes: 5 additions & 6 deletions build/app/view/netcreate/NetCreate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Search = require('./components/Search');
const NodeSelector = require('./components/NodeSelector');
const InfoPanel = require('./components/InfoPanel');
const NCLOGIC = require('./nc-logic'); // require to bootstrap data loading

const FILTERLOGIC = require('./filter-logic'); // handles filtering functions

/// REACT COMPONENT ///////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -87,7 +87,7 @@ const NCLOGIC = require('./nc-logic'); // require to bootstrap data loading


/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ SESSION is called by SessionSHell when the ID changes
/*/ SESSION is called by SessionShell when the ID changes
Show or hide netgraph depending on template settings.
/*/ onStateChange_SESSION( decoded ) {
this.setState({ isLoggedIn: decoded.isValid });
Expand Down Expand Up @@ -116,10 +116,9 @@ const NCLOGIC = require('./nc-logic'); // require to bootstrap data loading
if (this.state.requireLogin && !isLoggedIn) hideGraph = true;
return (
<div>
<div hidden={this.state.isConnected} style={{ width:'100%',height:'100%',position:'fixed',backgroundColor:'rgba(0,0,0,0.5',display:'flex',flexDirection:'column',justifyContent:'space-evenly',zIndex:'3000'}}>
<div hidden={this.state.isConnected} style={{ width:'100%',height:'38px',position:'fixed',backgroundColor:'rgba(256,0,0,0.5',display:'flex',flexDirection:'column',justifyContent:'space-evenly',alignItems:'center',zIndex:'3000'}}>
<div style={{color:'#fff',width:'100%',textAlign:'center'}}>
<h1>Server Disconnected</h1>
<p>Please contact your administrator to restart the graph.</p>
<b>Server Disconnected!</b> Your changes will not be saved! Please contact your administrator to restart the graph.
</div>
</div>
<Route path='/edit/:token' exact={true} component={SessionShell}/>
Expand All @@ -133,7 +132,7 @@ const NCLOGIC = require('./nc-logic'); // require to bootstrap data loading
<NodeSelector/>
</div>
</div>
<div id="middle" style={{backgroundColor:'#fcfcfc', flex:'3 0 60%', padding:'10px',marginTop:'38px'}}>
<div id="middle" style={{backgroundColor:'#fcfcfc', flex:'3 0 60%',marginTop:'38px'}}>
<InfoPanel/>
<NetGraph/>
<div style={{fontSize:'10px',position:'fixed',left:'0px',bottom:'0px',right:'0px',zIndex:'1500',color:'#aaa',backgroundColor:'#eee',padding:'5px 10px'}}>Please contact Professor
Expand Down
Loading