-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathAZLogicAppNodeData.jsx
More file actions
202 lines (189 loc) · 9.31 KB
/
AZLogicAppNodeData.jsx
File metadata and controls
202 lines (189 loc) · 9.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZLogicAppNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZLogicApp') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:AZLogicApp {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
target={objectid}
property='See Logic App within Tenant'
query='MATCH p = (d:AZTenant)-[r:AZContains*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN p'
/>
<NodeCypherNoNumberLink
target={objectid}
property='See Logic App within Resource group'
query='MATCH p = (d:AZResourceGroup)-[r:AZContains*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN p'
/>
<NodeCypherLinkComplex
countQuery={
'MATCH p=(:AZLogicApp {objectid:$objectid})-[:AZManagedIdentity]->(n) RETURN COUNT(p)'
}
graphQuery={
'MATCH p=(:AZLogicApp {objectid:$objectid})-[:AZManagedIdentity]->(n) RETURN p'
}
start={label}
property={'Managed Identities'}
target={objectid}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='Role Assignments'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLinkComplex
countQuery={
'MATCH p = (d)-[r:Owner*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN COUNT(p)'
}
graphQuery={
'MATCH p = (d)-[r:Owner*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN p'
}
property={'Logic App Owners'}
target={objectid}
/>
<NodeCypherLinkComplex
countQuery={
'MATCH p = (d)-[r:Contributor*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN COUNT(p)'
}
graphQuery={
'MATCH p = (d)-[r:Contributor*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN p'
}
property={'Logic App Contributors'}
target={objectid}
/>
<NodeCypherLinkComplex
countQuery={
'MATCH p = (d)-[r:UserAccessAdministrator*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN COUNT(p)'
}
graphQuery={
'MATCH p = (d)-[r:UserAccessAdministrator*1..]->(u:AZLogicApp {objectid: $objectid}) RETURN p'
}
property={'User Access Administrators'}
target={objectid}
/>
<NodeCypherLinkComplex
countQuery={
'MATCH p = (d)-[r]->(u:AZLogicApp {objectid: $objectid}) RETURN COUNT(p)'
}
graphQuery={
'MATCH p = (d)-[r]->(u:AZLogicApp {objectid: $objectid}) RETURN p'
}
property={'All Relations'}
target={objectid}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header={'INBOUND OBJECT CONTROL'}>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZLogicAppContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZLogicApp {objectid:$objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMemberOf]->(g)-[r1:AZLogicAppContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZLogicApp {objectid:$objectid})'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r1*1..]->(c:AZLogicApp {objectid:$objectid}))'
}
end={label}
distinct
/>
</CollapsibleSection>
</div>
</div>
);
};
AZLogicAppNodeData.propTypes = {};
export default AZLogicAppNodeData;