Skip to content

Commit f669699

Browse files
committed
config-ip-filter: Disable Edge on disconnect.
1 parent 8648e3d commit f669699

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
by the EdgeEditor to determine whether it should
5050
display the edge nodes as targets or sources.
5151
52+
parentNodeIsLocked The parent node is locked when the server disconnects
53+
this will disable the Delete and Edit buttons.
54+
5255
## STATES
5356
5457
dbIsLocked
@@ -291,6 +294,15 @@ class EdgeEditor extends UNISYS.Component {
291294
// Template handler
292295
this.OnAppStateChange('TEMPLATE', this.setTemplate);
293296

297+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
298+
/*/ Prevent editing if server is disconnected.
299+
This is necessary to hide the "Add New Node" button.
300+
/*/
301+
this.OnDisconnect(() => {
302+
console.log('EdgeSelector got disconnect')
303+
this.setState({ isLocked: true });
304+
});
305+
294306
} // constructor
295307

296308

@@ -834,7 +846,7 @@ class EdgeEditor extends UNISYS.Component {
834846
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
835847
/*/
836848
/*/ render () {
837-
const { edgeID, parentNodeLabel } = this.props;
849+
const { edgeID, parentNodeLabel, parentNodeIsLocked } = this.props;
838850
const { formData, sourceNode, targetNode, edgePrompts} = this.state;
839851
let {citationPrompts} = this.state;
840852
if (edgePrompts.category === undefined) { // for backwards compatability
@@ -1001,15 +1013,15 @@ class EdgeEditor extends UNISYS.Component {
10011013
</div><br/>
10021014
<FormGroup className="text-right" style={{paddingRight:'5px'}}>
10031015
<Button className="small float-left btn btn-outline-light" size="sm"
1004-
hidden={this.state.isLocked}
1016+
hidden={this.state.isLocked || parentNodeIsLocked}
10051017
onClick={this.onDeleteButtonClick}
10061018
>Delete</Button>&nbsp;
10071019
<Button outline size="sm"
10081020
hidden={ citationPrompts.hidden}
10091021
onClick={this.onCiteButtonClick}
10101022
>Cite Edge</Button>&nbsp;&nbsp;
10111023
<Button outline size="sm"
1012-
hidden={this.state.isLocked || this.state.isEditable}
1024+
hidden={this.state.isLocked || this.state.isEditable || parentNodeIsLocked}
10131025
onClick={this.onEditButtonClick}
10141026
>{this.state.isEditable ? "Add New Edge" : "Edit Edge"}</Button>&nbsp;
10151027
<Button size="sm"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ class NodeSelector extends UNISYS.Component {
10491049
edgeID={edge.id}
10501050
key={edge.id}
10511051
parentNodeLabel={this.state.formData.label}
1052+
parentNodeIsLocked={this.state.isLocked}
10521053
/>
10531054
))}
10541055
<FormGroup className="text-right">

0 commit comments

Comments
 (0)