Skip to content

Commit

Permalink
Misc icon fixes and toBoolean
Browse files Browse the repository at this point in the history
  • Loading branch information
rvazarkar committed Mar 15, 2018
1 parent 4f946b3 commit 1455854
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/components/Float/QueryNodeSelectItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class QueryNodeSelectItem extends Component {
}.bind(this);
return (
<ListGroupItem href="#" onClick={c}>
{this.props.label}
{this.props.label}
</ListGroupItem>
);
}
Expand Down
14 changes: 13 additions & 1 deletion src/components/SearchContainer/SearchContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class SearchContainer extends Component {
emitter.on('setEnd', function (payload) {
jQuery(this.refs.pathbar).val(payload);
var e = jQuery(this.refs.pathfinding);
if (!(e.is(":visible"))) {
if (! e.is(":visible")) {
e.slideToggle();
}
}.bind(this));
Expand Down Expand Up @@ -84,6 +84,12 @@ export default class SearchContainer extends Component {
case "Domain":
icon = "<i style=\"float:right\" class=\"fa fa-globe\"></i>";
break;
case "Gpo":
icon = "<i style=\"float:right\" class=\"fa fa-list\"></i>";
break;
case "Ou":
icon = "<i style=\"float:right\" class=\"fa fa-sitemap\"></i>";
break;
}

html = '<div>' + parts[0] + ' ' + icon + '</div>';
Expand Down Expand Up @@ -145,6 +151,12 @@ export default class SearchContainer extends Component {
case "Domain":
icon = "<i class=\"fa fa-globe\"></i>";
break;
case "Gpo":
icon = "<i style=\"float:right\" class=\"fa fa-list\"></i>";
break;
case "Ou":
icon = "<i style=\"float:right\" class=\"fa fa-sitemap\"></i>";
break;
}

html = '<div>' + parts[0] + ' ' + icon + '</div>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class PrebuiltQueriesDisplay extends Component {
</h3>
<div className="query-box">
{this.state.queries.map(function(a){
return <PrebuiltQueryNode key={a.name} info={a} />;
return <PrebuiltQueryNode key={a.name} info={a} />
})}
</div>
<h3>
Expand All @@ -103,7 +103,7 @@ export default class PrebuiltQueriesDisplay extends Component {
<Else>{() =>
<div>
{this.state.custom.map(function(a){
return <PrebuiltQueryNode key={a.name} info={a} />;
return <PrebuiltQueryNode key={a.name} info={a} />
})}
</div>
}
Expand Down
128 changes: 64 additions & 64 deletions src/components/Spotlight/SpotlightContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
import React, { Component } from 'react';
import GlyphiconSpan from '../GlyphiconSpan';
import Icon from '../Icon';
import SpotlightRow from './SpotlightRow'
import SpotlightRow from './SpotlightRow';

export default class SpotlightContainer extends Component {
constructor(props){
super(props);
this.state = {
data: appStore.spotlightData,
searchVal: "",
rex: new RegExp("", 'i')
}
constructor(props){
super(props);
this.state = {
data: appStore.spotlightData,
searchVal: "",
rex: new RegExp("", 'i')
};

emitter.on('spotlightUpdate', function(){
this.setState({data: appStore.spotlightData})
}.bind(this))
emitter.on('spotlightUpdate', function(){
this.setState({data: appStore.spotlightData});
}.bind(this));

emitter.on('spotlightClick', function(){
$(this.refs.spotlight).fadeToggle(false)
}.bind(this))
emitter.on('spotlightClick', function(){
$(this.refs.spotlight).fadeToggle(false);
}.bind(this));

emitter.on('resetSpotlight', function(){
this.setState({
searchVal: "",
rex: new RegExp("", 'i')
})
emitter.on('resetSpotlight', function(){
this.setState({
searchVal: "",
rex: new RegExp("", 'i')
});

}.bind(this))
}
}.bind(this));
}

_searchChanged(event){
this.setState({
searchVal: event.target.value,
rex: new RegExp(event.target.value, 'i')
})
}
_searchChanged(event){
this.setState({
searchVal: event.target.value,
rex: new RegExp(event.target.value, 'i')
});
}

render() {
render() {

return (
<div ref="spotlight" className="spotlight">
<div className="input-group input-group-unstyled no-border-radius">
<GlyphiconSpan tooltip={false} classes="input-group-addon spanfix">
<Icon glyph="search" />
</GlyphiconSpan>
<input onChange={this._searchChanged.bind(this)} value={this.state.searchVal} type="search" className="form-control searchbox" autoComplete="off" placeholder="Explore Nodes" data-type="search" />
</div>
return (
<div ref="spotlight" className="spotlight">
<div className="input-group input-group-unstyled no-border-radius">
<GlyphiconSpan tooltip={false} classes="input-group-addon spanfix">
<Icon glyph="search" />
</GlyphiconSpan>
<input onChange={this._searchChanged.bind(this)} value={this.state.searchVal} type="search" className="form-control searchbox" autoComplete="off" placeholder="Explore Nodes" data-type="search" />
</div>

<div className="spotlight-nodelist">
<table data-role="table" className="table table-striped">
<thead>
<tr>
<td>Node Label</td>
<td>Collapsed Into</td>
</tr>
</thead>
<tbody ref="spotlight-tbody" className="searchable">
{Object.keys(this.state.data).map(function(key){
var d = this.state.data[key]
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
}.bind(this))}
</tbody>
</table>
</div>
</div>
);
}
<div className="spotlight-nodelist">
<table data-role="table" className="table table-striped">
<thead>
<tr>
<td>Node Label</td>
<td>Collapsed Into</td>
</tr>
</thead>
<tbody ref="spotlight-tbody" className="searchable">
{Object.keys(this.state.data).map(function(key){
var d = this.state.data[key];
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;
}.bind(this))}
</tbody>
</table>
</div>
</div>
);
}

componentDidMount() {
jQuery(this.refs.spotlight).fadeToggle(0)
componentDidMount() {
jQuery(this.refs.spotlight).fadeToggle(0);

$(window).on('keyup', function(e){
var key = e.keyCode ? e.keyCode : e.which
$(window).on('keyup', function(e){
var key = e.keyCode ? e.keyCode : e.which;

if (document.activeElement === document.body && key === 32){
$(this.refs.spotlight).fadeToggle();
}
}.bind(this))
}
}.bind(this));
}
}
122 changes: 67 additions & 55 deletions src/components/Spotlight/SpotlightRow.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,75 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types'
import PropTypes from 'prop-types';

export default class SpotlightRow extends Component {
_handleClick(){
emitter.emit('spotlightClick', this.props.nodeId, this.props.parentNodeId)
}
_handleClick(){
emitter.emit('spotlightClick', this.props.nodeId, this.props.parentNodeId);
}

render() {
var nodeIcon = "";
var parentIcon = "";
switch (this.props.nodeType){
case "Group":
nodeIcon = "fa fa-users"
break;
case "User":
nodeIcon = "fa fa-user"
break;
case "Computer":
nodeIcon = "fa fa-desktop"
break;
case "Domain":
nodeIcon = "fa fa-globe"
break
default:
nodeIcon = ""
break;
}
render() {
var nodeIcon = "";
var parentIcon = "";
switch (this.props.nodeType){
case "Group":
nodeIcon = "fa fa-users";
break;
case "User":
nodeIcon = "fa fa-user";
break;
case "Computer":
nodeIcon = "fa fa-desktop";
break;
case "Domain":
nodeIcon = "fa fa-globe";
break;
case "Ou":
nodeIcon = "fa fa-sitemap";
break;
case "Gpo":
nodeIcon = "fa fa-list";
break;
default:
nodeIcon = "";
break;
}

switch (this.props.parentNodeType){
case "Group":
parentIcon = "fa fa-users"
break;
case "User":
parentIcon = "fa fa-user"
break;
case "Computer":
parentIcon = "fa fa-desktop"
break;
case "Domain":
parentIcon = "fa fa-globe"
break
default:
parentIcon = ""
break;
}
return (
<tr style={{cursor: 'pointer'}} onClick={this._handleClick.bind(this)} data-id={this.props.nodeId} data-parent-id={this.props.parentNodeId}>
<td>{this.props.nodeLabel} <i className={nodeIcon}></i></td>
<td>{this.props.parentNodeLabel} <i className={parentIcon}></i></td>
</tr>
);
}
switch (this.props.parentNodeType){
case "Group":
parentIcon = "fa fa-users";
break;
case "User":
parentIcon = "fa fa-user";
break;
case "Computer":
parentIcon = "fa fa-desktop";
break;
case "Domain":
parentIcon = "fa fa-globe";
break;
case "Ou":
nodeIcon = "fa fa-sitemap";
break;
case "Gpo":
nodeIcon = "fa fa-list";
break;
default:
parentIcon = "";
break;
}
return (
<tr style={{cursor: 'pointer'}} onClick={this._handleClick.bind(this)} data-id={this.props.nodeId} data-parent-id={this.props.parentNodeId}>
<td>{this.props.nodeLabel} <i className={nodeIcon}></i></td>
<td>{this.props.parentNodeLabel} <i className={parentIcon}></i></td>
</tr>
);
}
}

SpotlightRow.propTypes = {
nodeId : PropTypes.number.isRequired,
parentNodeId : PropTypes.number.isRequired,
nodeLabel : PropTypes.string.isRequired,
parentNodeLabel : PropTypes.string.isRequired,
nodeType: PropTypes.string.isRequired,
parentNodeType: PropTypes.string.isRequired
}
nodeId : PropTypes.number.isRequired,
parentNodeId : PropTypes.number.isRequired,
nodeLabel : PropTypes.string.isRequired,
parentNodeLabel : PropTypes.string.isRequired,
nodeType: PropTypes.string.isRequired,
parentNodeType: PropTypes.string.isRequired
};
4 changes: 2 additions & 2 deletions src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export function buildStructureProps(rows){
});
}else{
datadict[hash] = {
statement: 'UNWIND {props} AS prop MERGE (a:{} {name:prop.container}) WITH a,prop MERGE (b:{} {name: prop.object}) WITH a,b,prop MERGE (a)-[r:Contains {isACL: false}]->(b) SET a.blocksInheritance=prop.blocksInheritance, a.domain=prop.containerDomain, b.domain=prop.objectDomain'.format(atype, btype),
statement: 'UNWIND {props} AS prop MERGE (a:{} {name:prop.container}) WITH a,prop MERGE (b:{} {name: prop.object}) WITH a,b,prop MERGE (a)-[r:Contains {isACL: false}]->(b) SET a.blocksInheritance=toBoolean(prop.blocksInheritance), a.domain=prop.containerDomain, b.domain=prop.objectDomain'.format(atype, btype),
props: [{
container: container,
object: object,
Expand Down Expand Up @@ -326,7 +326,7 @@ export function buildGplinkProps(rows){
});
}else{
datadict[type] = {
statement: 'UNWIND {props} as prop MERGE (a:Gpo {name: prop.gponame}) WITH a,prop MERGE (b:{} {name: prop.objectname}) WITH a,b,prop MERGE (a)-[r:GpLink {enforced: prop.enforced, isACL: false}]->(b) SET a.domain=prop.gpoDomain,b.domain=prop.objectDomain'.format(type),
statement: 'UNWIND {props} as prop MERGE (a:Gpo {name: prop.gponame}) WITH a,prop MERGE (b:{} {name: prop.objectname}) WITH a,b,prop MERGE (a)-[r:GpLink {enforced: toBoolean(prop.enforced), isACL: false}]->(b) SET a.domain=prop.gpoDomain,b.domain=prop.objectDomain'.format(type),
props:[{
gponame: gpoName,
objectname: objectName,
Expand Down

0 comments on commit 1455854

Please sign in to comment.