Skip to content
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

More theme fixes/improvements. #559

Merged
merged 6 commits into from
Jan 10, 2022
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"start-api": "swa start --ssl --ssl-cert ./.vscode/cert.crt --ssl-key ./.vscode/key.key --swa-config-location . http://localhost:3000 --api-location http://localhost:7071"
},
"config": {
"coreui_library_short_version": "4.0"
"coreui_library_short_version": "4.1"
},
"dependencies": {
"@coreui/chartjs": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import React from 'react'
import PropTypes from 'prop-types'
import {
CListGroup,
CListGroupItem,
COffcanvasTitle,
CTable,
CTableBody,
CTableDataCell,
CTableRow,
} from '@coreui/react'
import { CListGroup, CListGroupItem, COffcanvasTitle } from '@coreui/react'
import CippOffcanvas, { CippOffcanvasPropTypes } from './CippOffcanvas'
import CippOffcanvasTable from './CippOffcanvasTable'

export default function CippGroupedOffcanvas(props) {
const extendedInfoContent = props.extendedInfo.map((info, index) => (
<>
<CTableRow key={index}>
<CTableDataCell className="cipp-extendedinfo-label">{info.label}</CTableDataCell>
<CTableDataCell>{info.value}</CTableDataCell>
</CTableRow>
</>
))
export default function CippActionsOffcanvas(props) {
const extendedInfoContent = <CippOffcanvasTable rows={props.extendedInfo} guid={props.id} />
const actionsContent = props.actions.map((action, index) => (
<CListGroup layout="horizontal-md" key={index}>
<CListGroupItem
Expand All @@ -42,16 +28,14 @@ export default function CippGroupedOffcanvas(props) {
hideFunction={props.hideFunction}
>
<COffcanvasTitle>Extended Information</COffcanvasTitle>
<CTable small borderless responsive align="top" style={{ fontSize: 'smaller' }}>
<CTableBody>{extendedInfoContent}</CTableBody>
</CTable>
{extendedInfoContent}
{<COffcanvasTitle>Actions</COffcanvasTitle>}
{actionsContent}
</CippOffcanvas>
)
}

const CippGroupedOffcanvasPropTypes = {
const CippActionsOffcanvasPropTypes = {
extendedInfo: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string,
Expand All @@ -66,7 +50,8 @@ const CippGroupedOffcanvasPropTypes = {
color: PropTypes.string,
}),
).isRequired,
rowIndex: PropTypes.number,
...CippOffcanvasPropTypes,
}

CippGroupedOffcanvas.propTypes = CippGroupedOffcanvasPropTypes
CippActionsOffcanvas.propTypes = CippActionsOffcanvasPropTypes
12 changes: 12 additions & 0 deletions src/components/cipp/CippOffcanvasListGroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import { useListDatatableQuery } from 'src/store/api/datatable'
import PropTypes from 'prop-types'
import { CListGroup, CListGroupItem } from '@coreui/react'

export default function CippDatatable({ path, params, ...rest }) {}

CippDatatable.propTypes = {
path: PropTypes.string.isRequired,
params: PropTypes.object,
...CippTablePropTypes,
}
27 changes: 27 additions & 0 deletions src/components/cipp/CippOffcanvasTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import PropTypes from 'prop-types'
import { CTable, CTableBody, CTableRow, CTableDataCell } from '@coreui/react'

export default function CippOffcanvasTable({ rows }) {
const tableRows = rows.map((row, index, guid) => (
<CTableRow className="cipp-offcanvastable-row" key={`${guid}-${index}`}>
<CTableDataCell className="cipp-offcanvastable-label">{row.label}</CTableDataCell>
<CTableDataCell className="cipp-offcanvastable-value">{row.value}</CTableDataCell>
</CTableRow>
))
return (
<CTable small borderless responsive align="top" className="cipp-offcanvastable">
<CTableBody>{tableRows}</CTableBody>
</CTable>
)
}

CippOffcanvasTable.propTypes = {
rows: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string,
value: PropTypes.any,
}),
).isRequired,
guid: PropTypes.string,
}
3 changes: 2 additions & 1 deletion src/components/cipp/CippTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export default function CippTable({

return (
<div className="ms-n3 me-n3 cipp-tablewrapper">
{isFetching && <CSpinner />}
{!isFetching && error && <span>Error loading data</span>}
{!isFetching && !error && (
<div>
Expand All @@ -166,6 +165,8 @@ export default function CippTable({
defaultSortAsc
defaultSortFieldId={1}
paginationPerPage={25}
loading={isFetching}
progressComponent={<CSpinner size="sm" color="info" component="div" />}
paginationRowsPerPageOptions={[25, 50, 100, 200, 500]}
{...rest}
/>
Expand Down
6 changes: 4 additions & 2 deletions src/components/cipp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import TenantSelectorMultiple from './TenantSelectorMultiple'
import ThemeSwitcher from './ThemeSwitcher'
import TitleButton from './TitleButton'
import CippOffcanvas from './CippOffcanvas'
import CippGroupedOffcanvas from './CippGroupedOffcanvas'
import CippActionsOffcanvas from './CippActionsOffcanvas'
import CippOffcanvasTable from './CippOffcanvasTable'

export {
CellBadge,
Expand All @@ -28,7 +29,8 @@ export {
CippDatatable,
CippTable,
CippOffcanvas,
CippGroupedOffcanvas,
CippActionsOffcanvas,
CippOffcanvasTable,
PdfButton,
StatusIcon,
TenantSelector,
Expand Down
29 changes: 29 additions & 0 deletions src/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@
}
}

.cipp-offcanvastable {
font-size: smaller;
}


.dropdown-item {
a {
color: var(--cui-dropdown-link-color);
Expand Down Expand Up @@ -192,6 +197,30 @@

/* CIPP Text */

.bg-primary {
background-color: var(--cui-primary) !important;
}

.bg-secondary {
background-color: var(--cui-secondary) !important;
}

.bg-success {
background-color: var(--cui-success) !important;
}

.bg-info {
background-color: var(--cui-info) !important;
}

.bg-warning {
background-color: var(--cui-warning) !important;
}

.bg-danger {
background-color: var(--cui-danger) !important;
}

.text-primary {
color: var(--cui-primary) !important;
}
Expand Down
3 changes: 3 additions & 0 deletions src/scss/_themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
--cui-card-cap-color: var(--cyberdrain-light);
--cui-card-cap-bg: var(--cyberdrain-accent-blue);
--cui-border-radius: ;
--cui-badge-color: var(--cyberdrain-dark);
// CIPP theme-independent variables.
--cipp-border-radius: 0;
--cipp-offcanvas-header-bg: var(--cyberdrain-accent-green);
Expand Down Expand Up @@ -239,6 +240,7 @@
--cui-modal-header-bg: var(--cyberdrain-light);
--cui-modal-header-border-color: var(--cyberdrain-accent-green);
--cui-modal-header-color: var(--cyberdrain-dark);
--cui-progress-bg: var(--cyberdrain-lighter);
--cui-nav-link-color: var(--cyberdrain-dark);
--cui-nav-tabs-link-active-bg: var(--cyberdrain-lighter);
--cui-nav-tabs-link-active-color: var(--cyberdrain-dark);
Expand Down Expand Up @@ -328,6 +330,7 @@
--cui-modal-header-bg: var(--cyberdrain-dark);
--cui-modal-header-border-color: var(--cyberdrain-accent-green);
--cui-modal-header-color: var(--cyberdrain-light);
--cui-progress-bg: var(--cyberdrain-darker);
--cui-nav-link-color: var(--cyberdrain-light);
--cui-nav-tabs-link-active-bg: var(--cyberdrain-darker);
--cui-nav-tabs-link-active-color: var(--cyberdrain-light);
Expand Down
13 changes: 3 additions & 10 deletions src/views/endpoint/applications/ApplicationsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ import { useSelector } from 'react-redux'
import { CButton } from '@coreui/react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { CippPageList } from 'src/components'
import {
faCog,
faEllipsisV,
faGlobe,
faGlobeEurope,
faPager,
faUser,
} from '@fortawesome/free-solid-svg-icons'
import { CippOffcanvas } from 'src/components/cipp'
import { faEllipsisV, faGlobeEurope, faPager, faUser } from '@fortawesome/free-solid-svg-icons'
import { CippActionsOffcanvas } from 'src/components/cipp'

const Offcanvas = (row, rowIndex, formatExtraData) => {
const tenant = useSelector((state) => state.app.currentTenant)
Expand All @@ -27,7 +20,7 @@ const Offcanvas = (row, rowIndex, formatExtraData) => {
<CButton size="sm" color="link" onClick={() => setOCVisible(true)}>
<FontAwesomeIcon icon={faEllipsisV} />
</CButton>
<CippOffcanvas
<CippActionsOffcanvas
title="User information"
extendedInfo={[
{ label: 'Install as', value: `${row.installExperience.runAsAccount}` },
Expand Down
2 changes: 1 addition & 1 deletion src/views/identity/administration/Groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const columns = [
sortable: true,
},
{
name: 'Action',
name: 'Actions',
cell: Offcanvas,
},
]
Expand Down
23 changes: 13 additions & 10 deletions src/views/identity/administration/UserGroups.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react'
import PropTypes from 'prop-types'
import { CCard, CCardBody, CCardHeader, CCardTitle, CLink, CSpinner } from '@coreui/react'
import { CellBoolean, CippDatatable } from '../../../components/cipp'
import { CellBoolean, CippDatatable } from 'src/components/cipp'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faUsers } from '@fortawesome/free-solid-svg-icons'
import { useListUserGroupsQuery } from '../../../store/api/groups'
import { useListUserGroupsQuery } from 'src/store/api/groups'

const formatter = (cell) => CellBoolean({ cell })

const columns = [
{
name: 'Display Name',
selector: 'DisplayName',
selector: (row) => row['DisplayName'],
formatter: (cell, row) => {
return (
<CLink
Expand All @@ -24,30 +24,30 @@ const columns = [
},
{
name: 'Mail Enabled',
selector: 'MailEnabled',
selector: (row) => row['MailEnabled'],
formatter,
},
{
name: 'Email Address',
selector: 'Mail',
selector: (row) => row['Mail'],
},
{
name: 'Security Group',
selector: 'SecurityGroup',
selector: (row) => row['SecurityGroup'],
formatter,
},
{
name: 'Group Types',
selector: 'GroupTypes',
selector: (row) => row['GroupTypes'],
},
{
name: 'On Premises Sync',
selector: 'OnPremisesSync',
selector: (row) => row['OnPremisesSync'],
formatter,
},
{
name: 'Assignable To Role',
selector: 'IsAssignableToRole',
selector: (row) => row['IsAssignableToRole'],
formatter,
},
]
Expand All @@ -69,13 +69,16 @@ export default function UserGroups({ userId, tenantDomain }) {
{!isFetching && error && <>Error loading groups</>}
{!isFetching && !error && (
<CippDatatable
path="/api/ListUserGroups"
params={{ tenantFilter: tenantDomain, userId }}
keyField="id"
columns={columns}
data={mapped}
striped
bordered={false}
dense
wrapperClasses="table-responsive"
responsive={true}
disablePDFExport={true}
/>
)}
</CCardBody>
Expand Down
Loading