diff --git a/src/components/SearchContainer/Tabs/ComputerNodeData.jsx b/src/components/SearchContainer/Tabs/ComputerNodeData.jsx index 14b1477..7512177 100644 --- a/src/components/SearchContainer/Tabs/ComputerNodeData.jsx +++ b/src/components/SearchContainer/Tabs/ComputerNodeData.jsx @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import NodeALink from './NodeALink'; import PropTypes from 'prop-types'; +import NodeProps from './NodeProps'; export default class ComputerNodeData extends Component { constructor(){ @@ -21,7 +22,9 @@ export default class ComputerNodeData extends Component { transitiveControl: -1, derivativeLocalAdmins: -1, driversessions: [], - propertyMap: {} + propertyMap: {}, + ServicePrincipalNames: [], + displayMap: { "OperatingSystem": "OS", "Enabled": "Enabled", "UnconstrainedDelegation": "Allows Unconstrained Delegation"} }; emitter.on('computerNodeClicked', this.getNodeData.bind(this)); @@ -183,24 +186,7 @@ export default class ComputerNodeData extends Component {
{this.state.label}
-
- OS -
-
- {this.convertToDisplayProp("OperatingSystem")} -
-
- Enabled -
-
- {this.convertToDisplayProp("Enabled")} -
-
- Allows Unconstrained Delegation -
-
- {this.convertToDisplayProp("UnconstrainedDelegation")} -
+
Sessions
diff --git a/src/components/SearchContainer/Tabs/NodeALink.jsx b/src/components/SearchContainer/Tabs/NodeALink.jsx index 9d06bf3..f4e7165 100644 --- a/src/components/SearchContainer/Tabs/NodeALink.jsx +++ b/src/components/SearchContainer/Tabs/NodeALink.jsx @@ -1,29 +1,29 @@ import React, { Component } from 'react'; import { If, Then, Else } from 'react-if'; -import PropTypes from 'prop-types' +import PropTypes from 'prop-types'; export default class NodeALink extends Component { - constructor(props){ - super(props); - } - render() { - return ( - - {this.props.value} - {() => -
-
-
-
-
- }
-
- ); - } + constructor(props){ + super(props); + } + render() { + return ( + + {this.props.value} + {() => +
+
+
+
+
+ } + + ); + } } NodeALink.propTypes = { - ready : PropTypes.bool.isRequired, - click : PropTypes.func, - value : PropTypes.number + ready : PropTypes.bool.isRequired, + click : PropTypes.func, + value : PropTypes.number } \ No newline at end of file diff --git a/src/components/SearchContainer/Tabs/NodeProps.jsx b/src/components/SearchContainer/Tabs/NodeProps.jsx new file mode 100644 index 0000000..e980710 --- /dev/null +++ b/src/components/SearchContainer/Tabs/NodeProps.jsx @@ -0,0 +1,51 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; + +export default class componentName extends Component { + constructor(props){ + super(props); + } + + convertToDisplayProp(propName) { + var obj = this.props.properties[propName]; + var type = typeof obj; + if (type === 'undefined') { + return null; + } else if (obj.hasOwnProperty('low')) { + var t = obj.low; + if (t === 0) { + return "Never"; + } else { + return new Date(obj.low * 1000).toUTCString(); + } + } else if (type === 'boolean') { + return obj.toString().toTitleCase(); + } else if (obj === "") { + return null; + } else { + return obj; + } + } + + render() { + let l = []; + + $.each(this.props.displayMap, function(key, value){ + let val = this.convertToDisplayProp(key); + + if (val !== null){ + l.push(
{value}
); + l.push(
{val}
); + } + }.bind(this)); + + if (this.props.ServicePrincipalNames.length > 0){ + l.push(
Service Principal Names
); + $.each(this.props.ServicePrincipalNames, function(index, value){ + l.push(
{value}
); + }); + } + + return l; + } +} \ No newline at end of file diff --git a/src/components/SearchContainer/Tabs/UserNodeData.jsx b/src/components/SearchContainer/Tabs/UserNodeData.jsx index 7bb466c..c53b58a 100644 --- a/src/components/SearchContainer/Tabs/UserNodeData.jsx +++ b/src/components/SearchContainer/Tabs/UserNodeData.jsx @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import NodeALink from './NodeALink'; import NodePropItem from './NodePropItem'; import PropTypes from 'prop-types'; +import NodeProps from './NodeProps'; import { If, Then, Else } from 'react-if'; @@ -25,7 +26,9 @@ export default class UserNodeData extends Component { unrolledControl: -1, transitiveControl: -1, driversessions : [], - propertyMap: {ServicePrincipalNames: []} + propertyMap: {}, + ServicePrincipalNames: [], + displayMap: {"DisplayName":"Display Name", "PwdLastSet":"Password Last Changed", "LastLogon": "Last Logon", "Enabled":"Enabled","Email":"Email"} }; emitter.on('userNodeClicked', this.getNodeData.bind(this)); @@ -51,7 +54,8 @@ export default class UserNodeData extends Component { firstdegreeControl: -1, unrolledControl: -1, transitiveControl: -1, - propertyMap: {ServicePrincipalNames: []} + propertyMap: {}, + ServicePrincipalNames: [] }); var domain = '@' + payload.split('@').last(); @@ -75,7 +79,9 @@ export default class UserNodeData extends Component { .then(function(result){ var properties = result.records[0]._fields[0].properties; if (typeof properties.ServicePrincipalNames === 'undefined'){ - properties.ServicePrincipalNames = []; + this.setState({ServicePrincipalNames: []}); + }else{ + this.setState({ ServicePrincipalNames: properties.ServicePrincipalNames }); } this.setState({propertyMap: properties}); props.close(); @@ -201,48 +207,7 @@ export default class UserNodeData extends Component {
{this.state.label}
-
- Display Name -
-
- {this.convertToDisplayProp("DisplayName")} -
-
- Password Last Changed -
-
- {this.convertToDisplayProp("PwdLastSet")} -
-
- Last Logon -
-
- {this.convertToDisplayProp("LastLogon")} -
-
- Enabled -
-
- {this.convertToDisplayProp("Enabled")} -
-
- Email -
-
- {this.convertToDisplayProp("Email")} -
-
- Service Principal Names -
- {(() => { - if (this.state.propertyMap.ServicePrincipalNames.length === 0){ - return
None
; - } - })()} - {Object.keys(this.state.propertyMap.ServicePrincipalNames).map(function(key){ - var x =
{this.state.propertyMap.ServicePrincipalNames[key]}
; - return x; - }.bind(this))} +
Sessions