Abstract closeTooltip

master
Rohan Vazarkar 2018-08-10 13:09:24 -04:00
parent 68b8b6fbb6
commit 4380bd2273
10 changed files with 23 additions and 43 deletions

View File

@ -21,9 +21,7 @@ export default class ExportContainer extends Component {
} }
_show() { _show() {
if (appStore.currentTooltip !== null){ closeTooltip();
appStore.currentTooltip.close();
}
$(this.refs.outer).fadeToggle(true); $(this.refs.outer).fadeToggle(true);
} }

View File

@ -26,7 +26,7 @@ export default class NodeEditor extends Component {
} }
getNodeData(name, type) { getNodeData(name, type) {
appStore.currentTooltip.close(); closeTooltip()
$(this.refs.outer).fadeIn(); $(this.refs.outer).fadeIn();
$(this.refs.newAttrName).val(""); $(this.refs.newAttrName).val("");
let q = driver.session(); let q = driver.session();

View File

@ -163,9 +163,7 @@ export default class GraphContainer extends Component {
} }
getHelpEdge(id){ getHelpEdge(id){
if (appStore.currentTooltip !== null){ closeTooltip();
appStore.currentTooltip.close();
}
let instance = this.state.sigmaInstance.graph; let instance = this.state.sigmaInstance.graph;
let edge = instance.edges(id); let edge = instance.edges(id);
let source = instance.nodes(edge.source); let source = instance.nodes(edge.source);
@ -174,9 +172,7 @@ export default class GraphContainer extends Component {
} }
setOwned(id, status){ setOwned(id, status){
if (appStore.currentTooltip !== null){ closeTooltip();
appStore.currentTooltip.close();
}
let instance = this.state.sigmaInstance; let instance = this.state.sigmaInstance;
let node = instance.graph.nodes(id); let node = instance.graph.nodes(id);
if (status){ if (status){
@ -212,9 +208,7 @@ export default class GraphContainer extends Component {
} }
setHighVal(id, status){ setHighVal(id, status){
if (appStore.currentTooltip !== null){ closeTooltip();
appStore.currentTooltip.close();
}
let instance = this.state.sigmaInstance; let instance = this.state.sigmaInstance;
let node = instance.graph.nodes(id); let node = instance.graph.nodes(id);
node.highvalue = status; node.highvalue = status;
@ -282,9 +276,7 @@ export default class GraphContainer extends Component {
} }
relayout() { relayout() {
if (appStore.currentTooltip !== null){ closeTooltip();
appStore.currentTooltip.close();
}
sigma.layouts.stopForceLink(); sigma.layouts.stopForceLink();
if (appStore.dagre) { if (appStore.dagre) {
sigma.layouts.dagre.start(this.state.sigmaInstance); sigma.layouts.dagre.start(this.state.sigmaInstance);
@ -337,9 +329,7 @@ export default class GraphContainer extends Component {
} }
reload(){ reload(){
if (appStore.currentTooltip !== null){ closeTooltip();
appStore.currentTooltip.close();
}
this.doQueryNative(this.state.currentQuery); this.doQueryNative(this.state.currentQuery);
} }
@ -616,9 +606,7 @@ export default class GraphContainer extends Component {
goBack() { goBack() {
if (appStore.queryStack.length > 0) { if (appStore.queryStack.length > 0) {
this.clearScale(); this.clearScale();
if (appStore.currentTooltip !== null) { closeTooltip();
appStore.currentTooltip.close();
}
sigma.layouts.stopForceLink(); sigma.layouts.stopForceLink();
let query = appStore.queryStack.pop(); let query = appStore.queryStack.pop();
@ -1005,9 +993,7 @@ export default class GraphContainer extends Component {
} }
doGenericQuery(statement, props, start, end, allowCollapse = true) { doGenericQuery(statement, props, start, end, allowCollapse = true) {
if (appStore.currentTooltip !== null) { closeTooltip()
appStore.currentTooltip.close();
}
if (typeof props === "undefined") { if (typeof props === "undefined") {
props = {}; props = {};
@ -1367,9 +1353,7 @@ export default class GraphContainer extends Component {
}) })
sigmaInstance.bind("clickStage", event => { sigmaInstance.bind("clickStage", event => {
if (appStore.currentTooltip !== null){ closeTooltip()
appStore.currentTooltip.close()
}
}) })
//Some key binds //Some key binds

View File

@ -105,9 +105,7 @@ export default class MenuContainer extends Component {
} }
_importClick() { _importClick() {
if (appStore.currentTooltip !== null){ closeTooltip()
appStore.currentTooltip.close();
}
var fname = dialog.showOpenDialog({ var fname = dialog.showOpenDialog({
properties: ["openFile"] properties: ["openFile"]
}); });

View File

@ -21,9 +21,7 @@ export default class AddEdgeModal extends Component {
} }
openModal() { openModal() {
if (appStore.currentTooltip !== null){ closeTooltip()
appStore.currentTooltip.close();
}
this.setState( {open: true }); this.setState( {open: true });
jQuery(this.refs.errora).hide(); jQuery(this.refs.errora).hide();
jQuery(this.refs.errorb).hide(); jQuery(this.refs.errorb).hide();

View File

@ -83,9 +83,7 @@ export default class AddNodeModal extends Component {
} }
openModal() { openModal() {
if (appStore.currentTooltip !== null){ closeTooltip()
appStore.currentTooltip.close();
}
this.setState( {open: true }); this.setState( {open: true });
jQuery(this.refs.name).focus() jQuery(this.refs.name).focus()
jQuery(this.refs.error).hide() jQuery(this.refs.error).hide()

View File

@ -19,7 +19,7 @@ export default class DeleteEdgeModal extends Component {
} }
openModal(id) { openModal(id) {
appStore.currentTooltip.close(); closeTooltip()
this.setState({ open: true, id: id }); this.setState({ open: true, id: id });
} }

View File

@ -19,9 +19,7 @@ export default class DeleteNodeModal extends Component {
} }
openModal(id) { openModal(id) {
if (appStore.currentTooltip !== null){ closeTooltip()
appStore.currentTooltip.close();
}
this.setState({ open: true, id: id }); this.setState({ open: true, id: id });
} }

View File

@ -41,7 +41,7 @@ export default class SearchContainer extends Component {
emitter.on( emitter.on(
"setStart", "setStart",
function (payload) { function (payload) {
appStore.currentTooltip.close() closeTooltip()
jQuery(this.refs.searchbar).val(payload); jQuery(this.refs.searchbar).val(payload);
}.bind(this) }.bind(this)
); );
@ -49,7 +49,7 @@ export default class SearchContainer extends Component {
emitter.on( emitter.on(
"setEnd", "setEnd",
function (payload) { function (payload) {
appStore.currentTooltip.close() closeTooltip()
jQuery(this.refs.pathbar).val(payload); jQuery(this.refs.pathbar).val(payload);
var e = jQuery(this.refs.pathfinding); var e = jQuery(this.refs.pathfinding);
if (!e.is(":visible")) { if (!e.is(":visible")) {

View File

@ -309,6 +309,12 @@ if (!existsSync(imagepath)){
mkdirSync(imagepath) mkdirSync(imagepath)
} }
global.closeTooltip = function(){
if (appStore.currentTooltip !== null){
appStore.currentTooltip.close();
}
}
renderEmit.on("login", function() { renderEmit.on("login", function() {
emitter.removeAllListeners(); emitter.removeAllListeners();
ReactDOM.unmountComponentAtNode(document.getElementById("root")); ReactDOM.unmountComponentAtNode(document.getElementById("root"));