From da9ad342ac3b99254811490e8cd2604f9328fcd7 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:42:10 +0200 Subject: [PATCH 01/35] added list vunl --- src/_nav.js | 7 +- src/routes.js | 8 +++ src/views/security/defender/ListVuln.js | 88 +++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 src/views/security/defender/ListVuln.js diff --git a/src/_nav.js b/src/_nav.js index 2e26d8dc08bf..033baea53cc1 100644 --- a/src/_nav.js +++ b/src/_nav.js @@ -281,9 +281,14 @@ const _nav = [ }, { component: CNavItem, - name: 'Defender Status', + name: 'List Defender Status', to: '/security/defender/list-defender', }, + { + component: CNavItem, + name: 'List Vulnerabilities', + to: '/security/defender/list-defender-tvm', + }, ], }, { diff --git a/src/routes.js b/src/routes.js index 88c75b7a2eb0..f5f5d68af2a6 100644 --- a/src/routes.js +++ b/src/routes.js @@ -120,6 +120,8 @@ const IntuneListPolicyTemplate = React.lazy(() => import('src/views/endpoint/MEM/MEMListPolicyTemplates'), ) const ListDefender = React.lazy(() => import('src/views/security/defender/ListDefender')) +const ListVulnerabilities = React.lazy(() => import('src/views/security/defender/ListVuln')) + const DeployDefender = React.lazy(() => import('src/views/security/defender/DeployDefender')) const OneDriveList = React.lazy(() => import('src/views/teams-share/onedrive/OneDriveList')) @@ -396,6 +398,12 @@ const routes = [ { path: '/security/defender', name: 'Defender' }, { path: '/security/defender/deployment', name: 'Deploy Defender', component: DeployDefender }, { path: '/security/defender/list-defender', name: 'List Defender', component: ListDefender }, + { + path: '/security/defender/list-defender-tvm', + name: 'List Vulnerabilities', + component: ListVulnerabilities, + }, + { path: '/teams-share', name: 'Teams & Sharepoint' }, { path: '/teams-share/onedrive', name: 'OneDrive' }, { path: '/teams-share/onedrive/list', name: 'List OneDrive', component: OneDriveList }, diff --git a/src/views/security/defender/ListVuln.js b/src/views/security/defender/ListVuln.js new file mode 100644 index 000000000000..e9714aedabef --- /dev/null +++ b/src/views/security/defender/ListVuln.js @@ -0,0 +1,88 @@ +import React from 'react' +import { useSelector } from 'react-redux' +import { CellTip, cellBooleanFormatter } from 'src/components/tables' +import { CippPageList } from 'src/components/layout' + +const columns = [ + { + selector: (row) => row['affectedDevicesCount'], + name: '# Affected Devices', + sortable: true, + exportSelector: 'affectedDevicesCount', + }, + { + selector: (row) => row['affectedDevices'], + name: 'Affected Devices Names', + sortable: true, + cell: (row) => CellTip(row['affectedDevices']), + exportSelector: 'affectedDevices', + }, + { + selector: (row) => row['osPlatform'], + name: 'Platform', + sortable: true, + exportSelector: 'osPlatform', + }, + { + selector: (row) => row['softwareVendor'], + name: 'Vendor', + sortable: true, + exportSelector: 'softwareVendor', + }, + { + selector: (row) => row['softwareName'], + name: 'Application Name', + sortable: true, + exportSelector: 'softwareName', + }, + { + selector: (row) => row['vulnerabilitySeverityLevel'], + name: 'Severity', + sortable: true, + exportSelector: 'vulnerabilitySeverityLevel', + }, + { + selector: (row) => row['cvssScore'], + name: 'CVSS Score', + sortable: true, + exportSelector: 'quickScanOverdue', + }, + { + selector: (row) => row['securityUpdateAvailable'], + name: 'Update Available', + sortable: true, + cell: cellBooleanFormatter(), + exportSelector: 'securityUpdateAvailable', + }, + { + selector: (row) => row['exploitabilityLevel'], + name: 'Exploit Publicly Available', + sortable: true, + exportSelector: 'exploitabilityLevel', + }, + { + selector: (row) => row['cveId'], + name: 'CVE ID', + sortable: true, + exportSelector: 'cveId', + }, +] + +const ListVuln = () => { + const tenant = useSelector((state) => state.app.currentTenant) + + return ( + + ) +} + +export default ListVuln From 2f8ffaa210ca22014f51475a33c75a435c47d121 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:57:17 +0200 Subject: [PATCH 02/35] added cve link --- src/views/security/defender/ListVuln.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/views/security/defender/ListVuln.js b/src/views/security/defender/ListVuln.js index e9714aedabef..fd41d4c51d30 100644 --- a/src/views/security/defender/ListVuln.js +++ b/src/views/security/defender/ListVuln.js @@ -65,6 +65,16 @@ const columns = [ name: 'CVE ID', sortable: true, exportSelector: 'cveId', + cell: (row) => ( + + {row['cveId']} + + ), }, ] From a6e931dbb9387ff3e9fe72464cd623ad93af92f8 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Mon, 17 Oct 2022 16:40:11 +0200 Subject: [PATCH 03/35] minor changes --- src/views/security/defender/ListVuln.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/security/defender/ListVuln.js b/src/views/security/defender/ListVuln.js index fd41d4c51d30..e54d39c3f398 100644 --- a/src/views/security/defender/ListVuln.js +++ b/src/views/security/defender/ListVuln.js @@ -67,7 +67,7 @@ const columns = [ exportSelector: 'cveId', cell: (row) => ( { reportName: `${tenant?.defaultDomainName}-DefenderStatus-List`, path: '/api/ListDefenderTVM', columns, + filterlist: [ + { + filterName: '# Affected Devices', + filter: '"affectedDevicesCount":1', + }, + { filterName: 'Windows 10 devices', filter: '"osPlatform":"Windows10"' }, + { filterName: 'Windows 11 devices', filter: '"osPlatform":"Windows11"' }, + { filterName: 'Vendor is Microsoft', filter: '"softwareVendor":"Microsoft"' }, + { filterName: 'High Severity', filter: '"vulnerabilitySeverityLevel":"High"' }, + ], params: { TenantFilter: tenant?.customerId }, }} /> From 8f59c8ef9b5eb908c91c910d61d7dd1330e4a469 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 12:41:03 +0200 Subject: [PATCH 04/35] added replacement of variables --- src/components/forms/RFFComponents.js | 7 +++- src/views/endpoint/MEM/MEMAddPolicy.js | 38 ++++++++++++++++--- .../applications/ApplicationsAddRMM.js | 2 - 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/components/forms/RFFComponents.js b/src/components/forms/RFFComponents.js index 86ebafeb6575..d1e0521250cd 100644 --- a/src/components/forms/RFFComponents.js +++ b/src/components/forms/RFFComponents.js @@ -258,7 +258,7 @@ RFFCFormSelect.propTypes = { values: PropTypes.arrayOf(PropTypes.shape({ label: PropTypes.string, value: PropTypes.any })), } -export function Condition({ when, is, children, like }) { +export function Condition({ when, is, children, like, regex }) { return ( <> {is && ( @@ -271,6 +271,11 @@ export function Condition({ when, is, children, like }) { {({ input: { value } }) => (value.includes(like) ? children : null)} )} + {regex && ( + + {({ input: { value } }) => (value.match(regex) ? children : null)} + + )} ) } diff --git a/src/views/endpoint/MEM/MEMAddPolicy.js b/src/views/endpoint/MEM/MEMAddPolicy.js index bdee33a81d92..278985c71485 100644 --- a/src/views/endpoint/MEM/MEMAddPolicy.js +++ b/src/views/endpoint/MEM/MEMAddPolicy.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState } from 'react' import { CCol, CRow, CListGroup, CListGroupItem, CCallout, CSpinner } from '@coreui/react' import { Field, FormSpy } from 'react-final-form' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' @@ -47,6 +47,12 @@ const AddPolicy = () => { values.TemplateType = values.Type genericPostRequest({ path: '/api/AddPolicy', values: values }) } + const [matchMap, setMatchMap] = useState([]) + const handleMap = (values) => { + if (JSON.stringify(values) != JSON.stringify(matchMap)) { + setMatchMap(values) + } + } const WhenFieldChanges = ({ field, set }) => ( {( @@ -187,11 +193,31 @@ const AddPolicy = () => { /> - - - #create list of tenants here, with variable name - - + + {(props) => { + return ( + <> + + + {props.values.RAWJson?.match('%.*%') && + handleMap([...props.values.RAWJson.matchAll('%.*%')])} + {matchMap.map((varname) => + props.values.selectedTenants.map((item, index) => ( + + + + )), + )} + + + + ) + }} + { {(props) => { - /* eslint-disable react/prop-types */ return ( <> @@ -324,7 +323,6 @@ const AddRMM = () => { {!postResults.isSuccess && ( {(props) => { - /* eslint-disable react/prop-types */ return ( <> From 5bd78787abd9e2dda2e46208b87f18a9f9f3d246 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 12:49:32 +0200 Subject: [PATCH 05/35] replacement --- src/views/endpoint/MEM/MEMAddPolicy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/endpoint/MEM/MEMAddPolicy.js b/src/views/endpoint/MEM/MEMAddPolicy.js index 278985c71485..b5eeca79366e 100644 --- a/src/views/endpoint/MEM/MEMAddPolicy.js +++ b/src/views/endpoint/MEM/MEMAddPolicy.js @@ -200,7 +200,7 @@ const AddPolicy = () => { {props.values.RAWJson?.match('%.*%') && - handleMap([...props.values.RAWJson.matchAll('%.*%')])} + handleMap([...props.values.RAWJson.matchAll('%\\w+%')])} {matchMap.map((varname) => props.values.selectedTenants.map((item, index) => ( From 84dfc756971f98bb8ca00d77ae542003faa3226c Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 12:50:17 +0200 Subject: [PATCH 06/35] typo --- src/views/endpoint/MEM/MEMAddPolicy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/endpoint/MEM/MEMAddPolicy.js b/src/views/endpoint/MEM/MEMAddPolicy.js index b5eeca79366e..327954c91f40 100644 --- a/src/views/endpoint/MEM/MEMAddPolicy.js +++ b/src/views/endpoint/MEM/MEMAddPolicy.js @@ -127,8 +127,8 @@ const AddPolicy = () => {

Step 2

Enter the raw JSON for this policy. See{' '} - this - for more information. + this for more + information.

From 727199959cd7a657f526dc356dce7a716111d5d2 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:12:56 +0200 Subject: [PATCH 07/35] added variables --- src/views/endpoint/MEM/MEMAddPolicyTemplate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/endpoint/MEM/MEMAddPolicyTemplate.js b/src/views/endpoint/MEM/MEMAddPolicyTemplate.js index 9db9919a2fe9..7d8e752d6a72 100644 --- a/src/views/endpoint/MEM/MEMAddPolicyTemplate.js +++ b/src/views/endpoint/MEM/MEMAddPolicyTemplate.js @@ -71,7 +71,7 @@ const MEMAddPolicyTemplate = () => { From 9115af440731bc0aa10600a8f51608213e647ba0 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:27:39 +0200 Subject: [PATCH 08/35] allow tenant only cache clear --- src/store/api/app.js | 3 ++- src/views/cipp/CIPPSettings.js | 31 ++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/store/api/app.js b/src/store/api/app.js index 89036a221ff6..220033b65d2d 100644 --- a/src/store/api/app.js +++ b/src/store/api/app.js @@ -73,10 +73,11 @@ export const appApi = baseApi.injectEndpoints({ }), }), execClearCache: builder.query({ - query: () => ({ + query: ({ tenantsOnly }) => ({ path: '/api/ListTenants', params: { ClearCache: true, + TenantsOnly: tenantsOnly, }, }), }), diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index 03383b245f71..6c2e41ae082c 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -48,7 +48,7 @@ import { useLazyEditDnsConfigQuery, useLazyGetDnsConfigQuery } from 'src/store/a import { useDispatch, useSelector } from 'react-redux' import { CippTable } from 'src/components/tables' import { CippPage, CippPageList } from 'src/components/layout' -import { RFFCFormSwitch, RFFCFormInput, RFFCFormSelect } from 'src/components/forms' +import { RFFCFormSwitch, RFFCFormInput, RFFCFormSelect, RFFCFormCheck } from 'src/components/forms' import { Form } from 'react-final-form' import useConfirmModal from 'src/hooks/useConfirmModal' import { setCurrentTenant } from 'src/store/features/app' @@ -225,7 +225,15 @@ const GeneralSettings = () => { const handleClearCache = useConfirmModal({ body:
Are you sure you want to clear the cache?
, onConfirm: () => { - clearCache() + clearCache({ tenantsOnly: false }) + localStorage.clear() + }, + }) + + const handleClearCacheTenant = useConfirmModal({ + body:
Are you sure you want to clear the cache?
, + onConfirm: () => { + clearCache({ tenantsOnly: true }) localStorage.clear() }, }) @@ -304,18 +312,27 @@ const GeneralSettings = () => { Clear Cache - Click the button below to clear the all caches the application uses. This includes the - Best Practice Analyser, Tenant Cache, Domain Analyser, and personal settings such as - theme and usage location
+ Click the button below to clear the application cache. You can clear only the tenant + cache, or all caches.

handleClearCache()} disabled={clearCacheResult.isFetching} - className="mt-3" + className="me-3" + > + {clearCacheResult.isFetching && ( + + )} + Clear All Caches + + handleClearCacheTenant()} + disabled={clearCacheResult.isFetching} + className="me-3" > {clearCacheResult.isFetching && ( )} - Clear Cache + Clear Tenant Cache {clearCacheResult.isSuccess && (
{clearCacheResult.data?.Results}
From a1af5ebe5b06de78133ba6066d9902c05935a45a Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:28:01 +0200 Subject: [PATCH 09/35] tenants only does not clear local storage --- src/views/cipp/CIPPSettings.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/cipp/CIPPSettings.js b/src/views/cipp/CIPPSettings.js index 6c2e41ae082c..f4cdec978688 100644 --- a/src/views/cipp/CIPPSettings.js +++ b/src/views/cipp/CIPPSettings.js @@ -234,7 +234,6 @@ const GeneralSettings = () => { body:
Are you sure you want to clear the cache?
, onConfirm: () => { clearCache({ tenantsOnly: true }) - localStorage.clear() }, }) From 5ab6ae02fbb152a81a009bf83dd8660674838635 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 20:11:26 +0200 Subject: [PATCH 10/35] Much prettier error handling --- src/App.js | 122 +++++++++++----------- src/components/utilities/ErrorBoundary.js | 16 +-- src/routes.js | 3 + src/views/pages/page500/Page500.js | 70 ++++++++----- 4 files changed, 115 insertions(+), 96 deletions(-) diff --git a/src/App.js b/src/App.js index e5167de71211..30112f0e0628 100644 --- a/src/App.js +++ b/src/App.js @@ -22,72 +22,74 @@ const App = () => { return ( }> - - - CIPP - - - } /> - } /> - } /> - } /> - } /> - } /> - - - - } - > - {routes.map((route, idx) => { - return ( - route.component && ( - + CIPP + + + } /> + } /> + } /> + } /> + } /> + } /> + + + + } + > + {routes.map((route, idx) => { + return ( + route.component && ( + }> + + CIPP - {route.name} + + + + + + } + /> + ) + ) + })} + {adminRoutes.map((route, idx) => { + return ( + route.component && ( + }> CIPP - {route.name} - - - } - /> - ) - ) - })} - {adminRoutes.map((route, idx) => { - return ( - route.component && ( - - }> - - CIPP - {route.name} - + - - - } - /> - ) + + + + } + /> ) - })} - } /> - - } /> - - + ) + })} + } /> + + } /> + ) diff --git a/src/components/utilities/ErrorBoundary.js b/src/components/utilities/ErrorBoundary.js index 5393f794d850..a32fd5e589f0 100644 --- a/src/components/utilities/ErrorBoundary.js +++ b/src/components/utilities/ErrorBoundary.js @@ -1,5 +1,6 @@ -import React from 'react' +import React, { Suspense } from 'react' import PropTypes from 'prop-types' +import Page500 from 'src/views/pages/page500/Page500' export default class ErrorBoundary extends React.Component { constructor(props) { @@ -18,17 +19,8 @@ export default class ErrorBoundary extends React.Component { render() { if (this.state.errorInfo) { - // Error path - return ( -
-

Something went wrong.

-
- {this.state.error && this.state.error.toString()} -
- {this.state.errorInfo.componentStack} -
-
- ) + //React.lazy(() => import('src/views/pages/page500/Page500')) + return } // Normally, just render children return this.props.children diff --git a/src/routes.js b/src/routes.js index f5f5d68af2a6..150638a92c96 100644 --- a/src/routes.js +++ b/src/routes.js @@ -24,6 +24,8 @@ const Roles = React.lazy(() => import('src/views/identity/administration/Roles') const Devices = React.lazy(() => import('src/views/endpoint/MEM/Devices')) const Page404 = React.lazy(() => import('src/views/pages/page404/Page404')) const Page403 = React.lazy(() => import('src/views/pages/page403/Page403')) +const Page500 = React.lazy(() => import('src/views/pages/page500/Page500')) + const MFAReport = React.lazy(() => import('src/views/identity/reports/MFAReport')) const Tenants = React.lazy(() => import('src/views/tenant/administration/Tenants')) const AlertWizard = React.lazy(() => import('src/views/tenant/administration/AlertWizard')) @@ -191,6 +193,7 @@ const routes = [ { path: '/cipp/logs', name: 'Logs', component: Logs }, { path: '/cipp/404', name: 'Error', component: Page404 }, { path: '/cipp/403', name: 'Error', component: Page403 }, + { path: '/cipp/500', name: 'Error', component: Page500 }, { path: '/identity', name: 'Identity' }, { path: '/identity/administration/users/add', name: 'Add User', component: AddUser }, { path: '/identity/administration/users/edit', name: 'Edit User', component: EditUser }, diff --git a/src/views/pages/page500/Page500.js b/src/views/pages/page500/Page500.js index 84c07bbed144..650d33df00bb 100644 --- a/src/views/pages/page500/Page500.js +++ b/src/views/pages/page500/Page500.js @@ -1,34 +1,56 @@ import React from 'react' -import { CButton, CCol, CContainer, CRow } from '@coreui/react' -import { Helmet } from 'react-helmet' -import { Link } from 'react-router-dom' +import { + CCard, + CCardBody, + CCardHeader, + CCardTitle, + CCol, + CRow, + CTable, + CTableBody, + CTableDataCell, + CTableHead, + CTableHeaderCell, + CTableRow, +} from '@coreui/react' import { FastSwitcher } from 'src/components/utilities' -const Page500 = () => { +const Page500 = ({ errorcode, issue }) => { return ( -
- - CIPP - 500 - - - + + + An error has occurred! + + + - -

500

-

Houston, we have a problem!

-

- The page you are looking for is temporarily unavailable. -

- - Back to home - -

-
- + An error has appeared while trying to load your data. For troubleshooting, the error + information can be found in the table below. +

This type of error is an issue or bug in the application and not directly + something you've done.
+

+ + + + + + Error + Error Location + + + + + {errorcode} + {issue} + + + + +
-
-
+
+ ) } From 93b02705880b64d202f6d304918840c60a38a3cc Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 20:32:47 +0200 Subject: [PATCH 11/35] renamed folder --- src/routes.js | 16 +++++++++------- src/views/endpoint/{MEM => intune}/Devices.js | 0 .../endpoint/{MEM => intune}/MEMAddPolicy.js | 0 .../{MEM => intune}/MEMAddPolicyTemplate.js | 0 .../endpoint/{MEM => intune}/MEMCAPolicies.js | 0 .../endpoint/{MEM => intune}/MEMEditPolicy.js | 0 .../endpoint/{MEM => intune}/MEMListPolicies.js | 0 .../{MEM => intune}/MEMListPolicyTemplates.js | 0 8 files changed, 9 insertions(+), 7 deletions(-) rename src/views/endpoint/{MEM => intune}/Devices.js (100%) rename src/views/endpoint/{MEM => intune}/MEMAddPolicy.js (100%) rename src/views/endpoint/{MEM => intune}/MEMAddPolicyTemplate.js (100%) rename src/views/endpoint/{MEM => intune}/MEMCAPolicies.js (100%) rename src/views/endpoint/{MEM => intune}/MEMEditPolicy.js (100%) rename src/views/endpoint/{MEM => intune}/MEMListPolicies.js (100%) rename src/views/endpoint/{MEM => intune}/MEMListPolicyTemplates.js (100%) diff --git a/src/routes.js b/src/routes.js index 150638a92c96..c9fd07057bd0 100644 --- a/src/routes.js +++ b/src/routes.js @@ -21,7 +21,7 @@ const GroupTemplates = React.lazy(() => import('src/views/identity/administratio const EditGroup = React.lazy(() => import('src/views/identity/administration/EditGroup')) const ViewGroup = React.lazy(() => import('src/views/identity/administration/ViewGroup')) const Roles = React.lazy(() => import('src/views/identity/administration/Roles')) -const Devices = React.lazy(() => import('src/views/endpoint/MEM/Devices')) +const Devices = React.lazy(() => import('src/views/endpoint/intune/Devices')) const Page404 = React.lazy(() => import('src/views/pages/page404/Page404')) const Page403 = React.lazy(() => import('src/views/pages/page403/Page403')) const Page500 = React.lazy(() => import('src/views/pages/page500/Page500')) @@ -107,19 +107,21 @@ const AutopilotListProfiles = React.lazy(() => const AutopilotListStatusPages = React.lazy(() => import('src/views/endpoint/autopilot/AutopilotListStatusPages'), ) -const IntuneListPolicies = React.lazy(() => import('src/views/endpoint/MEM/MEMListPolicies')) -const MEMEditPolicy = React.lazy(() => import('src/views/endpoint/MEM/MEMEditPolicy')) +const IntuneListPolicies = React.lazy(() => import('src/views/endpoint/intune/MEMListPolicies')) +const MEMEditPolicy = React.lazy(() => import('src/views/endpoint/intune/MEMEditPolicy')) const EditAutopilotProfile = React.lazy(() => import('src/views/endpoint/autopilot/AutopilotEditProfile'), ) const EditAutopilotStatusPage = React.lazy(() => import('src/views/endpoint/autopilot/AutopilotEditStatusPage'), ) -const IntuneCAPolicies = React.lazy(() => import('src/views/endpoint/MEM/MEMCAPolicies')) -const IntuneAddPolicy = React.lazy(() => import('src/views/endpoint/MEM/MEMAddPolicy')) -const MEMAddPolicyTemplate = React.lazy(() => import('src/views/endpoint/MEM/MEMAddPolicyTemplate')) +const IntuneCAPolicies = React.lazy(() => import('src/views/endpoint/intune/MEMCAPolicies')) +const IntuneAddPolicy = React.lazy(() => import('src/views/endpoint/intune/MEMAddPolicy')) +const MEMAddPolicyTemplate = React.lazy(() => + import('src/views/endpoint/intune/MEMAddPolicyTemplate'), +) const IntuneListPolicyTemplate = React.lazy(() => - import('src/views/endpoint/MEM/MEMListPolicyTemplates'), + import('src/views/endpoint/intune/MEMListPolicyTemplates'), ) const ListDefender = React.lazy(() => import('src/views/security/defender/ListDefender')) const ListVulnerabilities = React.lazy(() => import('src/views/security/defender/ListVuln')) diff --git a/src/views/endpoint/MEM/Devices.js b/src/views/endpoint/intune/Devices.js similarity index 100% rename from src/views/endpoint/MEM/Devices.js rename to src/views/endpoint/intune/Devices.js diff --git a/src/views/endpoint/MEM/MEMAddPolicy.js b/src/views/endpoint/intune/MEMAddPolicy.js similarity index 100% rename from src/views/endpoint/MEM/MEMAddPolicy.js rename to src/views/endpoint/intune/MEMAddPolicy.js diff --git a/src/views/endpoint/MEM/MEMAddPolicyTemplate.js b/src/views/endpoint/intune/MEMAddPolicyTemplate.js similarity index 100% rename from src/views/endpoint/MEM/MEMAddPolicyTemplate.js rename to src/views/endpoint/intune/MEMAddPolicyTemplate.js diff --git a/src/views/endpoint/MEM/MEMCAPolicies.js b/src/views/endpoint/intune/MEMCAPolicies.js similarity index 100% rename from src/views/endpoint/MEM/MEMCAPolicies.js rename to src/views/endpoint/intune/MEMCAPolicies.js diff --git a/src/views/endpoint/MEM/MEMEditPolicy.js b/src/views/endpoint/intune/MEMEditPolicy.js similarity index 100% rename from src/views/endpoint/MEM/MEMEditPolicy.js rename to src/views/endpoint/intune/MEMEditPolicy.js diff --git a/src/views/endpoint/MEM/MEMListPolicies.js b/src/views/endpoint/intune/MEMListPolicies.js similarity index 100% rename from src/views/endpoint/MEM/MEMListPolicies.js rename to src/views/endpoint/intune/MEMListPolicies.js diff --git a/src/views/endpoint/MEM/MEMListPolicyTemplates.js b/src/views/endpoint/intune/MEMListPolicyTemplates.js similarity index 100% rename from src/views/endpoint/MEM/MEMListPolicyTemplates.js rename to src/views/endpoint/intune/MEMListPolicyTemplates.js From 649e0cebef5895d21fc4a17046c050c870e0eee4 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 20:42:31 +0200 Subject: [PATCH 12/35] fix error --- src/views/endpoint/intune/Devices.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/views/endpoint/intune/Devices.js b/src/views/endpoint/intune/Devices.js index d80ae8449101..2214ae201652 100644 --- a/src/views/endpoint/intune/Devices.js +++ b/src/views/endpoint/intune/Devices.js @@ -21,19 +21,6 @@ const Offcanvas = (row, rowIndex, formatExtraData) => { extendedInfo={[ { label: 'Device Name', value: `${row.deviceName ?? ' '}` }, { label: 'UPN', value: `${row.userPrincipalName ?? ' '}` }, - row?.deviceActionResults.map((devicelog, idx) => { - if ($devicelog.actionName === 'locateDevice') { - return { - label: `${devicelog.startDateTime} - ${$devicelog.actionName}`, - value: devicelog.deviceLocation, - } - } else { - return { - label: `${devicelog.startDateTime} - ${$devicelog.actionName}`, - value: devicelog.actionState, - } - } - }), ]} actions={[ { From ad94d36be6f026d7a5f40694e9656169f810a783 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Wed, 19 Oct 2022 21:58:03 +0200 Subject: [PATCH 13/35] made toasts a little prettier --- src/components/utilities/Toasts.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/utilities/Toasts.js b/src/components/utilities/Toasts.js index 9265185a21ee..dfff8218b980 100644 --- a/src/components/utilities/Toasts.js +++ b/src/components/utilities/Toasts.js @@ -44,7 +44,7 @@ const Toast = ({ message, title, onClose, error }) => {
- {message} + {message.toString()} setVisible(!visible)}> Details {
-
{JSON.stringify(error, null, 2)}
+ {console.log(error)} +
+            {error?.status} - {error?.message}
+          
@@ -64,7 +67,7 @@ const Toast = ({ message, title, onClose, error }) => { Toast.propTypes = { title: PropTypes.string, - message: PropTypes.string, + message: PropTypes.any, onClose: PropTypes.func.isRequired, error: PropTypes.any, } From 8c5a4b47688414ebc369ec32eb07bf0b4d329ee2 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 20 Oct 2022 10:44:54 +0200 Subject: [PATCH 14/35] fixed #1143 --- src/views/tenant/standards/ApplyStandard.js | 14 ++++++++------ src/views/tenant/standards/ListAppliedStandards.js | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/views/tenant/standards/ApplyStandard.js b/src/views/tenant/standards/ApplyStandard.js index cc4b6af004e9..a778f1ffe616 100644 --- a/src/views/tenant/standards/ApplyStandard.js +++ b/src/views/tenant/standards/ApplyStandard.js @@ -206,8 +206,8 @@ const ApplyStandard = () => { name="standards.PasswordExpireDisabled" label="Do not expire passwords" /> - - + + { name="standards.DisableSelfServiceLicenses" label="Disable Self Service Licensing" /> - - - + + @@ -403,7 +405,7 @@ const ApplyStandard = () => { {!postResults.isSuccess && ( {(props) => ( - /* eslint-disable react/prop-types */ <> + <>
Selected Tenants
diff --git a/src/views/tenant/standards/ListAppliedStandards.js b/src/views/tenant/standards/ListAppliedStandards.js index c387baf65372..1c01e910320e 100644 --- a/src/views/tenant/standards/ListAppliedStandards.js +++ b/src/views/tenant/standards/ListAppliedStandards.js @@ -297,6 +297,10 @@ const ListAppliedStandards = () => { name="standards.UndoOauth" label="Undo App Consent Standard" /> +

From 613e251e9f335b9968d7d55feddd8a09e1f7a544 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 20 Oct 2022 15:55:03 +0200 Subject: [PATCH 15/35] universal searchbar --- src/components/layout/CippContentCard.js | 2 +- src/components/layout/CippMasonry.js | 6 +- src/components/utilities/UniversalSearch.js | 113 +++++++++++++++++++ src/views/home/Home.js | 117 +++++++++++--------- 4 files changed, 183 insertions(+), 55 deletions(-) create mode 100644 src/components/utilities/UniversalSearch.js diff --git a/src/components/layout/CippContentCard.js b/src/components/layout/CippContentCard.js index ae2b68417fa0..357ab4cfc442 100644 --- a/src/components/layout/CippContentCard.js +++ b/src/components/layout/CippContentCard.js @@ -12,7 +12,7 @@ export default function CippContentCard({ className = null, }) { return ( - + {title} {icon ? : null} diff --git a/src/components/layout/CippMasonry.js b/src/components/layout/CippMasonry.js index 7d1d35f7a6e7..d35a42b9c519 100644 --- a/src/components/layout/CippMasonry.js +++ b/src/components/layout/CippMasonry.js @@ -38,8 +38,8 @@ export function CippMasonryItem({ size, children, className = null }) { } return ( - -
{children}
+ +
{children}
) } @@ -84,7 +84,7 @@ export function CippMasonry({ columns = 3, children, className = null }) { return ( diff --git a/src/components/utilities/UniversalSearch.js b/src/components/utilities/UniversalSearch.js new file mode 100644 index 000000000000..5faa00dfcbbb --- /dev/null +++ b/src/components/utilities/UniversalSearch.js @@ -0,0 +1,113 @@ +import React, { useState } from 'react' +import { useDispatch } from 'react-redux' +import { CFormInput, CSpinner } from '@coreui/react' +import { hideSwitcher, mapNav } from 'src/store/features/switcher' +import { useNavigate } from 'react-router-dom' +import PropTypes from 'prop-types' +import fuzzysort from 'fuzzysort' +import { useLazyGenericGetRequestQuery } from 'src/store/api/app' + +export const UniversalSearch = React.forwardRef( + ({ onConfirm = () => {}, onChange = () => {}, maxResults = 7, value = '' }, ref) => { + const [searchValue, setSearchValue] = useState(value) + const [getSearchItems, searchItems] = useLazyGenericGetRequestQuery() + + const results = fuzzysort.go(searchValue, searchItems, { + limit: maxResults, + scoreFn: (a) => + // rank scores name>section>url (to) + Math.max( + a[0] ? a[0].score : -1000, + a[1] ? a[1].score - 100 : -1000, + a[2] ? a[2].score - 200 : -1000, + ), + }) + + const handleChange = (event) => { + setSearchValue(event.target?.value) + } + + const handleKeyDown = (event) => { + if (event.key === 'Enter') { + // on enter key, start the search + getSearchItems({ path: `/api/ExecUniversalSearch?SearchObj=${searchValue}` }) + } + } + + return ( +
+
+ +
+ {searchItems.isSuccess && } + {searchItems.isFetching && ( + <> +
+
+
+
+ +
+
+
+
+ + )} +
+ ) + }, +) +UniversalSearch.displayName = 'UniversalSearch' +UniversalSearch.propTypes = { + ref: PropTypes.oneOfType([ + // Either a function + PropTypes.func, + // Or the instance of a DOM native element (see the note about SSR) + PropTypes.shape({ current: PropTypes.instanceOf(Element) }), + ]), + onConfirm: PropTypes.func, + onChange: PropTypes.func, + maxResults: PropTypes.number, + value: PropTypes.any, +} + +const Results = ({ items = [] }) => { + return items.map((item, key) => { + return + }) +} + +const ResultsRow = ({ match }) => { + const navigate = useNavigate() + const dispatch = useDispatch() + + const handleClick = () => { + dispatch(hideSwitcher()) + navigate(`/identity/administration/users?customerId=${match.customerId}`) + } + + return ( +
+
+
+
+
{match.displayName}
+
{match.userPrincipalName}
+ Found in tenant {match.defaultDomainName} +
+
+
+
+ ) +} + +ResultsRow.propTypes = { + match: PropTypes.array, +} diff --git a/src/views/home/Home.js b/src/views/home/Home.js index c8e9970b6bf3..eb677daed000 100644 --- a/src/views/home/Home.js +++ b/src/views/home/Home.js @@ -1,13 +1,14 @@ import React from 'react' import { faBook, faExclamation } from '@fortawesome/free-solid-svg-icons' -import { CButton, CCallout } from '@coreui/react' +import { CButton, CCallout, CCardGroup, CCol, CRow } from '@coreui/react' import { useLoadDashQuery, useLoadVersionsQuery } from 'src/store/api/app' -import { StatusIcon } from 'src/components/utilities' +import { FastSwitcher, StatusIcon } from 'src/components/utilities' import { CippContentCard, CippMasonry, CippMasonryItem } from 'src/components/layout' import { CippTable } from 'src/components/tables' import { Link } from 'react-router-dom' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Skeleton from 'react-loading-skeleton' +import { UniversalSearch } from 'src/components/utilities/UniversalSearch' const Home = () => { const { data: versions, isSuccess: isSuccessVersion } = useLoadVersionsQuery() @@ -25,47 +26,63 @@ const Home = () => { }, ] return ( - - <> - {dashboard?.Alerts && ( - - - {dashboard.Alerts.map((mappedAlert, idx) => ( + <> + + + + + + + + + + + + + + + + + {!isLoadingDash && dashboard.Alerts ? ( + dashboard.Alerts.map((mappedAlert, idx) => ( {mappedAlert} - ))} - - - )} - - + )) + ) : ( + No active Alerts + )} + +
+ + +
{!isLoadingDash ? dashboard?.NextStandardsRun : }
- - +
+
{!isLoadingDash ? dashboard?.NextBPARun : }
- - +
+
{!isLoadingDash ? dashboard?.queuedApps : }
- - +
+
{!isLoadingDash ? dashboard?.queuedStandards : }
- - +
+
{!isLoadingDash ? dashboard?.tenantCount : }


Managed tenants
- - +
+
Refresh token: {!isLoadingDash ? dashboard?.RefreshTokenDate : ''} @@ -75,17 +92,15 @@ const Home = () => { Exchange Token: {!isLoadingDash ? dashboard?.ExchangeTokenDate : ''}
- - - <> - +
+
Latest: {isSuccessVersion ? versions.RemoteCIPPVersion : }
Current: {isSuccessVersion ? versions.LocalCIPPVersion : }
- - +
+ {
Latest: {isSuccessVersion ? versions.RemoteCIPPAPIVersion : }
Current: {isSuccessVersion ? versions.LocalCIPPAPIVersion : }
- - - - - {!isLoadingDash && issuccessDash && ( - - )} - {isLoadingDash && } - - - Jump to log - - - - - +
+ + + {!isLoadingDash && issuccessDash && ( + + )} + {isLoadingDash && } + + + Jump to log + + + + +
+ ) } From 641cad77a92f87d82763f3ff62da11899cc11897 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 20 Oct 2022 16:07:32 +0200 Subject: [PATCH 16/35] universal searchbar --- src/components/utilities/UniversalSearch.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/components/utilities/UniversalSearch.js b/src/components/utilities/UniversalSearch.js index 5faa00dfcbbb..a99bc5a91830 100644 --- a/src/components/utilities/UniversalSearch.js +++ b/src/components/utilities/UniversalSearch.js @@ -1,10 +1,9 @@ import React, { useState } from 'react' import { useDispatch } from 'react-redux' import { CFormInput, CSpinner } from '@coreui/react' -import { hideSwitcher, mapNav } from 'src/store/features/switcher' +import { hideSwitcher } from 'src/store/features/switcher' import { useNavigate } from 'react-router-dom' import PropTypes from 'prop-types' -import fuzzysort from 'fuzzysort' import { useLazyGenericGetRequestQuery } from 'src/store/api/app' export const UniversalSearch = React.forwardRef( @@ -12,17 +11,6 @@ export const UniversalSearch = React.forwardRef( const [searchValue, setSearchValue] = useState(value) const [getSearchItems, searchItems] = useLazyGenericGetRequestQuery() - const results = fuzzysort.go(searchValue, searchItems, { - limit: maxResults, - scoreFn: (a) => - // rank scores name>section>url (to) - Math.max( - a[0] ? a[0].score : -1000, - a[1] ? a[1].score - 100 : -1000, - a[2] ? a[2].score - 200 : -1000, - ), - }) - const handleChange = (event) => { setSearchValue(event.target?.value) } @@ -40,7 +28,7 @@ export const UniversalSearch = React.forwardRef( Date: Thu, 20 Oct 2022 16:13:42 +0200 Subject: [PATCH 17/35] rollback of cipp masonary changes --- src/components/layout/CippMasonry.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/layout/CippMasonry.js b/src/components/layout/CippMasonry.js index d35a42b9c519..7d1d35f7a6e7 100644 --- a/src/components/layout/CippMasonry.js +++ b/src/components/layout/CippMasonry.js @@ -38,8 +38,8 @@ export function CippMasonryItem({ size, children, className = null }) { } return ( - -
{children}
+ +
{children}
) } @@ -84,7 +84,7 @@ export function CippMasonry({ columns = 3, children, className = null }) { return ( From 0f63cf8c54322e085a74cd2479f3be4c92e5cfdd Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 20 Oct 2022 16:24:12 +0200 Subject: [PATCH 18/35] removed universal search for now --- src/views/home/Home.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/views/home/Home.js b/src/views/home/Home.js index eb677daed000..f777e911ae80 100644 --- a/src/views/home/Home.js +++ b/src/views/home/Home.js @@ -1,14 +1,13 @@ import React from 'react' -import { faBook, faExclamation } from '@fortawesome/free-solid-svg-icons' -import { CButton, CCallout, CCardGroup, CCol, CRow } from '@coreui/react' +import { faBook, faExclamation, faSearch } from '@fortawesome/free-solid-svg-icons' +import { CButton, CCallout, CCol, CRow } from '@coreui/react' import { useLoadDashQuery, useLoadVersionsQuery } from 'src/store/api/app' import { FastSwitcher, StatusIcon } from 'src/components/utilities' -import { CippContentCard, CippMasonry, CippMasonryItem } from 'src/components/layout' +import { CippContentCard } from 'src/components/layout' import { CippTable } from 'src/components/tables' import { Link } from 'react-router-dom' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Skeleton from 'react-loading-skeleton' -import { UniversalSearch } from 'src/components/utilities/UniversalSearch' const Home = () => { const { data: versions, isSuccess: isSuccessVersion } = useLoadVersionsQuery() @@ -29,15 +28,13 @@ const Home = () => { <> - + + - - - From 9bcbe3e88e601c4d9d8516898163e7f579b304dc Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Thu, 20 Oct 2022 20:54:43 +0200 Subject: [PATCH 19/35] Fix bug with autopassword --- src/views/identity/administration/AddUser.js | 24 ++++---------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/views/identity/administration/AddUser.js b/src/views/identity/administration/AddUser.js index f5facb9b796a..56bfc04aa869 100644 --- a/src/views/identity/administration/AddUser.js +++ b/src/views/identity/administration/AddUser.js @@ -34,13 +34,6 @@ import { faCircleNotch } from '@fortawesome/free-solid-svg-icons' import { useSelector } from 'react-redux' import { required } from 'src/validators' -const passwordRequired = (value, values) => { - if (!values.Autopassword && !values.password) { - return 'Password or automatically set password required' - } - return undefined -} - const AddUser = () => { const tenant = useSelector((state) => state.app.currentTenant) const { defaultDomainName: tenantDomain } = tenant @@ -91,7 +84,7 @@ const AddUser = () => { Usagelocation: values.usageLocation ? values.usageLocation.value : '', Username: values.mailNickname, streetAddress: values.streetAddress, - Autopassword: values.Autopassword, + Autopassword: !!values.Autopassword, MustChangePass: values.MustChangePass, tenantID: tenantDomain, ...values.license, @@ -196,19 +189,10 @@ const AddUser = () => { Settings - - + + - + Date: Fri, 21 Oct 2022 13:25:15 +0200 Subject: [PATCH 20/35] fixed errorhandling --- src/components/utilities/Toasts.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/utilities/Toasts.js b/src/components/utilities/Toasts.js index dfff8218b980..8ceee3836291 100644 --- a/src/components/utilities/Toasts.js +++ b/src/components/utilities/Toasts.js @@ -44,7 +44,7 @@ const Toast = ({ message, title, onClose, error }) => {
- {message.toString()} + {message} setVisible(!visible)}> Details {
- {console.log(error)}
             {error?.status} - {error?.message}
           
From 3d70aa14ea5324dd1cc59a318285be27c3f18110 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:20:04 +0200 Subject: [PATCH 21/35] added properties --- src/views/identity/administration/AddUser.js | 84 +++++++++----------- src/views/pages/page500/Page500.js | 5 +- 2 files changed, 41 insertions(+), 48 deletions(-) diff --git a/src/views/identity/administration/AddUser.js b/src/views/identity/administration/AddUser.js index 56bfc04aa869..8f4c2d6753cc 100644 --- a/src/views/identity/administration/AddUser.js +++ b/src/views/identity/administration/AddUser.js @@ -94,7 +94,7 @@ const AddUser = () => { } const usagelocation = useSelector((state) => state.app.usageLocation) const initialState = { - Autopassword: true, + Autopassword: false, usageLocation: usagelocation, } @@ -235,51 +235,43 @@ const AddUser = () => {
- {/* Temporarily disabled, API does not support this yet. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { An error has appeared while trying to load your data. For troubleshooting, the error information can be found in the table below. -

This type of error is an issue or bug in the application and not directly - something you've done. +

This type of error is usually indicative an application issue. To + troubleshoot this issue check if your API is running and reachable, or use below error + to troubleshoot


From 640b684d80aa83159d5264b79833f7c945a8db0e Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:42:38 +0200 Subject: [PATCH 22/35] warning inside of card instead of out --- src/views/identity/administration/AddUser.js | 21 ++++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/views/identity/administration/AddUser.js b/src/views/identity/administration/AddUser.js index 8f4c2d6753cc..d37c4a17378f 100644 --- a/src/views/identity/administration/AddUser.js +++ b/src/views/identity/administration/AddUser.js @@ -110,21 +110,20 @@ const AddUser = () => { - {adcIsFetching && } - {adcError && Unable to determine Azure AD Connect Settings} - {!adcIsFetching && - adconnectsettings.dirSyncEnabled && - adconnectsettings.dirSyncConfigured && ( - - Warning! {adconnectsettings.dirSyncEnabled} This tenant currently has Active - Directory Sync Enabled and Configured. This usually means users should be created - in Active Directory - - )} Account Details + {adcError && Unable to determine Azure AD Connect Settings} + {!adcIsFetching && + adconnectsettings.dirSyncEnabled && + adconnectsettings.dirSyncConfigured && ( + + Warning! {adconnectsettings.dirSyncEnabled} This tenant currently has Active + Directory Sync Enabled and Configured. This usually means users should be + created in Active Directory + + )}
Date: Tue, 25 Oct 2022 16:19:04 +0200 Subject: [PATCH 23/35] added ability to use search queries for add user --- src/views/identity/administration/AddUser.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/views/identity/administration/AddUser.js b/src/views/identity/administration/AddUser.js index d37c4a17378f..b6b8a472bdf4 100644 --- a/src/views/identity/administration/AddUser.js +++ b/src/views/identity/administration/AddUser.js @@ -33,11 +33,17 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faCircleNotch } from '@fortawesome/free-solid-svg-icons' import { useSelector } from 'react-redux' import { required } from 'src/validators' +import useQuery from 'src/hooks/useQuery' const AddUser = () => { const tenant = useSelector((state) => state.app.currentTenant) const { defaultDomainName: tenantDomain } = tenant - + let query = useQuery() + const allQueryObj = {} + for (const [key, value] of query.entries()) { + allQueryObj[key] = value + } + console.log(allQueryObj) const { data: users = [], isFetching: usersIsFetching, @@ -96,6 +102,7 @@ const AddUser = () => { const initialState = { Autopassword: false, usageLocation: usagelocation, + ...allQueryObj, } return ( From c09da91c45be0d75cd13cd636ed559a6c282b1dc Mon Sep 17 00:00:00 2001 From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com> Date: Tue, 25 Oct 2022 16:54:53 +0200 Subject: [PATCH 24/35] added easy copy from other user --- .../applications/ApplicationsAddRMM.js | 2 +- src/views/identity/administration/AddUser.js | 41 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/views/endpoint/applications/ApplicationsAddRMM.js b/src/views/endpoint/applications/ApplicationsAddRMM.js index eeac63769cd0..fe2d3bcd65c8 100644 --- a/src/views/endpoint/applications/ApplicationsAddRMM.js +++ b/src/views/endpoint/applications/ApplicationsAddRMM.js @@ -103,7 +103,7 @@ const AddRMM = () => { { + let navigate = useNavigate() + const tenant = useSelector((state) => state.app.currentTenant) const { defaultDomainName: tenantDomain } = tenant let query = useQuery() @@ -43,7 +47,6 @@ const AddUser = () => { for (const [key, value] of query.entries()) { allQueryObj[key] = value } - console.log(allQueryObj) const { data: users = [], isFetching: usersIsFetching, @@ -104,7 +107,14 @@ const AddUser = () => { usageLocation: usagelocation, ...allQueryObj, } - + const copyUserVariables = (t) => { + for (const [key, value] of Object.entries(t.value)) { + if (value != null) { + query.append(key, value) + } + navigate(`?${query.toString()}`) + } + } return ( {postResults.isSuccess && ( @@ -256,7 +266,7 @@ const AddUser = () => { - + @@ -321,6 +331,31 @@ const AddUser = () => { + + + + Copy properties + + + Use this option to copy the properties from another user, this will only copy the + visible fields as a template. +