From 623007891a318285e611bca83b09438f757949cd Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 23 Apr 2024 10:19:09 -0400 Subject: [PATCH 1/2] filter available relationships for onboarding --- .../tenant/administration/TenantOnboardingWizard.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/tenant/administration/TenantOnboardingWizard.jsx b/src/views/tenant/administration/TenantOnboardingWizard.jsx index a6eb19460e55..122765dff6c3 100644 --- a/src/views/tenant/administration/TenantOnboardingWizard.jsx +++ b/src/views/tenant/administration/TenantOnboardingWizard.jsx @@ -312,14 +312,14 @@ const TenantOnboardingWizard = () => { reportName="Add-GDAP-Relationship" keyField="id" path="/api/ListGraphRequest" - params={{ Endpoint: 'tenantRelationships/delegatedAdminRelationships' }} + params={{ + Endpoint: 'tenantRelationships/delegatedAdminRelationships', + $filter: + "(status eq 'active' or status eq 'approvalPending') and not startsWith(displayName,'MLT_')", + }} columns={columns} filterlist={[ { filterName: 'Active Relationships', filter: 'Complex: status eq active' }, - { - filterName: 'Terminated Relationships', - filter: 'Complex: status eq terminated', - }, { filterName: 'Pending Relationships', filter: 'Complex: status eq approvalPending', From e44b89d7bd2f6fc9d548837a246ff7aab3b56204 Mon Sep 17 00:00:00 2001 From: John Duprey Date: Tue, 23 Apr 2024 13:40:16 -0400 Subject: [PATCH 2/2] auto refresh for recent jobs --- src/components/layout/AppHeader.jsx | 77 +++++++++++++------ .../utilities/CippActionsOffcanvas.jsx | 2 +- 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/src/components/layout/AppHeader.jsx b/src/components/layout/AppHeader.jsx index 85fe747dd98f..9661c89e7eba 100644 --- a/src/components/layout/AppHeader.jsx +++ b/src/components/layout/AppHeader.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, useRef } from 'react' import { useSelector, useDispatch } from 'react-redux' import { CAlert, @@ -72,8 +72,29 @@ const AppHeader = () => { loadCippQueue() } + function useInterval(callback, delay, state) { + const savedCallback = useRef() + + // Remember the latest callback. + useEffect(() => { + savedCallback.current = callback + }) + + // Set up the interval. + useEffect(() => { + function tick() { + savedCallback.current() + } + + if (delay !== null) { + let id = setInterval(tick, delay) + return () => clearInterval(id) + } + }, [delay, state]) + } + useEffect(() => { - if (cippQueueList.isFetching || cippQueueList.isLoading) { + if (cippQueueList.isUninitialized && (cippQueueList.isFetching || cippQueueList.isLoading)) { setCippQueueExtendedInfo([ { label: 'Fetching recent jobs', @@ -82,28 +103,40 @@ const AppHeader = () => { link: '#', }, ]) - } - if ( - cippQueueList.isSuccess && - Array.isArray(cippQueueList.data) && - cippQueueList.data.length > 0 - ) { - setCippQueueExtendedInfo( - cippQueueList.data?.map((job) => ({ - label: `${job.Name}`, - value: job.Status, - link: job.Link, - timestamp: job.Timestamp, - percent: job.PercentComplete, - progressText: `${job.PercentComplete}%`, - })), - ) } else { - setCippQueueExtendedInfo([ - { label: 'No jobs to display', value: '', timestamp: Date(), link: '#' }, - ]) + if ( + cippQueueList.isSuccess && + Array.isArray(cippQueueList.data) && + cippQueueList.data.length > 0 + ) { + setCippQueueExtendedInfo( + cippQueueList.data?.map((job) => ({ + label: `${job.Name}`, + value: job.Status, + link: job.Link, + timestamp: job.Timestamp, + percent: job.PercentComplete, + progressText: `${job.PercentComplete}%`, + })), + ) + } else { + setCippQueueExtendedInfo([ + { label: 'No jobs to display', value: '', timestamp: Date(), link: '#' }, + ]) + } } - }, [cippQueueList]) + }, [cippQueueList, setCippQueueExtendedInfo]) + + useInterval( + async () => { + if (cippQueueVisible) { + setCippQueueRefresh((Math.random() + 1).toString(36).substring(7)) + getCippQueueList({ path: 'api/ListCippQueue', params: { refresh: cippQueueRefresh } }) + } + }, + 5000, + cippQueueVisible, + ) const SwitchTheme = () => { let targetTheme = preferredTheme diff --git a/src/components/utilities/CippActionsOffcanvas.jsx b/src/components/utilities/CippActionsOffcanvas.jsx index dc9567479ab5..f67e3d11ed88 100644 --- a/src/components/utilities/CippActionsOffcanvas.jsx +++ b/src/components/utilities/CippActionsOffcanvas.jsx @@ -231,7 +231,7 @@ export default function CippActionsOffcanvas(props) { - {action.percent && ( + {action?.percent > 0 && (