Fix resolves

master
Rohan Vazarkar 2016-07-26 20:34:53 -04:00
parent d693573a6b
commit 501f43979e
9 changed files with 150 additions and 141 deletions

View File

@ -1,158 +1,162 @@
import React, { Component } from 'react';
import { collapseEdgeNodes, setNodeData, collapseSiblingNodes } from '../js/utils.js';
import { collapseEdgeNodes, setNodeData, collapseSiblingNodes } from 'utils';
export default class GraphContainer extends Component {
constructor(props){
super(props)
constructor(props){
super(props)
this.state = {
sigmaInstance : null,
design: null,
dragged: false
}
}
this.state = {
sigmaInstance : null,
design: null,
dragged: false
}
}
render() {
return (
<div id="graph" className="graph"></div>
);
}
render() {
return (
<div id="graph" className="graph"></div>
);
}
doQueryNative(params){
sigma.neo4j.cypher({
url: appStore.databaseInfo.url,
user: appStore.databaseInfo.user,
password: appStore.databaseInfo.password
},
params.statement,
this.state.sigmaInstance,
function(sigmaInstance){
var design = this.state.design;
sigmaInstance = setNodeData(this.state.sigmaInstance);
if (params.allowCollapse){
sigmaInstance = collapseEdgeNodes(sigmaInstance);
sigmaInstance = collapseSiblingNodes(sigmaInstance);
}
this.state.sigmaInstance = sigmaInstance
design.deprecate();
design.apply();
sigmaInstance.refresh();
this.state.design = design;
sigma.misc.animation.camera(sigmaInstance.camera, { x: 0, y: 0, ratio: 1.075 });
sigma.layouts.startForceLink()
}.bind(this))
}
doQueryNative(params){
sigma.neo4j.cypher({
url: appStore.databaseInfo.url,
user: appStore.databaseInfo.user,
password: appStore.databaseInfo.password
},
params.statement,
this.state.sigmaInstance,
function(sigmaInstance){
var design = this.state.design;
sigmaInstance = setNodeData(this.state.sigmaInstance);
if (params.allowCollapse){
sigmaInstance = collapseEdgeNodes(sigmaInstance);
sigmaInstance = collapseSiblingNodes(sigmaInstance);
}
this.state.sigmaInstance = sigmaInstance
design.deprecate();
design.apply();
sigmaInstance.refresh();
this.state.design = design;
sigma.misc.animation.camera(sigmaInstance.camera, { x: 0, y: 0, ratio: 1.075 });
sigma.layouts.startForceLink()
}.bind(this))
}
doQueryEvent(){
this.doQueryNative({
statement: 'MATCH (n:Group) WHERE n.name =~ "(?i).*DOMAIN ADMINS.*" WITH n MATCH (n)<-[r:MemberOf]-(m) RETURN n,r,m',
allowCollapse: false
})
}
doQueryEvent(){
this.doQueryNative({
statement: 'MATCH (n:Group) WHERE n.name =~ "(?i).*DOMAIN ADMINS.*" WITH n MATCH (n)<-[r:MemberOf]-(m) RETURN n,r,m',
allowCollapse: false
})
}
_nodeDragged(){
this.setState({dragged:true})
}
_nodeDragged(){
this.setState({dragged:true})
}
_nodeClicked(n){
if (!this.state.dragged){
if (n.data.node.type_user){
emitter.emit('userNodeClicked', n.data.node.label)
}
}else{
this.setState({dragged: false})
}
}
_nodeClicked(n){
if (!this.state.dragged){
if (n.data.node.type_user){
emitter.emit('userNodeClicked', n.data.node.label)
}
}else{
this.setState({dragged: false})
}
}
componentWillMount() {
emitter.on('query', this.doQueryEvent.bind(this))
}
componentWillMount() {
emitter.on('query', this.doQueryEvent.bind(this))
}
componentDidMount() {
//Sigma Initialization
var sigmaInstance, design;
sigma.renderers.def = sigma.renderers.canvas;
componentDidMount() {
//Sigma Initialization
var sigmaInstance, design;
sigma.renderers.def = sigma.renderers.canvas;
sigma.classes.graph.addMethod('outboundNodes', function(id) {
return this.outNeighborsIndex.get(id).keyList();
});
sigma.classes.graph.addMethod('outboundNodes', function(id) {
return this.outNeighborsIndex.get(id).keyList();
});
sigma.classes.graph.addMethod('inboundNodes', function(id) {
return this.inNeighborsIndex.get(id).keyList();
});
sigma.classes.graph.addMethod('inboundNodes', function(id) {
return this.inNeighborsIndex.get(id).keyList();
});
sigmaInstance = new sigma(
{
container: 'graph'
}
)
sigmaInstance = new sigma(
{
container: 'graph'
}
)
sigmaInstance.settings(
{
edgeColor: 'default',
nodeColor: 'default',
minEdgeSize: 1,
maxEdgeSize: 2.5,
iconThreshold: 4,
labelThreshold: 15,
labelAlignment: 'bottom',
labelColor: 'default',
font: 'Roboto',
glyphFillColor: 'black',
glyphTextColor: 'white',
glyphTextThreshold: 1,
zoomingRatio: 1.4
}
)
sigmaInstance.settings(
{
edgeColor: 'default',
nodeColor: 'default',
minEdgeSize: 1,
maxEdgeSize: 2.5,
iconThreshold: 4,
labelThreshold: 15,
labelAlignment: 'bottom',
labelColor: 'default',
font: 'Roboto',
glyphFillColor: 'black',
glyphTextColor: 'white',
glyphTextThreshold: 1,
zoomingRatio: 1.4
}
)
sigmaInstance.renderers[0].bind('render', function(e) {
sigmaInstance.renderers[0].glyphs();
});
sigmaInstance.renderers[0].bind('render', function(e) {
sigmaInstance.renderers[0].glyphs();
});
sigmaInstance.camera.bind('coordinatesUpdated', function(e){
if (e.target.ratio > 1.25){
sigmaInstance.settings('drawEdgeLabels', false);
}else{
sigmaInstance.settings('drawEdgeLabels', true);
}
})
sigmaInstance.camera.bind('coordinatesUpdated', function(e){
if (e.target.ratio > 1.25){
sigmaInstance.settings('drawEdgeLabels', false);
}else{
sigmaInstance.settings('drawEdgeLabels', true);
}
})
var dragListener = sigma.plugins.dragNodes(sigmaInstance,
sigmaInstance.renderers[0])
var dragListener = sigma.plugins.dragNodes(sigmaInstance,
sigmaInstance.renderers[0])
dragListener.bind('drag', this._nodeDragged.bind(this))
dragListener.bind('drag', this._nodeDragged.bind(this))
sigmaInstance.bind('clickNode', this._nodeClicked.bind(this))
sigmaInstance.bind('clickNode', this._nodeClicked.bind(this))
var fa = sigma.layouts.configForceLink(sigmaInstance, {
worker: true,
background: true,
easing: 'cubicInOut',
autoStop: true,
alignNodeSiblings: true,
barnesHutOptimize: true
});
var fa = sigma.layouts.configForceLink(sigmaInstance, {
worker: true,
background: true,
easing: 'cubicInOut',
autoStop: true,
alignNodeSiblings: true,
barnesHutOptimize: true
});
var lowgfx = appStore.performance.lowGraphics
fa.bind('stop', function(event) {
sigmaInstance.startNoverlap();
})
design = sigma.plugins.design(sigmaInstance);
if (lowgfx){
sigmaInstance.settings('defaultEdgeType', 'line');
sigmaInstance.settings('defaultEdgeColor', 'black');
design.setPalette(appStore.lowResPalette);
design.setStyles(appStore.lowResStyle);
}else{
sigmaInstance.settings('defaultEdgeType', 'tapered');
sigmaInstance.settings('defaultEdgeColor', '#356');
design.setPalette(appStore.highResPalette);
design.setStyles(appStore.highResStyle);
}
var lowgfx = appStore.performance.lowGraphics
this.state.sigmaInstance = sigmaInstance;
this.state.design = design;
this.doQueryNative({
statement: 'MATCH (n:Group) WHERE n.name =~ "(?i).*DOMAIN ADMINS.*" WITH n MATCH (n)<-[r:MemberOf]-(m) RETURN n,r,m',
allowCollapse: false
})
}
design = sigma.plugins.design(sigmaInstance);
if (lowgfx){
sigmaInstance.settings('defaultEdgeType', 'line');
sigmaInstance.settings('defaultEdgeColor', 'black');
design.setPalette(appStore.lowResPalette);
design.setStyles(appStore.lowResStyle);
}else{
sigmaInstance.settings('defaultEdgeType', 'tapered');
sigmaInstance.settings('defaultEdgeColor', '#356');
design.setPalette(appStore.highResPalette);
design.setStyles(appStore.highResStyle);
}
this.state.sigmaInstance = sigmaInstance;
this.state.design = design;
this.doQueryNative({
statement: 'MATCH (n:Group) WHERE n.name =~ "(?i).*DOMAIN ADMINS.*" WITH n MATCH (n)<-[r:MemberOf]-(m) RETURN n,r,m',
allowCollapse: false
})
}
}

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import GlyphiconSpan from '../glyphiconspan'
import Icon from '../icon'
import { escapeRegExp } from '../../js/utils.js';
import { escapeRegExp } from 'utils';
import TabContainer from './tabcontainer'
export default class SearchContainer extends Component {

View File

@ -1,8 +1,8 @@
import React, { Component } from 'react';
import DatabaseDataDisplay from './databasedatadisplay'
import PrebuiltQueriesDisplay from './prebuiltqueriesdisplay'
import NoNodeData from './nonodedata'
import UserNodeData from './usernodedata'
import DatabaseDataDisplay from './Tabs/databasedatadisplay'
import PrebuiltQueriesDisplay from './Tabs/prebuiltqueriesdisplay'
import NoNodeData from './Tabs/nonodedata'
import UserNodeData from './Tabs/usernodedata'
import { Tabs, Tab } from 'react-bootstrap';
export default class TabContainer extends Component {

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { defaultAjaxSettings } from '../../js/utils.js';
import LogoutModal from '../Modals/logoutmodal';
import { defaultAjaxSettings } from 'utils';
import LogoutModal from 'modals/logoutmodal';
export default class DatabaseDataDisplay extends Component {
constructor(){

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import NodeALink from './nodealink'
import { fullAjax } from '../../js/utils.js'
import { fullAjax } from 'utils'
export default class UserNodeData extends Component {
propTypes: {

View File

@ -1,5 +1,6 @@
var webpack = require('webpack');
var webpackTargetElectronRenderer = require('webpack-target-electron-renderer');
var path = require('path')
var config = {
entry: [
@ -20,6 +21,10 @@ var config = {
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
utils: path.resolve(__dirname, 'src', 'js', 'utils.js'),
modals: path.resolve(__dirname, 'src', 'components', 'Modals')
}
},
plugins: [
new webpack.HotModuleReplacementPlugin(),