Skip to content

Commit 0477b25

Browse files
authored
Merge pull request #2180 from JohnDuprey/dev
Graph Explorer Tweaks
2 parents c7eb44a + b425621 commit 0477b25

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

src/components/forms/RFFComponents.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,12 @@ export const RFFSelectSearch = ({
429429
{label}
430430
{refreshFunction && (
431431
<CTooltip content="Refresh" placement="right">
432-
<CButton onClick={refreshFunction} variant="ghost" className="ms-1" size="sm">
432+
<CButton
433+
onClick={refreshFunction}
434+
variant="ghost"
435+
className="ms-1 py-0 border-0"
436+
size="sm"
437+
>
433438
<FontAwesomeIcon icon="sync" />
434439
</CButton>
435440
</CTooltip>

src/views/tenant/administration/GraphExplorer.jsx

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const GraphExplorer = () => {
4040
const [alertVisible, setAlertVisible] = useState()
4141
const [random, setRandom] = useState('')
4242
const [random2, setRandom2] = useState('')
43-
const [random3, setRandom3] = useState('')
4443
const [ocVisible, setOCVisible] = useState(false)
4544
const [searchNow, setSearchNow] = useState(false)
4645
const [visibleA, setVisibleA] = useState(true)
@@ -59,21 +58,21 @@ const GraphExplorer = () => {
5958
} = useGenericGetRequestQuery({ path: '/api/ListGraphExplorerPresets', params: { random2 } })
6059
const QueryColumns = { set: false, data: [] }
6160

62-
function endpointChange(value) {
63-
execPropRequest({
64-
path: '/api/ListGraphRequest',
65-
params: {
66-
Endpoint: value,
67-
ListProperties: true,
68-
TenantFilter: tenant.defaultDomainName,
69-
IgnoreErrors: true,
70-
random: (Math.random() + 1).toString(36).substring(7),
71-
},
72-
})
73-
}
7461
const debounceEndpointChange = useMemo(() => {
62+
function endpointChange(value) {
63+
execPropRequest({
64+
path: '/api/ListGraphRequest',
65+
params: {
66+
Endpoint: value,
67+
ListProperties: true,
68+
TenantFilter: tenant.defaultDomainName,
69+
IgnoreErrors: true,
70+
random: (Math.random() + 1).toString(36).substring(7),
71+
},
72+
})
73+
}
7574
return debounce(endpointChange, 1000)
76-
}, [endpointChange])
75+
}, [])
7776

7877
if (graphrequest.isSuccess) {
7978
if (graphrequest.data?.Results?.length > 0) {
@@ -483,6 +482,7 @@ const GraphExplorer = () => {
483482
)
484483
}}
485484
</FormSpy>
485+
<hr />
486486
<RFFCFormSwitch name="$count" label="Use $count" />
487487
<WhenFieldChanges field="reportTemplate" set="$count" />
488488
<RFFCFormSwitch name="NoPagination" label="Disable Pagination" />
@@ -504,13 +504,6 @@ const GraphExplorer = () => {
504504
/>
505505
<WhenFieldChanges field="reportTemplate" set="endpoint" />
506506
<WhenFieldChanges field="endpoint" set="endpoint" />
507-
<RFFCFormInput
508-
type="text"
509-
name="$filter"
510-
label="Filter"
511-
placeholder="Enter the filter string for the Graph query"
512-
/>
513-
<WhenFieldChanges field="reportTemplate" set="$filter" />
514507
<div className="mb-3">
515508
<RFFSelectSearch
516509
name="$select"
@@ -529,12 +522,16 @@ const GraphExplorer = () => {
529522
: []
530523
}
531524
allowCreate={true}
532-
refreshFunction={() =>
533-
setRandom3((Math.random() + 1).toString(36).substring(7))
534-
}
535525
isLoading={availableProperties.isFetching}
536526
/>
537527
</div>
528+
<RFFCFormInput
529+
type="text"
530+
name="$filter"
531+
label="Filter"
532+
placeholder="Enter the filter string for the Graph query"
533+
/>
534+
<WhenFieldChanges field="reportTemplate" set="$filter" />
538535
<WhenFieldChanges field="reportTemplate" set="$select" />
539536
<RFFCFormInput
540537
type="text"
@@ -572,7 +569,7 @@ const GraphExplorer = () => {
572569
<hr />
573570
<CippPage title="Report Results" tenantSelector={false}>
574571
{!searchNow && <span>Execute a search to get started.</span>}
575-
{graphrequest.isFetching && (
572+
{graphrequest.isFetching && !QueryColumns.set && (
576573
<div className="my-2">
577574
<CSpinner className="me-2" /> Loading Data
578575
</div>
@@ -593,6 +590,7 @@ const GraphExplorer = () => {
593590
columns={QueryColumns.data}
594591
data={graphrequest?.data?.Results}
595592
isFetching={graphrequest.isFetching}
593+
refreshFunction={() => setRandom((Math.random() + 1).toString(36).substring(7))}
596594
/>
597595
</>
598596
</CCardBody>

0 commit comments

Comments
 (0)