Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#3116 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
display tweaks
  • Loading branch information
JohnDuprey authored Jan 11, 2025
2 parents 1de8142 + de237fe commit 4a94178
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 28 deletions.
20 changes: 14 additions & 6 deletions src/components/CippCards/CippInfoBar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card, Stack, SvgIcon, Typography, Skeleton } from "@mui/material";
import { Box, Card, Stack, SvgIcon, Typography, Skeleton } from "@mui/material";
import Grid from "@mui/material/Grid";

export const CippInfoBar = ({ data, isFetching }) => (
Expand Down Expand Up @@ -31,17 +31,25 @@ export const CippInfoBar = ({ data, isFetching }) => (
}}
>
<Stack alignItems="center" direction="row" spacing={2} sx={{ p: 2 }}>
<SvgIcon color={item.color ? item.color : "primary"} fontSize="small">
{item.icon}
</SvgIcon>
<div>
{item?.icon && (
<SvgIcon color={item.color ? item.color : "primary"} fontSize="small">
{item.icon}
</SvgIcon>
)}
<Box
sx={() => {
if (!item?.icon) {
return { pl: 2 };
}
}}
>
<Typography color="text.secondary" variant="overline">
{item.name}
</Typography>
<Typography variant="h6">
{isFetching ? <Skeleton width={"100%"} /> : item.data}
</Typography>
</div>
</Box>
</Stack>
</Grid>
))}
Expand Down
8 changes: 8 additions & 0 deletions src/components/CippCards/CippPropertyListCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export const CippPropertyListCard = (props) => {
const firstHalf = propertyItems.slice(0, half);
const secondHalf = propertyItems.slice(half, propertyItems.length);

const isLabelPresent = (item) => {
return item?.label === "" || item?.label === undefined || item?.label === null;
};

const setPadding = isLabelPresent ? { py: 0.5, px: 3 } : { py: 1.5, px: 3 };

return (
<>
<Card sx={cardSx} {...other}>
Expand All @@ -56,6 +62,7 @@ export const CippPropertyListCard = (props) => {
align={align}
label={item.label}
value={<Skeleton width={280} />}
sx={setPadding}
/>
))}
</>
Expand All @@ -66,6 +73,7 @@ export const CippPropertyListCard = (props) => {
divider={showDivider}
copyItems={copyItems}
key={`${index}-index-PropertyListOffCanvas`}
sx={setPadding}
{...item}
/>
))
Expand Down
15 changes: 15 additions & 0 deletions src/components/CippComponents/CippPropertyList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ export const CippPropertyList = (props) => {
const firstHalf = propertyItems.slice(0, half);
const secondHalf = propertyItems.slice(half, propertyItems.length);

const isLabelPresent = (item) => {
return item?.label === "" || item?.label === undefined || item?.label === null;
};

const setPadding = isLabelPresent ? { py: 0.5, px: 3 } : { py: 1.5, px: 3 };
return (
<>
{layout === "single" ? (
Expand All @@ -28,6 +33,7 @@ export const CippPropertyList = (props) => {
align={align}
label={item.label}
value={<Skeleton width={280} />}
sx={setPadding}
{...item}
/>
))}
Expand All @@ -39,6 +45,7 @@ export const CippPropertyList = (props) => {
divider={showDivider}
copyItems={copyItems}
key={`${index}-index-PropertyListOffCanvas`}
sx={setPadding}
{...item}
/>
))
Expand Down Expand Up @@ -69,6 +76,7 @@ export const CippPropertyList = (props) => {
align={align}
label={item.label}
value={<Skeleton width={280} />}
sx={setPadding}
/>
))}
</>
Expand All @@ -79,6 +87,7 @@ export const CippPropertyList = (props) => {
divider={showDivider}
copyItems={copyItems}
key={`${index}-index-PropertyListOffCanvas`}
sx={setPadding}
{...item}
/>
))
Expand All @@ -93,6 +102,11 @@ export const CippPropertyList = (props) => {
align={align}
label={item.label}
value={<Skeleton width={280} />}
sx={() => {
if (item?.label === "" || item?.label === undefined || item?.label === null) {
return { py: 0 };
}
}}
/>
))}
</>
Expand All @@ -103,6 +117,7 @@ export const CippPropertyList = (props) => {
divider={showDivider}
copyItems={copyItems}
key={`${index}-index-PropertyListOffCanvas`}
sx={setPadding}
{...item}
/>
))
Expand Down
13 changes: 9 additions & 4 deletions src/components/CippComponents/CippTenantSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export const CippTenantSelector = (props) => {
? {
value: tenant,
label: `${matchingTenant.displayName} (${tenant})`,
addedFields: {
defaultDomainName: matchingTenant.defaultDomainName,
displayName: matchingTenant.displayName,
customerId: matchingTenant.customerId,
},
}
: {
value: null,
Expand Down Expand Up @@ -183,7 +188,7 @@ export const CippTenantSelector = (props) => {
actions={[
{
label: "M365 Admin Portal",
link: `https://admin.microsoft.com/Partner/BeginClientSession.aspx?CTID=${currentTenant?.value}&CSDEST=o365admincenter`,
link: `https://admin.microsoft.com/Partner/BeginClientSession.aspx?CTID=${currentTenant?.addedFields?.customerId}&CSDEST=o365admincenter`,
icon: <GlobeAltIcon />,
},
{
Expand Down Expand Up @@ -213,17 +218,17 @@ export const CippTenantSelector = (props) => {
},
{
label: "Sharepoint Portal",
link: `https://admin.microsoft.com/Partner/beginclientsession.aspx?CTID=${currentTenant?.value}&CSDEST=SharePoint`,
link: `https://admin.microsoft.com/Partner/beginclientsession.aspx?CTID=${currentTenant?.addedFields?.customerId}&CSDEST=SharePoint`,
icon: <Share />,
},
{
label: "Security Portal",
link: `https://security.microsoft.com/?tid=${currentTenant?.value}`,
link: `https://security.microsoft.com/?tid=${currentTenant?.addedFields?.customerId}`,
icon: <Shield />,
},
{
label: "Compliance Portal",
link: `https://compliance.microsoft.com/?tid=${currentTenant?.value}`,
link: `https://compliance.microsoft.com/?tid=${currentTenant?.addedFields?.customerId}`,
icon: <ShieldMoon />,
},
]}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CippSettings/CippCustomRoles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const CippCustomRoles = () => {
alltenant = true;
}
});
if (alltenant && (blockedTenants?.length === 0 || !blockedTenants)) {
if (alltenant) {
setAllTenantSelected(true);
} else {
setAllTenantSelected(false);
Expand Down Expand Up @@ -299,7 +299,7 @@ export const CippCustomRoles = () => {
name="allowedTenants"
fullWidth={true}
/>
{allTenantSelected && (
{allTenantSelected && blockedTenants?.length == 0 && (
<Alert color="warning">
All tenants selected, no tenant restrictions will be applied unless blocked tenants
are specified.
Expand Down
14 changes: 5 additions & 9 deletions src/components/property-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@ export const PropertyListItem = (props) => {
value = "",
type,
copyItems,
sx = {
px: 3,
py: 1.5,
},
...other
} = props;
const [showPassword, setShowPassword] = useState(false);
return (
<ListItem
component={component}
disableGutters
sx={{
px: 3,
py: 1.5,
}}
{...other}
>
<ListItem component={component} disableGutters sx={sx} {...other}>
<ListItemText
disableTypography
primary={
Expand Down
11 changes: 10 additions & 1 deletion src/pages/cipp/advanced/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Page = () => {
"LastOccurrence",
"Status",
"PreferredProcessor",
"ErrorMsg",
];

const offCanvas = {
Expand Down Expand Up @@ -72,7 +73,15 @@ const Page = () => {
isFetching={fetchData.isPending}
cardButton={<ResetToDefaultButton />}
offCanvas={offCanvas}
actions={[]}
actions={[
{
label: "Run Now",
type: "POST",
url: apiUrl,
data: { FunctionName: "Command", Parameters: "Parameters" },
confirmText: "Do you want to run this task now?",
},
]}
/>
<CippApiDialog
title="Reset to Default"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/cipp/settings/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const Page = () => {
<Typography variant="body2" sx={{ mt: 3, px: 3 }}>
Backups are stored in the storage account associated with your CIPP instance. You can
download or restore specific points in time from the list below. Enable automatic
updates to have CIPP create daily backups.
backups to have CIPP create daily backups using the scheduler.
</Typography>
{backupList.isSuccess ? (
<Box sx={{ mt: 3 }}>
Expand Down
15 changes: 10 additions & 5 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ const Page = () => {

// Identify which templates apply:
const applicableTemplates = standardsData.filter((template) => {
const tenantInFilter = template?.tenantFilter?.some((tf) => tf.value === currentTenant);
const tenantInFilter =
template?.tenantFilter?.length > 0 &&
template.tenantFilter.some((tf) => tf.value === currentTenant);
const allTenantsTemplate =
template.tenantFilter?.some((tf) => tf.value === "AllTenants") &&
!template.excludedTenants?.some((et) => et.value === currentTenant);
template?.tenantFilter?.length > 0 &&
template.tenantFilter.some((tf) => tf.value === "AllTenants") &&
(!template?.excludedTenants ||
(Array.isArray(template?.excludedTenants) && template?.excludedTenants?.length === 0) ||
!template?.excludedTenants?.some((et) => et.value === currentTenant));
return tenantInFilter || allTenantsTemplate;
});

Expand Down Expand Up @@ -242,10 +247,10 @@ const Page = () => {
propertyItems={organization.data?.verifiedDomains
?.slice(0, domainVisible ? undefined : 3)
.map((domain, idx) => ({
label: `Domain`,
label: "",
value: domain.name,
}))}
actions={
actionItems={
organization.data?.verifiedDomains?.length > 3 && (
<Button onClick={() => setDomainVisible(!domainVisible)}>
{domainVisible ? "See less" : "See more..."}
Expand Down

0 comments on commit 4a94178

Please sign in to comment.