From 5a49ac5e9b59de142160bbff4b942012d00801d1 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Thu, 2 Nov 2023 22:58:47 +0100 Subject: [PATCH 1/9] fixed wizard bug by improving text --- src/views/cipp/Setup.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/cipp/Setup.js b/src/views/cipp/Setup.js index 82da760206e7..e8d9a33d3064 100644 --- a/src/views/cipp/Setup.js +++ b/src/views/cipp/Setup.js @@ -51,7 +51,7 @@ const Setup = () => { const valbutton = (value) => getResults.data?.step < 5 ? undefined - : `You must finish the setup process. you are currently at step ${getResults.data?.step} of 5.` + : `You do not have to click next. Finish the wizard via the setup button below. After it says "Setup Completed" you may browse away from this page.` const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery() const [genericGetRequest, getResults] = useLazyGenericGetRequestQuery() const onSubmit = (values) => { @@ -159,14 +159,14 @@ const Setup = () => { Please use a Global Administrator to perform these tasks. You can restart the process at any time, by clicking on the start button once more.

- + startCIPPSetup(true)} - validate={valbutton} + validate={() => valbutton()} > Start Setup Wizard From 07e6de8b8d6c6c0ec30f75dc61e20b757172088e Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 15:53:18 +0100 Subject: [PATCH 2/9] improved access checks --- src/views/cipp/CIPPSettings.js | 389 ++++++++++++++++++--------------- 1 file changed, 210 insertions(+), 179 deletions(-) diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index b242ee5257cd..385075a06fc2 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -151,9 +151,10 @@ const CIPPSettings = () => { export default CIPPSettings const GeneralSettings = () => { - const { data: versions, isSuccess: isSuccessVersion } = useLoadVersionsQuery() const { data: tenants = [] } = useListTenantsQuery({ AllTenantSelector: false }) const [checkPermissions, permissionsResult] = useLazyExecPermissionsAccessCheckQuery() + const [checkGDAP, GDAPResult] = useLazyGenericGetRequestQuery() + const [clearCache, clearCacheResult] = useLazyExecClearCacheQuery() const [checkAccess, accessCheckResult] = useLazyExecTenantsAccessCheckQuery() const [selectedTenants, setSelectedTenants] = useState([]) @@ -207,6 +208,34 @@ const GeneralSettings = () => { }, ] + const checkGDAPColumns = [ + { + name: 'Tenant', + selector: (row) => row['Tenant'], + grow: 0, + cell: cellGenericFormatter(), + }, + { + name: 'Error Type', + selector: (row) => row['Type'], + minWidth: '380px', + maxWidth: '380px', + cell: cellGenericFormatter(), + }, + { + name: 'Issue', + selector: (row) => row?.Issue, + }, + { + name: 'Resolution Link', + selector: (row) => row?.link, + }, + { + name: 'Relationship ID', + selector: (row) => row?.Relationship, + }, + ] + const handleCheckAccess = () => { const mapped = tenants.reduce( (current, { customerId, ...rest }) => ({ @@ -287,21 +316,6 @@ const GeneralSettings = () => { return tokenOffcanvasGroups } - const handleClearCache = useConfirmModal({ - body:
Are you sure you want to clear the cache?
, - onConfirm: () => { - clearCache({ tenantsOnly: false }) - localStorage.clear() - }, - }) - - const handleClearCacheTenant = useConfirmModal({ - body:
Are you sure you want to clear the cache?
, - onConfirm: () => { - clearCache({ tenantsOnly: true }) - }, - }) - const tableProps = { pagination: false, actions: [ @@ -336,39 +350,12 @@ const GeneralSettings = () => {
- - - Frontend Version - - - -
Latest: {isSuccessVersion ? versions.RemoteCIPPVersion : }
-
Current: {isSuccessVersion ? versions.LocalCIPPVersion : }
-
-
-
- - - - API Version - - - -
Latest: {isSuccessVersion ? versions.RemoteCIPPAPIVersion : }
-
Current: {isSuccessVersion ? versions.LocalCIPPAPIVersion : }
-
-
+
- + Permissions Check @@ -414,25 +401,6 @@ const GeneralSettings = () => { )} - {permissionsResult.data.Results?.MissingGroups.length > 0 && ( - <> - Your SAM User is missing the following group memberships. If you have setup - GDAP outside of CIPP, execute an access check to confirm access and role - availability to your tenants - - {permissionsResult.data.Results?.MissingGroups?.map((r, index) => ( - {r} - ))} - - - )} - {permissionsResult.data.Results?.CIPPGroupCount == 0 && ( - <> - NOTE: Your GDAP groups were not set up by CIPP. Please check the groups - below to see if you have the correct GDAP permissions, or execute an access - check. - - )} {permissionsResult.data.Results?.AccessTokenDetails?.Name !== '' && ( <> @@ -450,68 +418,70 @@ const GeneralSettings = () => { /> )} - {permissionsResult.data.Results?.Memberships !== '' && ( + + )} + + + + + + + GDAP Check + + + Click the button below to start a check for general GDAP settings. + checkGDAP({ path: '/api/ExecAccessChecks?GDAP=true' })} + disabled={GDAPResult.isFetching} + className="mt-3" + > + {GDAPResult.isFetching && ( + + )} + Run GDAP Check + + + + {GDAPResult.isSuccess && GDAPResult.data.Results.GDAPIssues?.length > 0 && ( + + )} + {GDAPResult.isSuccess && GDAPResult.data.Results.GDAPIssues?.length === 0 && ( + + No relationships with issues found. Please perform a Permissions Check or + Tenant Access Check if you are experiencing issues. + + )} + {GDAPResult.isSuccess && ( <> p['@odata.type'] == '#microsoft.graph.group', )} title="Groups" /> p['@odata.type'] == '#microsoft.graph.directoryRole', )} title="Roles" /> )} - - )} - - - - - - - Clear Cache - - - - Click the button below to clear the application cache. You can clear only the tenant - cache, or all caches. + - handleClearCache()} - disabled={clearCacheResult.isFetching} - className="me-3 mt-3" - > - {clearCacheResult.isFetching && ( - - )} - Clear All Caches - - handleClearCacheTenant()} - disabled={clearCacheResult.isFetching} - className="me-3 mt-3" - > - {clearCacheResult.isFetching && ( - - )} - Clear Tenant Cache - - {clearCacheResult.isSuccess && ( -
{clearCacheResult.data?.Results}
- )} - - + + Tenant Access Check @@ -541,6 +511,7 @@ const GeneralSettings = () => { )} + { - - -
) @@ -1359,6 +1327,8 @@ const DNSSettings = () => { const [getDnsConfig, getDnsConfigResult] = useLazyGetDnsConfigQuery() const [editDnsConfig, editDnsConfigResult] = useLazyEditDnsConfigQuery() const inputRef = useRef(null) + const [clearCache, clearCacheResult] = useLazyExecClearCacheQuery() + const { data: versions, isSuccess: isSuccessVersion } = useLoadVersionsQuery() const [alertVisible, setAlertVisible] = useState(false) @@ -1370,7 +1340,20 @@ const DNSSettings = () => { setAlertVisible(false) }, 2000) } + const handleClearCache = useConfirmModal({ + body:
Are you sure you want to clear the cache?
, + onConfirm: () => { + clearCache({ tenantsOnly: false }) + localStorage.clear() + }, + }) + const handleClearCacheTenant = useConfirmModal({ + body:
Are you sure you want to clear the cache?
, + onConfirm: () => { + clearCache({ tenantsOnly: true }) + }, + }) const resolvers = ['Google', 'Cloudflare', 'Quad9'] return ( @@ -1382,81 +1365,129 @@ const DNSSettings = () => { Application Settings -

DNS Resolver

- - {resolvers.map((r, index) => ( + + + + + +

DNS Resolver

+ + {resolvers.map((r, index) => ( + switchResolver(r)} + color={r === getDnsConfigResult.data.Resolver ? 'primary' : 'secondary'} + key={index} + > + {r} + + ))} + + {(editDnsConfigResult.isSuccess || editDnsConfigResult.isError) && ( + + {editDnsConfigResult.isSuccess + ? editDnsConfigResult.data.Results + : 'Error setting resolver'} + + )} +
+ +

Frontend Version

+ +
Latest: {isSuccessVersion ? versions.RemoteCIPPVersion : }
+
Current: {isSuccessVersion ? versions.LocalCIPPVersion : }
+
+
+ + +

Clear Caches

switchResolver(r)} - color={r === getDnsConfigResult.data.Resolver ? 'primary' : 'secondary'} - key={index} + className="me-2 mb-2" + onClick={() => handleClearCache()} + disabled={clearCacheResult.isFetching} > - {r} + {clearCacheResult.isFetching && ( + + )} + Clear All Cache - ))} -
- {(editDnsConfigResult.isSuccess || editDnsConfigResult.isError) && ( - - {editDnsConfigResult.isSuccess - ? editDnsConfigResult.data.Results - : 'Error setting resolver'} - - )} - - - - -

Settings Backup

- runBackup({ path: '/api/ExecRunBackup' })} - disabled={RunBackupResult.isFetching} - className="me-3 mt-3" - > - {RunBackupResult.isFetching && ( - + handleClearCacheTenant()} + disabled={clearCacheResult.isFetching} + > + {clearCacheResult.isFetching && ( + + )} + Clear Tenant Cache + + {clearCacheResult.isSuccess && ( +
{clearCacheResult.data?.Results}
)} - Run backup -
- handleChange(e)} - /> - inputRef.current.click()} - disabled={restoreBackupResult.isFetching} - className="me-3 mt-3" - > - {restoreBackupResult.isFetching && ( - +
+ + +

Settings Backup

+ runBackup({ path: '/api/ExecRunBackup' })} + disabled={RunBackupResult.isFetching} + > + {RunBackupResult.isFetching && ( + + )} + Run backup + + handleChange(e)} + /> + inputRef.current.click()} + disabled={restoreBackupResult.isFetching} + > + {restoreBackupResult.isFetching && ( + + )} + Restore backup + + {restoreBackupResult.isSuccess && ( + <> + {restoreBackupResult.data.Results} + )} - Restore backup - - {restoreBackupResult.isSuccess && ( - <> - {restoreBackupResult.data.Results} - - )} - {RunBackupResult.isSuccess && ( - <> - - downloadTxtFile(RunBackupResult.data.backup)} - className="m-1" - > - Download Backup - - - - )} -
+ {RunBackupResult.isSuccess && ( + <> + + downloadTxtFile(RunBackupResult.data.backup)}> + Download Backup + + + + )} +
+ +

Backend API Version

+ +
Latest: {isSuccessVersion ? versions.RemoteCIPPAPIVersion : }
+
Current: {isSuccessVersion ? versions.LocalCIPPAPIVersion : }
+
+ )} From 9fee67b87bf4977b08494a80079c7a25365081ad Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 17:50:29 +0100 Subject: [PATCH 3/9] improved the layout a little --- src/views/cipp/CIPPSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index 385075a06fc2..fd049b7629cd 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -354,7 +354,7 @@ const GeneralSettings = () => {
- + Permissions Check From 81249e1c80e409d5f83f67e8a7cd8abec3fc5e44 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 17:50:59 +0100 Subject: [PATCH 4/9] improve layout of table --- src/views/cipp/CIPPSettings.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index fd049b7629cd..4c6b60f71992 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -218,8 +218,6 @@ const GeneralSettings = () => { { name: 'Error Type', selector: (row) => row['Type'], - minWidth: '380px', - maxWidth: '380px', cell: cellGenericFormatter(), }, { From fd8164e794044ffef6a1d93dd59f9176e11db8d3 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 17:53:10 +0100 Subject: [PATCH 5/9] adding links --- src/views/cipp/CIPPSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index 4c6b60f71992..cdb468d9df3a 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -226,7 +226,7 @@ const GeneralSettings = () => { }, { name: 'Resolution Link', - selector: (row) => row?.link, + selector: (row) => row?.Link, }, { name: 'Relationship ID', From 01047abd9ad3d4123db7784f849b8ea0145b57f0 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 18:02:36 +0100 Subject: [PATCH 6/9] improved cellformatter for urls --- src/components/tables/CellGenericFormat.js | 4 ++++ src/views/cipp/CIPPSettings.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/components/tables/CellGenericFormat.js b/src/components/tables/CellGenericFormat.js index e442378a5633..1015106a1935 100644 --- a/src/components/tables/CellGenericFormat.js +++ b/src/components/tables/CellGenericFormat.js @@ -7,6 +7,7 @@ import { } from '@fortawesome/free-solid-svg-icons' import { CellBadge } from 'src/components/tables' import { CBadge, CTooltip } from '@coreui/react' +import { startsWith } from 'core-js/core/string' const IconWarning = () => const IconError = () => @@ -79,6 +80,9 @@ export const cellGenericFormatter = if (cell.toLowerCase() === 'failed') { return {CellTip('Failed to retrieve from API')} } + if (cell.toLowerCase().startsWith('http')) { + return `URL` + } return CellTip(cell) } if (typeof cell === 'number') { diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index cdb468d9df3a..9e223b32cc1c 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -223,14 +223,17 @@ const GeneralSettings = () => { { name: 'Issue', selector: (row) => row?.Issue, + cell: cellGenericFormatter(), }, { name: 'Resolution Link', selector: (row) => row?.Link, + cell: cellGenericFormatter(), }, { name: 'Relationship ID', selector: (row) => row?.Relationship, + cell: cellGenericFormatter(), }, ] From 5344fda97a4683a9fbb977b4eadf3fbfb6f4e3bb Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 18:06:44 +0100 Subject: [PATCH 7/9] improvements --- src/views/cipp/CIPPSettings.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index 9e223b32cc1c..576ad9ee520d 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -212,13 +212,16 @@ const GeneralSettings = () => { { name: 'Tenant', selector: (row) => row['Tenant'], - grow: 0, cell: cellGenericFormatter(), + minWidth: '200px', + maxWidth: '200px', }, { name: 'Error Type', selector: (row) => row['Type'], cell: cellGenericFormatter(), + minWidth: '150px', + maxWidth: '150px', }, { name: 'Issue', From 39fdbc7422787e09e593d4869ca16dce96b64692 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 18:16:50 +0100 Subject: [PATCH 8/9] fix --- src/components/tables/CellGenericFormat.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/tables/CellGenericFormat.js b/src/components/tables/CellGenericFormat.js index 1015106a1935..1fd1a70e6138 100644 --- a/src/components/tables/CellGenericFormat.js +++ b/src/components/tables/CellGenericFormat.js @@ -7,7 +7,6 @@ import { } from '@fortawesome/free-solid-svg-icons' import { CellBadge } from 'src/components/tables' import { CBadge, CTooltip } from '@coreui/react' -import { startsWith } from 'core-js/core/string' const IconWarning = () => const IconError = () => From e8c9603d014e4116e8ecf3afd7fa096b10ad06a2 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Fri, 3 Nov 2023 18:39:53 +0100 Subject: [PATCH 9/9] design changes --- src/components/tables/CellGenericFormat.js | 2 +- src/views/cipp/CIPPSettings.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/tables/CellGenericFormat.js b/src/components/tables/CellGenericFormat.js index 1fd1a70e6138..d78f7759dcd4 100644 --- a/src/components/tables/CellGenericFormat.js +++ b/src/components/tables/CellGenericFormat.js @@ -80,7 +80,7 @@ export const cellGenericFormatter = return {CellTip('Failed to retrieve from API')} } if (cell.toLowerCase().startsWith('http')) { - return `URL` + return URL } return CellTip(cell) } diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index 576ad9ee520d..ace316706511 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -220,8 +220,8 @@ const GeneralSettings = () => { name: 'Error Type', selector: (row) => row['Type'], cell: cellGenericFormatter(), - minWidth: '150px', - maxWidth: '150px', + minWidth: '100px', + maxWidth: '100px', }, { name: 'Issue', @@ -427,7 +427,7 @@ const GeneralSettings = () => { - + GDAP Check