Skip to content

User license fix #1571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import routes from 'src/routes'
import { Helmet } from 'react-helmet'
import adminRoutes from './adminRoutes'
import Skeleton from 'react-loading-skeleton'
import TimeAgo from 'javascript-time-ago'
import en from 'javascript-time-ago/locale/en.json'
TimeAgo.addDefaultLocale(en)

// Containers
const DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'))
Expand Down
3 changes: 0 additions & 3 deletions src/components/tables/CellDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import React from 'react'
import moment from 'moment'
import PropTypes from 'prop-types'
import { CTooltip } from '@coreui/react'
import TimeAgo from 'javascript-time-ago'
import en from 'javascript-time-ago/locale/en.json'
TimeAgo.addDefaultLocale(en)
import ReactTimeAgo from 'react-time-ago'

/**
Expand Down
23 changes: 16 additions & 7 deletions src/components/tables/CippTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,10 @@ export default function CippTable({

if (!disablePDFExport || !disableCSVExport) {
const keys = []
const exportFormatter = {}
columns.map((col) => {
if (col.exportSelector) keys.push(col.exportSelector)
if (col.exportFormatter) exportFormatter[col.exportSelector] = col.exportFormatter
return null
})

Expand All @@ -340,15 +342,22 @@ export default function CippTable({
keys.reduce((acc, curr) => {
const key = curr.split('/')
if (key.length > 1) {
const parent = key[0]
const subkey = key[1]
if (obj[parent] !== null && obj[parent][subkey] !== null) {
acc[curr] = obj[parent][subkey]
} else {
acc[curr] = 'n/a'
var property = obj
for (var x = 0; x < key.length; x++) {
if (property[key[x]] !== null) {
property = property[key[x]]
} else {
property = 'n/a'
break
}
}
acc[curr] = property
} else {
acc[curr] = obj[curr]
if (typeof exportFormatter[curr] === 'function') {
acc[curr] = exportFormatter[curr]({ cell: obj[curr] })
} else {
acc[curr] = obj[curr]
}
}
return acc
}, {}),
Expand Down
4 changes: 0 additions & 4 deletions src/components/utilities/CippActionsOffcanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ import { CippOffcanvasTable } from 'src/components/tables'
import { useLazyGenericGetRequestQuery, useLazyGenericPostRequestQuery } from 'src/store/api/app'
import { Link, useNavigate } from 'react-router-dom'
import { stringCamelCase } from 'src/components/utilities/CippCamelCase'
import TimeAgo from 'javascript-time-ago'

import en from 'javascript-time-ago/locale/en.json'
TimeAgo.addDefaultLocale(en)
import ReactTimeAgo from 'react-time-ago'

export default function CippActionsOffcanvas(props) {
Expand Down
4 changes: 0 additions & 4 deletions src/views/home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import Skeleton from 'react-loading-skeleton'
import { UniversalSearch } from 'src/components/utilities/UniversalSearch'
import { ActionContentCard } from 'src/components/contentcards'
import { useSelector } from 'react-redux'
import TimeAgo from 'javascript-time-ago'
import allStandardsList from 'src/data/standards'

import en from 'javascript-time-ago/locale/en.json'
TimeAgo.addDefaultLocale(en)
import ReactTimeAgo from 'react-time-ago'

const Home = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/views/identity/administration/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { cellBooleanFormatter, CellTip } from 'src/components/tables'
import { CippPageList } from 'src/components/layout'
import { TitleButton } from 'src/components/buttons'
import { CippActionsOffcanvas } from 'src/components/utilities'
import { cellLicenseFormatter } from 'src/components/tables/CellLicense'
import { cellLicenseFormatter, CellLicense } from 'src/components/tables/CellLicense'
import M365Licenses from 'src/data/M365Licenses'

const Offcanvas = (row, rowIndex, formatExtraData) => {
Expand Down Expand Up @@ -276,6 +276,7 @@ const Users = (row) => {
name: 'Licenses',
selector: (row) => row['assignedLicenses'],
exportSelector: 'assignedLicenses',
exportFormatter: CellLicense,
cell: cellLicenseFormatter(),
sortable: true,
grow: 5,
Expand Down