Skip to content

Commit 8648e3d

Browse files
committed
config-ip-filter: Server disconnect now allows manipulating graph, but no data entry.
1 parent 6a0f3be commit 8648e3d

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

build/app/unisys/component/SessionShell.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ class SessionShell extends UNISYS.Component {
118118
isValid: false
119119
};
120120
this.previousIsValid = false; // to track changes in loggedIn status
121+
122+
// This will invalidate the token when the server is disconnected
123+
// but this can be a problem for projects that require login
124+
// to view the graph.
125+
// this.OnDisconnect(() => {
126+
// const token = this.props.match.params.token;
127+
// const decoded = SESSION.DecodeToken(token, window.NC_CONFIG.dataset);
128+
// // invalidate the token and announce it
129+
// decoded.isValid = false;
130+
// this.SetAppState("SESSION", decoded);
131+
// });
121132
}
122133

123134
/// ROUTE RENDER FUNCTIONS ////////////////////////////////////////////////////

build/app/view/netcreate/NetCreate.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const FILTERLOGIC = require('./filter-logic'); // handles filtering functions
8787

8888

8989
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
90-
/*/ SESSION is called by SessionSHell when the ID changes
90+
/*/ SESSION is called by SessionShell when the ID changes
9191
Show or hide netgraph depending on template settings.
9292
/*/ onStateChange_SESSION( decoded ) {
9393
this.setState({ isLoggedIn: decoded.isValid });
@@ -116,10 +116,9 @@ const FILTERLOGIC = require('./filter-logic'); // handles filtering functions
116116
if (this.state.requireLogin && !isLoggedIn) hideGraph = true;
117117
return (
118118
<div>
119-
<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'}}>
119+
<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'}}>
120120
<div style={{color:'#fff',width:'100%',textAlign:'center'}}>
121-
<h1>Server Disconnected</h1>
122-
<p>Please contact your administrator to restart the graph.</p>
121+
<b>Server Disconnected!</b> Your changes will not be saved! Please contact your administrator to restart the graph.
123122
</div>
124123
</div>
125124
<Route path='/edit/:token' exact={true} component={SessionShell}/>

build/app/view/netcreate/components/NodeSelector.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,14 @@ class NodeSelector extends UNISYS.Component {
331331
this.setState({ edgesAreLocked: false });
332332
});
333333

334+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
335+
/*/ Prevent editing if server is disconnected.
336+
This is necessary to hide the "Add New Node" button.
337+
/*/
338+
this.OnDisconnect(() => {
339+
console.log('NodeSelector got disconnect')
340+
this.setState({ isLocked: true });
341+
});
334342

335343
} // constructor
336344

0 commit comments

Comments
 (0)