Update lots of stuff

master
Rohan Vazarkar 2017-05-15 14:37:36 -04:00
parent 73fa4260c3
commit 5844ff5a82
17 changed files with 118 additions and 119 deletions

View File

@ -36,35 +36,36 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.22.2", "babel-cli": "^6.22.2",
"babel-core": "^6.22.1", "babel-core": "^6.22.1",
"babel-loader": "^6.2.4", "babel-loader": "^7.0.0",
"babel-polyfill": "^6.22.0", "babel-polyfill": "^6.22.0",
"babel-preset-es2015": "^6.22.0", "babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0", "babel-preset-react": "^6.22.0",
"babel-preset-stage-0": "^6.22.0", "babel-preset-stage-0": "^6.22.0",
"concurrently": "^3.1.0", "concurrently": "^3.1.0",
"cross-env": "^3.1.4", "cross-env": "^5.0.0",
"electron": "^1.4.15", "electron": "^1.4.15",
"express": "^4.14.0", "express": "^4.14.0",
"webpack": "^1.13.1", "webpack": "^2.5.1",
"webpack-dev-middleware": "^1.6.1", "webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.12.1", "webpack-hot-middleware": "^2.12.1"
"webpack-target-electron-renderer": "^0.4.0"
}, },
"dependencies": { "dependencies": {
"async": "^2.1.4", "async": "^2.1.4",
"bootstrap": "^3.3.6", "bootstrap": "^3.3.6",
"bootstrap-3-typeahead": "^4.0.1", "bootstrap-3-typeahead": "^4.0.1",
"configstore": "^2.1.0",
"dagre": "^0.7.4", "dagre": "^0.7.4",
"eventemitter2": "^2.2.2", "eventemitter2": "^2.2.2",
"jquery": "^2.2.4", "jquery": "^2.2.4",
"eventemitter2": "^4.1.0",
"jquery": "^3.2.1",
"linkurious": "^1.5.1", "linkurious": "^1.5.1",
"mustache": "^2.2.1", "mustache": "^2.2.1",
"neo4j-driver": "^1.1.0", "neo4j-driver": "*",
"prop-types": "^15.5.10",
"react": "^15.4.2", "react": "^15.4.2",
"react-addons-css-transition-group": "^15.4.2", "react-bootstrap": "^0.31.0",
"react-bootstrap": "^0.30.3",
"react-dom": "^15.4.2", "react-dom": "^15.4.2",
"react-if": "^2.1.0" "react-if": "^2.1.0",
"react-transition-group": "^1.1.3"
} }
} }

View File

@ -16,17 +16,13 @@ import Settings from './components/Float/Settings'
import ZoomContainer from './components/Zoom/ZoomContainer' import ZoomContainer from './components/Zoom/ZoomContainer'
import QueryNodeSelect from './components/Float/QueryNodeSelect' import QueryNodeSelect from './components/Float/QueryNodeSelect'
import SessionClearModal from './components/Modals/SessionClearModal' import SessionClearModal from './components/Modals/SessionClearModal'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group' import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup'
import About from './components/Modals/About.jsx' import About from './components/Modals/About.jsx'
export default class AppContainer extends Component { export default class AppContainer extends Component {
constructor(){
super();
}
render() { render() {
return ( return (
<ReactCSSTransitionGroup transitionName="mainfade" <CSSTransitionGroup transitionName="mainfade"
transitionAppear={true} transitionAppear={true}
transitionAppearTimeout={1000} transitionAppearTimeout={1000}
transitionEnter={false} transitionEnter={false}
@ -51,7 +47,7 @@ export default class AppContainer extends Component {
<QueryNodeSelect /> <QueryNodeSelect />
<About /> <About />
</div> </div>
</ReactCSSTransitionGroup> </CSSTransitionGroup>
); );
}; };
} }

View File

@ -39,23 +39,15 @@ export default class Login extends Component {
icon.removeClass(); icon.removeClass();
icon.addClass("fa fa-spinner fa-spin form-control-feedback"); icon.addClass("fa fa-spinner fa-spin form-control-feedback");
icon.toggle(true); icon.toggle(true);
var driver = neo4j.driver(url) var driver = neo4j.driver(url, neo4j.auth.basic("",""), {encrypted:'ENCRYPTION_ON'})
var session = driver.session();
driver.onCompleted = function(){ driver.onCompleted = function(){
session.close()
driver.close() driver.close()
} }
driver.onError = function(error){ driver.onError = function(error){
if (error.message && error.message.includes("encryption certificate has changed")){ if (error.message.includes("authentication failure")){
var path = error.message.match("`(.*?)`")[1]
icon.removeClass();
icon.addClass("fa fa-times-circle red-icon-color form-control-feedback");
icon.attr('data-original-title', 'Certificate error - delete localhost line in {}'.format(path))
.tooltip('fixTitle')
.tooltip('show')
this.setState({
loginInProgress: false,
loginEnabled: false
})
}else if (error.fields && error.fields[0].code === "Neo.ClientError.Security.Unauthorized"){
icon.removeClass(); icon.removeClass();
icon.addClass("fa fa-check-circle green-icon-color form-control-feedback"); icon.addClass("fa fa-check-circle green-icon-color form-control-feedback");
this.setState({loginEnabled: true, url: url}) this.setState({loginEnabled: true, url: url})
@ -70,9 +62,10 @@ export default class Login extends Component {
loginEnabled: false loginEnabled: false
}) })
} }
session.close()
driver.close() driver.close()
}.bind(this) }.bind(this)
driver.session(); session.run("return 1")
} }
checkDBCreds(){ checkDBCreds(){
@ -89,7 +82,8 @@ export default class Login extends Component {
var driver = neo4j.driver(this.state.url, neo4j.auth.basic(this.state.user, this.state.password)) var driver = neo4j.driver(this.state.url, neo4j.auth.basic(this.state.user, this.state.password))
driver.onError = function(error){ driver.onError = function(error){
if (error.fields && error.fields[0].code === "Neo.ClientError.Security.Unauthorized"){ console.log(error)
if (error.message.includes("authentication failure")){
btn.removeClass('activate'); btn.removeClass('activate');
this.setState({ this.setState({
loginInProgress: false, loginInProgress: false,
@ -98,7 +92,7 @@ export default class Login extends Component {
pwf.attr('data-original-title', 'Invalid username or password') pwf.attr('data-original-title', 'Invalid username or password')
.tooltip('fixTitle') .tooltip('fixTitle')
.tooltip('show') .tooltip('show')
}else if (error.fields && error.fields[0].code === "Neo.ClientError.Security.AuthenticationRateLimit"){ }else if (error.message.includes("too many times in a row")){
btn.removeClass('activate'); btn.removeClass('activate');
this.setState({ this.setState({
loginInProgress: false, loginInProgress: false,
@ -107,24 +101,6 @@ export default class Login extends Component {
pwf.attr('data-original-title', 'Too many authentication attempts, please wait') pwf.attr('data-original-title', 'Too many authentication attempts, please wait')
.tooltip('fixTitle') .tooltip('fixTitle')
.tooltip('show') .tooltip('show')
}else if (error.message && error.message.includes("encryption certificate has changed")){
var path = error.message.match("`(.*?)`")[1]
var icon = this.state.icon
icon.toggle('true')
icon.removeClass();
icon.addClass("fa fa-times-circle red-icon-color form-control-feedback");
jQuery(icon).tooltip({
placement : 'right',
title: 'Certificate error - delete localhost line in ' + path,
container: 'body',
delay: {show: 200, hide: 0},
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner tooltip-inner-custom"></div></div>'
})
this.setState({
loginInProgress: false,
loginEnabled: false
})
jQuery(icon).tooltip('show')
}else if (error.toString().includes('ECONNREFUSED')){ }else if (error.toString().includes('ECONNREFUSED')){
var icon = this.state.icon var icon = this.state.icon
icon.toggle('true') icon.toggle('true')

View File

@ -1,15 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { If, Then, Else } from 'react-if'; import { If, Then, Else } from 'react-if';
import PropTypes from 'prop-types'
export default class GlyphiconSpan extends Component { export default class GlyphiconSpan extends Component {
propTypes: {
classes : React.PropTypes.string,
tooltipDir : React.PropTypes.string,
tooltipTitle : React.PropTypes.string,
tooltip : React.PropTypes.bool.isRequired,
click: React.PropTypes.func
}
constructor(props){ constructor(props){
super(props); super(props);
} }
@ -31,3 +24,11 @@ export default class GlyphiconSpan extends Component {
); );
} }
} }
GlyphiconSpan.propTypes = {
classes : React.PropTypes.string,
tooltipDir : React.PropTypes.string,
tooltipTitle : React.PropTypes.string,
tooltip : React.PropTypes.bool.isRequired,
click: React.PropTypes.func
}

View File

@ -778,6 +778,7 @@ export default class GraphContainer extends Component {
}, this); }, this);
if (!needsfix){ if (!needsfix){
emitter.emit('updateLoadingText', 'Done!'); emitter.emit('updateLoadingText', 'Done!');
sigma.canvas.edges.autoCurve(sigmaInstance)
setTimeout(function(){ setTimeout(function(){
emitter.emit('showLoadingIndicator', false); emitter.emit('showLoadingIndicator', false);
}, 1500) }, 1500)
@ -801,6 +802,7 @@ export default class GraphContainer extends Component {
noverlapListener.bind('stop', function(event) { noverlapListener.bind('stop', function(event) {
emitter.emit('updateLoadingText', 'Done!'); emitter.emit('updateLoadingText', 'Done!');
sigma.canvas.edges.autoCurve(sigmaInstance)
setTimeout(function(){ setTimeout(function(){
emitter.emit('showLoadingIndicator', false); emitter.emit('showLoadingIndicator', false);
}, 1500) }, 1500)

View File

@ -1,11 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'
export default class Icon extends Component { export default class Icon extends Component {
propTypes: {
glyph : React.PropTypes.string.isRequired,
extraClass : React.PropTypes.string
}
constructor(props){ constructor(props){
super(props); super(props);
} }
@ -16,3 +12,8 @@ export default class Icon extends Component {
); );
} }
} }
Icon.propTypes = {
glyph : React.PropTypes.string.isRequired,
extraClass : React.PropTypes.string
}

View File

@ -1,12 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'
export default class MenuButton extends Component { export default class MenuButton extends Component {
propTypes: {
hoverVal : React.PropTypes.string.isRequired,
glyphicon : React.PropTypes.string.isRequired,
click : React.PropTypes.func.isRequired
}
_leave(e){ _leave(e){
var target = $(e.target) var target = $(e.target)
target.css('width', 'auto') target.css('width', 'auto')
@ -44,3 +39,9 @@ export default class MenuButton extends Component {
); );
} }
} }
MenuButton.propTypes = {
hoverVal : React.PropTypes.string.isRequired,
glyphicon : React.PropTypes.string.isRequired,
click : React.PropTypes.func.isRequired
}

View File

@ -1,11 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'
export default class ProgressBarMenuButton extends Component { export default class ProgressBarMenuButton extends Component {
propTypes: {
progress : React.PropTypes.number.isRequired,
click : React.PropTypes.func.isRequired
}
constructor(){ constructor(){
super() super()
@ -77,3 +73,8 @@ export default class ProgressBarMenuButton extends Component {
); );
} }
} }
ProgressBarMenuButton.propTypes = {
progress : React.PropTypes.number.isRequired,
click : React.PropTypes.func.isRequired
}

View File

@ -1,12 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import NodeALink from './NodeALink.jsx' import NodeALink from './NodeALink.jsx'
import LoadLabel from './LoadLabel.jsx' import LoadLabel from './LoadLabel.jsx'
import PropTypes from 'prop-types'
export default class DomainNodeData extends Component { export default class DomainNodeData extends Component {
propTypes: {
visible : React.PropTypes.bool.isRequired
}
constructor(){ constructor(){
super(); super();
@ -224,3 +221,7 @@ export default class DomainNodeData extends Component {
); );
} }
} }
DomainNodeData.propTypes = {
visible : React.PropTypes.bool.isRequired
}

View File

@ -1,11 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import NodeALink from './NodeALink' import NodeALink from './NodeALink'
import PropTypes from 'prop-types'
export default class GroupNodeData extends Component { export default class GroupNodeData extends Component {
propTypes: {
visible : React.PropTypes.bool.isRequired
}
constructor(){ constructor(){
super(); super();
@ -385,3 +382,7 @@ export default class GroupNodeData extends Component {
); );
} }
} }
GroupNodeData.propTypes = {
visible : React.PropTypes.bool.isRequired
}

View File

@ -1,11 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { If, Then, Else } from 'react-if'; import { If, Then, Else } from 'react-if';
import PropTypes from 'prop-types'
export default class LoadLabel extends Component { export default class LoadLabel extends Component {
propTypes: {
ready : React.PropTypes.bool.isRequired,
value : React.PropTypes.number
}
constructor(props){ constructor(props){
super(props); super(props);
} }
@ -24,3 +21,8 @@ export default class LoadLabel extends Component {
); );
} }
} }
LoadLabel.propTypes = {
ready : React.PropTypes.bool.isRequired,
value : React.PropTypes.number
}

View File

@ -1,10 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'
export default class NoNodeData extends Component { export default class NoNodeData extends Component {
propTypes: {
visible : React.PropTypes.bool.isRequired
}
render() { render() {
return ( return (
<div className={this.props.visible ? "" : "hidden"}> <div className={this.props.visible ? "" : "hidden"}>
@ -18,3 +15,8 @@ export default class NoNodeData extends Component {
); );
} }
} }
NoNodeData.propTypes = {
visible : React.PropTypes.bool.isRequired
}

View File

@ -1,12 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { If, Then, Else } from 'react-if'; import { If, Then, Else } from 'react-if';
import PropTypes from 'prop-types'
export default class NodeALink extends Component { export default class NodeALink extends Component {
propTypes: {
ready : React.PropTypes.bool.isRequired,
click : React.PropTypes.func,
value : React.PropTypes.number
}
constructor(props){ constructor(props){
super(props); super(props);
} }
@ -25,3 +21,9 @@ export default class NodeALink extends Component {
); );
} }
} }
NodeALink.propTypes = {
ready : React.PropTypes.bool.isRequired,
click : React.PropTypes.func,
value : React.PropTypes.number
}

View File

@ -1,11 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import NodeALink from './NodeALink' import NodeALink from './NodeALink'
import PropTypes from 'prop-types'
export default class UserNodeData extends Component { export default class UserNodeData extends Component {
propTypes: {
visible : React.PropTypes.bool.isRequired
}
constructor(){ constructor(){
super(); super();
@ -353,3 +350,7 @@ export default class UserNodeData extends Component {
); );
} }
} }
UserNodeData.propTypes = {
visible : React.PropTypes.bool.isRequired
}

View File

@ -59,7 +59,8 @@ export default class SpotlightContainer extends Component {
<tbody ref="spotlight-tbody" className="searchable"> <tbody ref="spotlight-tbody" className="searchable">
{Object.keys(this.state.data).map(function(key){ {Object.keys(this.state.data).map(function(key){
var d = this.state.data[key] var d = this.state.data[key]
var x = this.state.rex.test(d[0]) ? <SpotlightRow key={key} nodeId={key} parentNodeId={d[1]} nodeLabel={d[0]} parentNodeLabel={d[2]} nodeType={d[3]} parentNodeType={d[4]} /> : null var nid = parseInt(key)
var x = this.state.rex.test(d[0]) ? <SpotlightRow key={key} nodeId={nid} parentNodeId={d[1]} nodeLabel={d[0]} parentNodeLabel={d[2]} nodeType={d[3]} parentNodeType={d[4]} /> : null
return x return x
}.bind(this))} }.bind(this))}
</tbody> </tbody>

View File

@ -1,15 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'
export default class SpotlightRow extends Component { export default class SpotlightRow extends Component {
propTypes: {
nodeId : React.PropTypes.number.isRequired,
parentNodeId : React.PropTypes.number.isRequired,
nodeLabel : React.PropTypes.string.isRequired,
parentNodeLabel : React.PropTypes.string.isRequired,
nodeType: React.PropTypes.string.isRequired,
parentNodeType: React.PropTypes.string.isRequired
}
_handleClick(){ _handleClick(){
emitter.emit('spotlightClick', this.props.nodeId, this.props.parentNodeId) emitter.emit('spotlightClick', this.props.nodeId, this.props.parentNodeId)
} }
@ -60,3 +52,12 @@ export default class SpotlightRow extends Component {
); );
} }
} }
SpotlightRow.propTypes = {
nodeId : React.PropTypes.number.isRequired,
parentNodeId : React.PropTypes.number.isRequired,
nodeLabel : React.PropTypes.string.isRequired,
parentNodeLabel : React.PropTypes.string.isRequired,
nodeType: React.PropTypes.string.isRequired,
parentNodeType: React.PropTypes.string.isRequired
}

View File

@ -1,15 +1,27 @@
var webpack = require('webpack'); var webpack = require('webpack');
var webpackTargetElectronRenderer = require('webpack-target-electron-renderer');
var path = require('path') var path = require('path')
var config = { var config = {
target: 'electron-renderer',
externals: [{
'electron-config': 'electron-config'
}],
entry: [ entry: [
'webpack-hot-middleware/client?reload=true&path=http://localhost:9000/__webpack_hmr', 'webpack-hot-middleware/client?reload=true&path=http://localhost:9000/__webpack_hmr',
'./src/index', './src/index',
], ],
module: { module: {
loaders: [{test: /\.jsx?$/,loaders: ['babel-loader'], exclude: /node_modules/ rules: [
}] {
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
}
}
}
]
}, },
output: { output: {
path: __dirname + '/dist', path: __dirname + '/dist',
@ -17,7 +29,7 @@ var config = {
filename: 'bundle.js' filename: 'bundle.js'
}, },
resolve: { resolve: {
extensions: ['', '.js', '.jsx'], extensions: ['.js', '.jsx'],
alias: { alias: {
utils: path.resolve(__dirname, 'src', 'js', 'utils.js'), utils: path.resolve(__dirname, 'src', 'js', 'utils.js'),
modals: path.resolve(__dirname, 'src', 'components', 'Modals') modals: path.resolve(__dirname, 'src', 'components', 'Modals')
@ -31,7 +43,4 @@ var config = {
__filename: false __filename: false
} }
}; };
config.target = webpackTargetElectronRenderer(config);
module.exports = config; module.exports = config;