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() {
if (appStore.currentTooltip !== null){
appStore.currentTooltip.close();
}
closeTooltip();
$(this.refs.outer).fadeToggle(true);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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