Skip to content

Commit

Permalink
Merge pull request #1419 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
Dev to reeeelease
  • Loading branch information
KelvinTegelaar authored Mar 17, 2023
2 parents 4de156b + eecfe9e commit 72247c5
Show file tree
Hide file tree
Showing 25 changed files with 679 additions and 144 deletions.
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.2.0
4 changes: 2 additions & 2 deletions src/_nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const _nav = [
},
{
component: CNavItem,
name: 'Basic Auth Report',
to: '/identity/reports/basic-auth-report',
name: 'Inactive Users',
to: '/identity/reports/inactive-users-report',
},
{
component: CNavItem,
Expand Down
75 changes: 61 additions & 14 deletions src/components/tables/CippTable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useRef } from 'react'
import { useSelector } from 'react-redux'
import { ExportCsvButton, ExportPDFButton } from 'src/components/buttons'
import {
Expand Down Expand Up @@ -124,6 +124,9 @@ export default function CippTable({
...rest
} = {},
}) {
const inputRef = useRef('')
const [loopRunning, setLoopRunning] = React.useState(false)
const [massResults, setMassResults] = React.useState([])
const [filterText, setFilterText] = React.useState('')
const [updatedColumns, setUpdatedColumns] = React.useState(columns)
const [selectedRows, setSelectedRows] = React.useState(false)
Expand Down Expand Up @@ -205,11 +208,23 @@ export default function CippTable({
</div>
),
title: 'Confirm',
onConfirm: () =>
selectedRows.forEach(function (number) {
console.log(number)
genericGetRequest({ path: modalUrl, refreshParam: number })
}),
onConfirm: async () => {
const resultsarr = []
for (const row of selectedRows) {
setLoopRunning(true)
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
for (let [paramName, paramValue] of urlParams.entries()) {
if (paramValue.startsWith('!')) {
urlParams.set(paramName, row[paramValue.replace('!', '')])
}
}
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
const results = await genericGetRequest({ path: NewModalUrl, refreshParam: row.id })
resultsarr.push(results)
setMassResults(resultsarr)
}
setLoopRunning(false)
},
})
} else {
ModalService.confirm({
Expand All @@ -224,17 +239,37 @@ export default function CippTable({
</div>
),
title: 'Confirm',
onConfirm: () => [
genericPostRequest({
path: modalUrl,
values: { ...modalBody, ...{ input: inputRef.current.value } },
}),
],
onConfirm: async () => {
const resultsarr = []
for (const row of selectedRows) {
setLoopRunning(true)
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
for (let [paramName, paramValue] of urlParams.entries()) {
if (paramValue.toString().startsWith('!')) {
urlParams.set(paramName, row[paramValue.replace('!', '')])
}
}
const newModalBody = {}
for (let [objName, objValue] of Object.entries(modalBody)) {
console.log(objValue)
if (objValue.toString().startsWith('!')) {
newModalBody[objName] = row[objValue.replace('!', '')]
}
}
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
const results = await genericPostRequest({
path: NewModalUrl,
values: { ...modalBody, ...newModalBody, ...{ input: inputRef.current.value } },
})
resultsarr.push(results)
setMassResults(resultsarr)
}
setLoopRunning(false)
},
})
}
}
const executeselectedAction = (item) => {
console.log(item)
handleModal(item.modalMessage, item.modalUrl, item.modalType, item.modalBody, item.modalInput)
}
const defaultActions = []
Expand Down Expand Up @@ -393,6 +428,18 @@ export default function CippTable({
<div>
{(columns.length === updatedColumns.length || !dynamicColumns) && (
<>
{(massResults.length >= 1 || loopRunning) && (
<CCallout color="info">
{massResults.map((message, idx) => {
return <li key={idx}>{message.data.Results}</li>
})}
{loopRunning && (
<li>
<CSpinner size="sm" />
</li>
)}
</CCallout>
)}
<DataTable
customStyles={customStyles}
className="cipp-table"
Expand Down Expand Up @@ -426,7 +473,7 @@ export default function CippTable({
{...rest}
/>
{selectedRows.length >= 1 && (
<CCallout>Selected {selectedRows.length} items </CCallout>
<CCallout>Selected {selectedRows.length} items</CCallout>
)}
</>
)}
Expand Down
12 changes: 7 additions & 5 deletions src/components/utilities/CippProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { useLoadClientPrincipalQuery } from 'src/store/api/auth'
import { ThemeSwitcher, UsageLocation, PageSizeSwitcher } from 'src/components/utilities'
import ReportImage from './ReportImage'
import TenantListSelector from './TenantListSelector'

const CippProfile = () => {
const { data: profile, isFetching, isLoading } = useLoadClientPrincipalQuery()
Expand Down Expand Up @@ -52,17 +53,18 @@ const CippProfile = () => {
<PageSizeSwitcher />
</CCol>
</CRow>
<br></br>
<CRow>
<CCol>
<UsageLocation />
<TenantListSelector />
</CCol>
</CRow>
<br></br>
<CRow>
<CCol>
<ReportImage />
</CCol>
<CCol>{!isLoading && <UsageLocation />}</CCol>
</CRow>
<br></br>
<CRow>
<CCol>{!isLoading && <ReportImage />}</CCol>
</CRow>
</>
)
Expand Down
37 changes: 37 additions & 0 deletions src/components/utilities/TenantListSelector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react'
import { CButtonGroup, CButton, CCard, CCardHeader } from '@coreui/react'
import { useDispatch, useSelector } from 'react-redux'
import { setTenantList } from 'src/store/features/app'

const TenantListSelector = () => {
const dispatch = useDispatch()
const TenantListSelector = useSelector((state) => state.app.TenantListSelector)

const SwitchPageSize = (value) => {
dispatch(setTenantList({ TenantListSelector: value }))
}

return (
<CCard>
<CCardHeader>Select default Tenant List</CCardHeader>
<CButtonGroup role="group" aria-label="Page Size Switcher">
<CButton
onClick={() => SwitchPageSize(true)}
active={TenantListSelector ? true : false}
color="secondary"
>
Compressed
</CButton>
<CButton
onClick={() => SwitchPageSize(false)}
active={TenantListSelector ? false : true}
color="secondary"
>
Full list
</CButton>
</CButtonGroup>
</CCard>
)
}

export default TenantListSelector
12 changes: 7 additions & 5 deletions src/components/utilities/UniversalSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const UniversalSearch = React.forwardRef(
const handleKeyDown = (event) => {
if (event.key === 'Enter') {
// on enter key, start the search
getSearchItems({ path: `/api/ExecUniversalSearch?SearchObj=${searchValue}` })
getSearchItems({ path: `/api/ExecUniversalSearch?name=${searchValue}` })
}
}

Expand All @@ -28,13 +28,13 @@ export const UniversalSearch = React.forwardRef(
<CFormInput
ref={ref}
type="text"
placeholder="Search users in selected tenant"
placeholder="Search users in any tenant by UPN or Display Name. Requires Lighthouse onboarding"
onKeyDown={handleKeyDown}
onChange={handleChange}
value={searchValue}
/>
</div>
{searchItems.isSuccess && <Results items={searchItems.data} searchValue={searchValue} />}

{searchItems.isFetching && (
<>
<div className="d-flex flex-column m-3">
Expand All @@ -48,6 +48,8 @@ export const UniversalSearch = React.forwardRef(
</div>
</>
)}
{searchItems.isSuccess && <Results items={searchItems.data} searchValue={searchValue} />}
{searchItems.data <= 1 && 'No results found.'}
</div>
)
},
Expand Down Expand Up @@ -78,7 +80,7 @@ const ResultsRow = ({ match }) => {

const handleClick = () => {
dispatch(hideSwitcher())
navigate(`/identity/administration/users?customerId=${match.customerId}`)
navigate(`/identity/administration/users?customerId=${match._tenantId}`)
}

return (
Expand All @@ -88,7 +90,7 @@ const ResultsRow = ({ match }) => {
<div className="flex-grow-1 d-flex flex-column">
<div className="mx-1">{match.displayName}</div>
<div className="mx-1">{match.userPrincipalName}</div>
<small>Found in tenant {match.defaultDomainName}</small>
<small>Found in tenant {match._tenantId}</small>
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/components/utilities/UsageLocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const UsageLocation = () => {
const dispatch = useDispatch()
const usagelocation = useSelector((state) => state.app.usageLocation)
const Switchusage = (t, n) => {
// console.log(t)
dispatch(setDefaultusageLocation({ usageLocation: t }))
}

Expand Down
18 changes: 16 additions & 2 deletions src/data/standards.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@
"label": "Enable Auto-expanding archives"
},
{
"name": "standards.SpoofWarn.Enable",
"name": "standards.SpoofWarn.enable",
"cat": "Exchange",
"helpText": "This is the default helptext",
"addedComponent": null,
"label": "Enable Spoofing warnings for Outlook (This e-mail is external identifiers)"
},
{
"name": "standards.SpoofWarn.Disable",
"name": "standards.SpoofWarn.disable",
"cat": "Exchange",
"helpText": "This is the default helptext",
"addedComponent": null,
Expand All @@ -250,6 +250,20 @@
"addedComponent": null,
"label": "Disable daily Insight/Viva reports"
},
{
"name": "standards.RotateDKIM",
"cat": "Exchange",
"helpText": "Rotate DKIM keys that are 1024 bit to 2048 bit",
"addedComponent": null,
"label": "Rotate DKIM keys that are 1024 bit to 2048 bit"
},
{
"name": "standards.AddDKIM",
"cat": "Exchange",
"helpText": "Enables DKIM for all domains that currently support it",
"addedComponent": null,
"label": "Enables DKIM for all domains that currently support it"
},
{
"name": "standards.ActivityBasedTimeout",
"cat": "SharePoint",
Expand Down
4 changes: 2 additions & 2 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const DeployConditional = React.lazy(() => import('src/views/tenant/conditional/
const ListLicences = React.lazy(() => import('src/views/tenant/administration/ListLicences'))
const ListAppConsent = React.lazy(() => import('src/views/tenant/administration/ListOauthApps'))

const BasicAuthReport = React.lazy(() => import('src/views/identity/reports/BasicAuthReport'))
const BasicAuthReport = React.lazy(() => import('src/views/identity/reports/InactiveUsers'))
const SignInReport = React.lazy(() => import('src/views/identity/reports/SignIns'))

const AzureADConnectReport = React.lazy(() =>
Expand Down Expand Up @@ -267,7 +267,7 @@ const routes = [
{ path: '/endpoint/reports/devices', name: 'Devices', component: Devices },
{ path: '/identity/reports/mfa-report', name: 'MFA Report', component: MFAReport },
{
path: '/identity/reports/basic-auth-report',
path: '/identity/reports/inactive-users-report',
name: 'Basic Auth Report',
component: BasicAuthReport,
},
Expand Down
5 changes: 5 additions & 0 deletions src/store/features/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const initialState = {
currentTheme: 'default',
tablePageSize: 25,
pageSizes: [25, 50, 100, 200, 500],
TenantListSelector: false,
}

export const appSlice = createSlice({
Expand Down Expand Up @@ -40,13 +41,17 @@ export const appSlice = createSlice({
setReportImage: (state, action) => {
state.reportImage = action.payload?.reportImage
},
setTenantList: (state, action) => {
state.TenantListSelector = action.payload?.TenantListSelector
},
},
})

export const {
toggleSidebarShow,
toggleSidebarUnfoldable,
setCurrentTenant,
setTenantList,
setCurrentPageSize,
setCurrentTheme,
setSidebarVisible,
Expand Down
Loading

0 comments on commit 72247c5

Please sign in to comment.