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
BNWEIN authored Oct 30, 2023
2 parents 13e9bad + 5a6b29d commit 243bafe
Show file tree
Hide file tree
Showing 25 changed files with 744 additions and 238 deletions.
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.0
4.5.0
93 changes: 41 additions & 52 deletions src/_nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,45 @@ const _nav = [
},
],
},
{
component: CNavGroup,
name: 'GDAP Management',
section: 'Settings',
to: '/cipp/gdap',
icon: <FontAwesomeIcon icon={faUserShield} className="nav-icon" />,
items: [
{
component: CNavItem,
name: 'Role Wizard',
to: '/tenant/administration/gdap-role-wizard',
},
{
component: CNavItem,
name: 'GDAP Roles',
to: '/tenant/administration/gdap-roles',
},
{
component: CNavItem,
name: 'Migration Wizard',
to: '/tenant/administration/gdap',
},
{
component: CNavItem,
name: 'GDAP Migration Status',
to: '/tenant/administration/gdap-status',
},
{
component: CNavItem,
name: 'Invite Wizard',
to: '/tenant/administration/gdap-invite',
},
{
component: CNavItem,
name: 'GDAP Relationships',
to: '/tenant/administration/gdap-relationships',
},
],
},
{
component: CNavGroup,
name: 'Reports',
Expand Down Expand Up @@ -293,15 +332,6 @@ const _nav = [
},
],
},
// Coming in another branch (heads up)
//{
//component: CNavGroup,
//name: 'Vulnerabilities',
//section: 'Security & Compliance',
//to: '/security/vulnerabilities',
//icon: <FontAwesomeIcon icon={faChessRook} className="nav-icon" />,
//items: [],
//},
{
component: CNavGroup,
name: 'Defender',
Expand Down Expand Up @@ -678,56 +708,15 @@ const _nav = [
name: 'Logbook',
to: '/cipp/logs',
},

{
component: CNavItem,
name: 'SAM Setup Wizard',
to: '/cipp/setup',
},
],
},
{
component: CNavGroup,
name: 'GDAP Migration',
section: 'Settings',
to: '/cipp/gdap',
icon: <FontAwesomeIcon icon={faUserShield} className="nav-icon" />,
items: [
{
component: CNavItem,
name: 'Role Wizard',
to: '/tenant/administration/gdap-role-wizard',
},
{
component: CNavItem,
name: 'GDAP Roles',
to: '/tenant/administration/gdap-roles',
},
{
component: CNavItem,
name: 'Migration Wizard',
to: '/tenant/administration/gdap',
},
{
component: CNavItem,
name: 'GDAP Migration Status',
to: '/tenant/administration/gdap-status',
},
{
component: CNavItem,
name: 'Invite Wizard',
to: '/tenant/administration/gdap-invite',
},
{
component: CNavItem,
name: 'GDAP Relationships',
to: '/tenant/administration/gdap-relationships',
},
{
component: CNavItem,
name: 'Documentation',
href: 'https://cipp.app/docs/user/usingcipp/GDAP/migration',
target: '_blank',
name: 'Log Out',
to: '/logout',
},
],
},
Expand Down
40 changes: 40 additions & 0 deletions src/components/buttons/TableModalButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'
import { CButton } from '@coreui/react'
import { ModalService } from '../utilities'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCheckCircle } from '@fortawesome/free-solid-svg-icons'
import { cellGenericFormatter } from '../tables/CellGenericFormat'

export default function TableModalButton({ data, title, className }) {
const handleTable = (data) => {
const QueryColumns = []
const columns = Object.keys(data[0]).map((key) => {
QueryColumns.push({
name: key,
selector: (row) => row[key], // Accessing the property using the key
sortable: true,
exportSelector: key,
cell: cellGenericFormatter(),
})
})
ModalService.open({
data: data,
componentType: 'table',
componentProps: {
columns: QueryColumns,
keyField: 'id',
},
title: title,
size: 'lg',
})
}
const buttonClass = 'btn ' + className

return (
<CButton className={buttonClass} onClick={() => handleTable(data)}>
<>
{title} ({data.length})
</>
</CButton>
)
}
3 changes: 2 additions & 1 deletion src/components/buttons/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ExportCsvButton from 'src/components/buttons/CsvButton'
import ExportPDFButton from 'src/components/buttons/PdfButton'
import TitleButton from 'src/components/buttons/TitleButton'
import TableModalButton from 'src/components/buttons/TableModalButton'

export { ExportCsvButton, ExportPDFButton, TitleButton }
export { ExportCsvButton, ExportPDFButton, TitleButton, TableModalButton }
38 changes: 31 additions & 7 deletions src/components/tables/CellTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ import { CButton } from '@coreui/react'
import { ModalService } from '../utilities'
import { CBadge } from '@coreui/react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCheckCircle } from '@fortawesome/free-solid-svg-icons'
import { faCheckCircle, faTimesCircle } from '@fortawesome/free-solid-svg-icons' // 1. Import the required FontAwesome icon
import { cellGenericFormatter } from './CellGenericFormat'

export default function cellTable(row, column, propertyName) {
export default function cellTable(
row,
column,
propertyName,
checkWhenZero = false,
crossWhenZero = false,
) {
const handleTable = ({ row }) => {
const QueryColumns = []
const columns = Object.keys(row[propertyName][0]).map((key) => {
QueryColumns.push({
name: key,
selector: (row) => row[key], // Accessing the property using the key
selector: (row) => row[key],
sortable: true,
exportSelector: key,
cell: cellGenericFormatter(),
Expand All @@ -29,8 +35,24 @@ export default function cellTable(row, column, propertyName) {
size: 'lg',
})
}
//if the row propertyName is a bool, then return a check or cross
if (typeof row[propertyName] === 'boolean') {
if (row[propertyName]) {
return <FontAwesomeIcon icon={faCheckCircle} className="text-success" />
}
return <FontAwesomeIcon icon={faTimesCircle} className="text-danger" />
}

if (!row[propertyName] || !Array.isArray(row[propertyName]) || row.length === 0) {
if (!row[propertyName] || !Array.isArray(row[propertyName]) || row[propertyName].length === 0) {
if (row[propertyName] === undefined) {
return <FontAwesomeIcon icon={faCheckCircle} className="text-success" />
}
if (checkWhenZero) {
return <FontAwesomeIcon icon={faCheckCircle} className="text-success" />
}
if (crossWhenZero) {
return <FontAwesomeIcon icon={faTimesCircle} className="text-danger" />
}
return <FontAwesomeIcon icon={faCheckCircle} className="text-success" />
}

Expand All @@ -41,6 +63,8 @@ export default function cellTable(row, column, propertyName) {
)
}

export const cellTableFormatter = (propertyName) => (row, index, column, id) => {
return cellTable(row, column, propertyName)
}
export const cellTableFormatter =
(propertyName, checkWhenZero = false, crossWhenZero = false) =>
(row, index, column, id) => {
return cellTable(row, column, propertyName, checkWhenZero, crossWhenZero)
}
55 changes: 28 additions & 27 deletions src/components/tables/CippTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,23 @@ FilterComponent.propTypes = {
filterlist: PropTypes.arrayOf(PropTypes.object),
onFilterPreset: PropTypes.func,
}
const compareValues = (a, b) => {
if (a === null) return 1
if (b === null) return -1
if (typeof a === 'number' && typeof b === 'number') return a - b
if (typeof a === 'boolean' && typeof b === 'boolean') return a === b ? 0 : a ? -1 : 1
return String(a).localeCompare(String(b), 'en', { numeric: true })
}

const customSort = (rows, selector, direction) => {
return rows.sort((a, b) => {
// use the selector to resolve your field names by passing the sort comparitors
let aField
let bField

aField = selector(a)
bField = selector(b)

let comparison = 0

if (aField?.toString().localeCompare(bField, 'en', { numeric: true }) > 0) {
comparison = 1
} else if (aField?.toString().localeCompare(bField, 'en', { numeric: true }) < 0) {
comparison = -1
}

let aField = selector(a)
let bField = selector(b)
let comparison = compareValues(aField, bField)
return direction === 'desc' ? comparison * -1 : comparison
})
}

export default function CippTable({
data,
isFetching = false,
Expand All @@ -115,6 +111,7 @@ export default function CippTable({
isModal = false,
exportFiltered = false,
filterlist,
showFilter = true,
tableProps: {
keyField = 'id',
theme = 'cyberdrain',
Expand Down Expand Up @@ -472,6 +469,10 @@ export default function CippTable({
])
}

actions.forEach((action) => {
defaultActions.push(action)
})

if (!disablePDFExport || !disableCSVExport) {
const keys = []
const exportFormatter = {}
Expand Down Expand Up @@ -582,9 +583,7 @@ export default function CippTable({
</CDropdown>,
])
}
actions.forEach((action) => {
defaultActions.push(action)
})

defaultActions.push([
<ExportPDFButton
key="export-pdf-action"
Expand Down Expand Up @@ -631,15 +630,17 @@ export default function CippTable({
return (
<>
<div className="w-100 d-flex justify-content-start">
<FilterComponent
onFilter={(e) => setFilterText(e.target.value)}
onFilterPreset={(e) => {
setFilterText(e)
}}
onClear={handleClear}
filterText={filterText}
filterlist={filterlist}
/>
{showFilter && (
<FilterComponent
onFilter={(e) => setFilterText(e.target.value)}
onFilterPreset={(e) => {
setFilterText(e)
}}
onClear={handleClear}
filterText={filterText}
filterlist={filterlist}
/>
)}
{defaultActions}
</div>
</>
Expand Down
6 changes: 4 additions & 2 deletions src/components/utilities/UniversalSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const UniversalSearch = React.forwardRef(

const handleKeyDown = (event) => {
if (event.key === 'Enter') {
// on enter key, start the search
// on enter key, start the searchs
getSearchItems({ path: `/api/ExecUniversalSearch?name=${searchValue}` })
}
}
Expand Down Expand Up @@ -80,7 +80,9 @@ const ResultsRow = ({ match }) => {

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

return (
Expand Down
15 changes: 14 additions & 1 deletion src/data/standards.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@
},
"label": "Set Outbound Spam Alert e-mail"
},
{
"name": "standards.SafeSendersDisable",
"cat": "Exchange",
"helpText": "",
"addedComponent": null,
"label": "Remove Safe Senders to prevent SPF bypass"
},
{
"name": "standards.DisableSharedMailbox",
"cat": "Exchange",
Expand Down Expand Up @@ -332,7 +339,7 @@
},
{
"name": "standards.ActivityBasedTimeout",
"cat": "SharePoint",
"cat": "Global",
"helpText": "",
"addedComponent": null,
"label": "Enable 1 hour Activity based Timeout"
Expand Down Expand Up @@ -415,6 +422,12 @@
},
"label": "Set inactive device retirement days"
},
{
"name": "standards.intuneRequireMFA",
"cat": "Intune",
"helpText": "",
"label": "Require Multifactor Authentication to register or join devices with Microsoft Entra"
},
{
"name": "standards.sharingCapability.Enabled",
"cat": "SharePoint",
Expand Down
Loading

0 comments on commit 243bafe

Please sign in to comment.