|
49 | 49 | by the EdgeEditor to determine whether it should
|
50 | 50 | display the edge nodes as targets or sources.
|
51 | 51 |
|
| 52 | + parentNodeIsLocked The parent node is locked when the server disconnects |
| 53 | + this will disable the Delete and Edit buttons. |
| 54 | +
|
52 | 55 | ## STATES
|
53 | 56 |
|
54 | 57 | dbIsLocked
|
@@ -291,6 +294,15 @@ class EdgeEditor extends UNISYS.Component {
|
291 | 294 | // Template handler
|
292 | 295 | this.OnAppStateChange('TEMPLATE', this.setTemplate);
|
293 | 296 |
|
| 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 | + |
294 | 306 | } // constructor
|
295 | 307 |
|
296 | 308 |
|
@@ -834,7 +846,7 @@ class EdgeEditor extends UNISYS.Component {
|
834 | 846 | /// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
835 | 847 | /*/
|
836 | 848 | /*/ render () {
|
837 |
| - const { edgeID, parentNodeLabel } = this.props; |
| 849 | + const { edgeID, parentNodeLabel, parentNodeIsLocked } = this.props; |
838 | 850 | const { formData, sourceNode, targetNode, edgePrompts} = this.state;
|
839 | 851 | let {citationPrompts} = this.state;
|
840 | 852 | if (edgePrompts.category === undefined) { // for backwards compatability
|
@@ -1001,15 +1013,15 @@ class EdgeEditor extends UNISYS.Component {
|
1001 | 1013 | </div><br/>
|
1002 | 1014 | <FormGroup className="text-right" style={{paddingRight:'5px'}}>
|
1003 | 1015 | <Button className="small float-left btn btn-outline-light" size="sm"
|
1004 |
| - hidden={this.state.isLocked} |
| 1016 | + hidden={this.state.isLocked || parentNodeIsLocked} |
1005 | 1017 | onClick={this.onDeleteButtonClick}
|
1006 | 1018 | >Delete</Button>
|
1007 | 1019 | <Button outline size="sm"
|
1008 | 1020 | hidden={ citationPrompts.hidden}
|
1009 | 1021 | onClick={this.onCiteButtonClick}
|
1010 | 1022 | >Cite Edge</Button>
|
1011 | 1023 | <Button outline size="sm"
|
1012 |
| - hidden={this.state.isLocked || this.state.isEditable} |
| 1024 | + hidden={this.state.isLocked || this.state.isEditable || parentNodeIsLocked} |
1013 | 1025 | onClick={this.onEditButtonClick}
|
1014 | 1026 | >{this.state.isEditable ? "Add New Edge" : "Edit Edge"}</Button>
|
1015 | 1027 | <Button size="sm"
|
|
0 commit comments