Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
robybrisson authored Jul 5, 2024
2 parents 72373a9 + 6224b50 commit b3ecf24
Show file tree
Hide file tree
Showing 36 changed files with 904 additions and 143 deletions.
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
"request": "launch",
"name": "Launch Chrome Debugger",
"url": "http://localhost:4280"
},
{
"type": "PowerShell",
"name": "Launch in Windows Terminal",
"request": "launch",
"cwd": "${cwd}",
"script": ". '${cwd}\\Tools\\Start-CippDevEmulators.ps1'"
}
],
"compounds": [
Expand Down
4 changes: 4 additions & 0 deletions Tools/Start-CippDevEmulators.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Write-Host "Starting CIPP Dev Emulators"
$Path = (Get-Item $PSScriptRoot).Parent.Parent.FullName
wt --title CIPP`; new-tab --title 'Azurite' -d $Path pwsh -c azurite`; new-tab --title 'FunctionApp' -d $Path\CIPP-API pwsh -c func start`; new-tab --title 'CIPP Frontend' -d $Path\CIPP pwsh -c npm run start`; new-tab --title 'SWA' -d $Path\CIPP pwsh -c npm run start-swa

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "5.8.0",
"version": "5.9.3",
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down
14 changes: 14 additions & 0 deletions public/MFAStates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"value": "disabled",
"label": "Disabled"
},
{
"value": "enabled",
"label": "Enabled"
},
{
"value": "enforced",
"label": "Enforced"
}
]
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.0
5.9.3
10 changes: 10 additions & 0 deletions src/_nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const _nav = [
name: 'Users',
to: '/identity/administration/users',
},
{
component: CNavItem,
name: 'Risky Users',
to: '/identity/administration/risky-users',
},
{
component: CNavItem,
name: 'Groups',
Expand Down Expand Up @@ -114,6 +119,11 @@ const _nav = [
name: 'AAD Connect Report',
to: '/identity/reports/azure-ad-connect-report',
},
{
component: CNavItem,
name: 'Risk Detections',
to: '/identity/reports/risk-detections',
},
],
},
{
Expand Down
1 change: 1 addition & 0 deletions src/components/buttons/TableModalButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ TableModalButton.propTypes = {
title: PropTypes.string,
className: PropTypes.string,
countOnly: PropTypes.bool,
icon: PropTypes.string,
}
18 changes: 12 additions & 6 deletions src/components/forms/RFFComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,19 +470,25 @@ RFFCFormSelect.propTypes = {
export function Condition({ when, is, children, like, regex }) {
return (
<>
{is && (
{is !== undefined && (
<Field name={when} subscription={{ value: true }}>
{({ input: { value } }) => (value === is ? children : null)}
{({ input: { value } }) => {
return value === is ? children : null
}}
</Field>
)}
{like && (
{like !== undefined && (
<Field name={when} subscription={{ value: true }}>
{({ input: { value } }) => (value.includes(like) ? children : null)}
{({ input: { value } }) => {
return value.includes(like) ? children : null
}}
</Field>
)}
{regex && (
{regex !== undefined && (
<Field name={when} subscription={{ value: true }}>
{({ input: { value } }) => (value.match(regex) ? children : null)}
{({ input: { value } }) => {
return value.match(regex) ? children : null
}}
</Field>
)}
</>
Expand Down
26 changes: 25 additions & 1 deletion src/components/layout/AppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import { AppHeaderSearch } from 'src/components/header'
import { CippActionsOffcanvas, TenantSelector } from '../utilities'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faBars } from '@fortawesome/free-solid-svg-icons'
import { setCurrentTheme, setUserSettings, toggleSidebarShow } from 'src/store/features/app'
import {
setCurrentTheme,
setSetupCompleted,
setUserSettings,
toggleSidebarShow,
} from 'src/store/features/app'
import { useMediaPredicate } from 'react-media-hook'
import {
useGenericGetRequestQuery,
Expand Down Expand Up @@ -92,6 +97,25 @@ const AppHeader = () => {
}
}, [delay, state])
}
//useEffect to check if any of the dashboard alerts contained the key "setupCompleted" and if so,
//check if the value of this key is false. If so, set the setupCompleted state to false
//if none is found, set the setupCompleted state to true
useEffect(() => {
if (dashboard && Array.isArray(dashboard) && dashboard.length >= 1) {
console.log('Finding if setup is completed.')
const setupCompleted = dashboard.find((alert) => alert && alert.setupCompleted === false)
if (setupCompleted) {
console.log("Setup isn't completed yet, we found a match with false.")
dispatch(setSetupCompleted({ setupCompleted: false }))
} else {
console.log('Setup is completed.')
dispatch(setSetupCompleted({ setupCompleted: true }))
}
} else {
console.log('Setup is completed.')
dispatch(setSetupCompleted({ setupCompleted: true }))
}
}, [dashboard, dispatch])

useEffect(() => {
if (cippQueueList.isUninitialized && (cippQueueList.isFetching || cippQueueList.isLoading)) {
Expand Down
1 change: 1 addition & 0 deletions src/components/tables/CellBoolean.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function CellBoolean({
if (
cell.toLowerCase() === 'success' ||
cell.toLowerCase() === 'enabled' ||
cell.toLowerCase() === 'enforced' ||
cell.toLowerCase() === 'pass' ||
cell.toLowerCase() === 'true' ||
cell.toLowerCase() === 'compliant'
Expand Down
19 changes: 14 additions & 5 deletions src/components/tables/CippTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,25 @@ export default function CippTable({

// Define the flatten function
const flatten = (obj, prefix = '') => {
if (obj === null) return {}
return Object.keys(obj).reduce((output, key) => {
const newKey = prefix ? `${prefix}.${key}` : key
const value = obj[key] === null ? '' : obj[key]

if (typeof value === 'object' && !Array.isArray(value)) {
Object.assign(output, flatten(value, newKey))
} else {
output[newKey] = value
if (Array.isArray(value)) {
if (typeof value[0] === 'object') {
value.map((item, idx) => {
Object.assign(output, flatten(item, `${newKey}[${idx}]`))
})
} else {
output[newKey] = value
}
} else {
output[newKey] = value
}
}
return output
}, {})
Expand Down Expand Up @@ -677,8 +688,7 @@ export default function CippTable({
})
return Array.isArray(exportData) && exportData.length > 0
? exportData.map((obj) => {
const flattenedObj = flatten(obj)
return applyFormatter(flattenedObj)
return flatten(applyFormatter(obj))
})
: []
}
Expand All @@ -689,8 +699,7 @@ export default function CippTable({
// Adjusted dataFlat processing to include formatting
let dataFlat = Array.isArray(data)
? data.map((item) => {
const flattenedItem = flatten(item)
return applyFormatter(flattenedItem)
return flatten(applyFormatter(item))
})
: []
if (!disablePDFExport) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/utilities/CippActionsOffcanvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export default function CippActionsOffcanvas(props) {
}
let actionsSelectorsContent
try {
actionsSelectorsContent = props.actionsSelect.map((action, index) => (
actionsSelectorsContent = props?.actionsSelect?.map((action, index) => (
<CListGroupItem className="" component="label" color={action.color} key={index}>
{action.label}
<CListGroupItem
Expand Down
Loading

0 comments on commit b3ecf24

Please sign in to comment.