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

[pull] dev from KelvinTegelaar:dev #37

Merged
merged 3 commits into from
Jan 24, 2025
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
18 changes: 9 additions & 9 deletions src/layouts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ export const nativeMenuItems = [
{ title: "Message Viewer", path: "/email/tools/message-viewer" },
],
},
// {
// title: "Dark Web Tools",
// path: "/tools/darkweb",
// items: [
// { title: "Tenant Breach Lookup", path: "/tools/tenantbreachlookup" },
// { title: "Breach Lookup", path: "/tools/breachlookup" },
// ],
// },
{
title: "Dark Web Tools",
path: "/tools/darkweb",
items: [
{ title: "Tenant Breach Lookup", path: "/tools/tenantbreachlookup" },
{ title: "Breach Lookup", path: "/tools/breachlookup" },
],
},
{
title: "Template Library",
path: "/tools/templatelib",
Expand Down Expand Up @@ -476,7 +476,7 @@ export const nativeMenuItems = [
title: "Table Maintenance",
path: "/cipp/advanced/table-maintenance",
roles: ["superadmin"],
}
},
],
},
],
Expand Down
29 changes: 14 additions & 15 deletions src/pages/tenant/standards/bpa-report/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
SvgIcon,
Skeleton,
Chip,
Alert,
} from "@mui/material";
import Head from "next/head";
import { ArrowLeftIcon } from "@mui/x-date-pickers";
Expand All @@ -22,6 +23,7 @@ import { CippImageCard } from "../../../../components/CippCards/CippImageCard";
import _ from "lodash";
const Page = () => {
const router = useRouter();
const { id } = router.query;
const [blockCards, setBlockCards] = useState([]);
const [layoutMode, setLayoutMode] = useState("Table");
const bpaTemplateList = ApiGetCall({
Expand All @@ -33,8 +35,9 @@ const Page = () => {
url: "/api/listBPA",
data: {
tenantFilter: tenantFilter,
report: id,
},
queryKey: "ListBPA",
queryKey: `ListBPA-${id}-${tenantFilter}`,
});
const tenantInfo = ApiGetCall({
url: "/api/ListTenants",
Expand All @@ -51,7 +54,6 @@ const Page = () => {
setLayoutMode(bpaTemplate.Style);
if (bpaTemplate.Style === "Tenant") {
const frontendFields = bpaTemplate.Data.map((block) => block.FrontendFields[0]);

if (bpaData.isSuccess) {
const tenantId = tenantInfo?.data.find(
(tenant) => tenant?.defaultDomainName === tenantFilter
Expand All @@ -62,7 +64,7 @@ const Page = () => {
//instead of this, use lodash to get the data for blockData
const blockData = _.get(tenantData, field.value)
? _.get(tenantData, field.value)
: ["No Data"];
: undefined;
return {
name: field.name,
value: field.value,
Expand Down Expand Up @@ -92,21 +94,12 @@ const Page = () => {
//sometimes the subField contains a space. Only take the first part of the subField if it does.
subField?.value?.includes(" ") ? subField.value.split(" ")[0] : subField.value
);

tenantData = Array.isArray(tenantData) ? tenantData : [tenantData];
//filter down tenantData to only the fields listOfFrontEndFields
tenantData = tenantData.map((data) => {
const filteredData = {};
listOfFrontEndFields.unshift("Tenant");
listOfFrontEndFields.forEach((field) => {
//we need to get the correct key, but the key is nested and can contain dots, or []. So we use lodash get to get the correct key.
const dataField = _.get(data, field) ? _.get(data, field) : "No Data";
if (dataField === "FAILED") {
filteredData[field] = "Failed";
} else {
filteredData[field] = dataField;
}
});
return filteredData;
return data;
});
const cards = {
simpleColumns: listOfFrontEndFields,
Expand Down Expand Up @@ -189,7 +182,13 @@ const Page = () => {
</Typography>
}
>
{block.formatter === "String" ? (
{block.data === undefined ? (
<Alert severity="info">
No data has been found for this item. This tenant might not be licensed
for this feature, or data collection failed. Please check the logs for
more information.
</Alert>
) : block.formatter === "String" ? (
<Typography variant="h6" color="textPrimary">
{block.data}
</Typography>
Expand Down
7 changes: 7 additions & 0 deletions src/pages/tools/breachlookup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Link,
Chip,
Avatar,
Alert,
} from "@mui/material";
import { Layout as DashboardLayout } from "/src/layouts/index.js";
import { useForm, useWatch } from "react-hook-form";
Expand Down Expand Up @@ -54,6 +55,12 @@ const Page = () => {
<Grid container spacing={3}>
<Grid container item spacing={4}>
<Grid item spacing={4} xs={4}>
<Alert severity="info">
<Typography variant="body1" color="textPrimary">
This page is in beta and may not always give expected results.
</Typography>
</Alert>

<CippButtonCard title="Breach lookup">
<Grid container spacing={2}>
<Grid item xs={8}>
Expand Down
6 changes: 3 additions & 3 deletions src/utils/get-cipp-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
? data.join(", ")
: data.map((item) => (
<CippCopyToClipBoard
key={`${item.label}`}
text={item.label ? item.label : item}
key={`${item?.label}`}
text={item?.label ? item?.label : item}
type="chip"
/>
));
} else {
return isText ? (
data
) : (
<CippCopyToClipBoard text={data.label ? data.label : data} type="chip" />
<CippCopyToClipBoard text={data?.label ? data?.label : data} type="chip" />
);
}
}
Expand Down