Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0cf6d47
Update function-offloading.js
JohnDuprey Mar 26, 2025
4bbc9c8
include extra data in api results
JohnDuprey Mar 26, 2025
9a393da
fix: make AllowListAdd not required
OfficialEsco Mar 26, 2025
7be11d3
Update CippCustomVariables.jsx to Reflect Lowercase Best Practice
bmsimp Mar 26, 2025
163c2bf
table fixes
JohnDuprey Mar 26, 2025
afff334
remove logging
JohnDuprey Mar 26, 2025
2d4c15d
ensure the dialog box actually closes on links
JohnDuprey Mar 26, 2025
a32598a
Update licenses to newest MS list
kris6673 Mar 26, 2025
b719e40
do not render dialog box for links
JohnDuprey Mar 27, 2025
6d12d7b
revert version change
JohnDuprey Mar 27, 2025
87b52aa
Delete yarn.lock
JohnDuprey Mar 27, 2025
60be81c
report filters
JohnDuprey Mar 28, 2025
45819b9
Revert "Delete yarn.lock"
JohnDuprey Mar 28, 2025
ae5c2b2
Update yarn.lock
JohnDuprey Mar 28, 2025
901dd52
pretty filters
JohnDuprey Mar 28, 2025
59a4d19
Update index.js
JohnDuprey Mar 28, 2025
34a718a
Update index.js
JohnDuprey Mar 28, 2025
ca1ab19
filter counts
JohnDuprey Mar 28, 2025
f987074
move info to chips
JohnDuprey Mar 28, 2025
ab2da4a
Update index.js
JohnDuprey Mar 28, 2025
8cd3c3b
Update index.js
JohnDuprey Mar 28, 2025
36a90c1
https://github.com/KelvinTegelaar/CIPP/issues/3759
KelvinTegelaar Mar 28, 2025
61b4690
add punycode
KelvinTegelaar Mar 28, 2025
b1a19a7
add punycode for domains
KelvinTegelaar Mar 28, 2025
d89c55c
fix firefox bug
JohnDuprey Mar 28, 2025
765f53b
up version
JohnDuprey Mar 28, 2025
dd3f469
Merge pull request #3878 from kris6673/chore-licenses
JohnDuprey Mar 28, 2025
0e1eec9
Merge pull request #3874 from bmsimp/patch-3
JohnDuprey Mar 28, 2025
4aaac62
Merge pull request #3867 from Ren-Roros-Digital/AllowListAdd
JohnDuprey Mar 28, 2025
ba93cd1
Merge branch 'main' into dev
JohnDuprey Mar 28, 2025
c74d16c
Merge pull request #3890 from KelvinTegelaar/dev
JohnDuprey Mar 28, 2025
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: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "AGPL-3.0",
"engines": {
"node": "^20.18.3"
"node": "^22.13.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -71,6 +71,7 @@
"nprogress": "0.2.0",
"numeral": "2.0.6",
"prop-types": "15.8.1",
"punycode": "^2.3.1",
"react": "19.0.0",
"react-apexcharts": "1.7.0",
"react-beautiful-dnd": "13.1.1",
Expand Down
2 changes: 1 addition & 1 deletion public/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "7.4.1"
"version": "7.4.2"
}
4 changes: 3 additions & 1 deletion src/components/CippCards/CippDomainCards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { CippCodeBlock } from "/src/components/CippComponents/CippCodeBlock";
import { CippOffCanvas } from "../CippComponents/CippOffCanvas";
import { CippPropertyListCard } from "./CippPropertyListCard";
import { getCippFormatting } from "../../utils/get-cipp-formatting";
import punycode from "punycode";

const ResultList = ({ passes = [], warns = [], fails = [] }) => (
<Stack direction="column" sx={{ mt: 1 }}>
Expand Down Expand Up @@ -395,7 +396,8 @@ export const CippDomainCards = ({ domain: propDomain = "", fullwidth = false })
}, [propDomain, setValue]);

const onSubmit = (values) => {
setDomain(values.domain);
const punycodedDomain = punycode.toASCII(values.domain);
setDomain(punycodedDomain);
setSelector(values.dkimSelector);
setSpfRecord(values.spfRecord);
setSubdomains(values.subdomains);
Expand Down
130 changes: 68 additions & 62 deletions src/components/CippComponents/CippApiDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,38 +282,36 @@ export const CippApiDialog = (props) => {
.reduce((acc, key) => (acc && acc[key] !== undefined ? acc[key] : undefined), obj);
};

// Handling external link navigation
useEffect(() => {
if (api.link && createDialog.open) {
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
return getNestedValue(row, key) || `[${key}]`;
});
const [linkClicked, setLinkClicked] = useState(false);

if (!linkWithRowData.startsWith("/")) {
window.open(linkWithRowData, api.target || "_blank");
createDialog.handleClose();
}
}
}, [api.link, createDialog.open]);
useEffect(() => {
if (api.link && !linkClicked && row && Object.keys(row).length > 0) {
const timeoutId = setTimeout(() => {
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
return getNestedValue(row, key) || `[${key}]`;
});

// Handling internal link navigation
if (api.link && createDialog.open) {
const linkWithRowData = api.link.replace(/\[([^\]]+)\]/g, (_, key) => {
return getNestedValue(row, key) || `[${key}]`;
});
if (linkWithRowData.startsWith("/")) {
// Internal link navigation
setLinkClicked(true);
router.push(linkWithRowData, undefined, { shallow: true });
} else {
// External link navigation
setLinkClicked(true);
window.open(linkWithRowData, api.target || "_blank");
}
}, 0); // Delay execution to the next event loop cycle

if (linkWithRowData.startsWith("/")) {
router.push(linkWithRowData, undefined, { shallow: true });
createDialog.handleClose();
return () => clearTimeout(timeoutId);
}
}
}, [api.link, linkClicked, row, router]);

useEffect(() => {
if (api.noConfirm) {
if (api.noConfirm && !api.link) {
formHook.handleSubmit(onSubmit)(); // Submits the form on mount
createDialog.handleClose(); // Closes the dialog after submitting
}
}, [api.noConfirm]); // Run effect only when api.noConfirm changes
}, [api.noConfirm, api.link]); // Run effect when noConfirm or link changes

const handleClose = () => {
createDialog.handleClose();
Expand All @@ -336,44 +334,52 @@ export const CippApiDialog = (props) => {
}

return (
<Dialog fullWidth maxWidth="sm" onClose={handleClose} open={createDialog.open} {...other}>
<form onSubmit={formHook.handleSubmit(onSubmit)}>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<Stack spacing={2}>{confirmText}</Stack>
</DialogContent>
<DialogContent>
<Grid container spacing={2}>
{fields &&
fields.map((fieldProps, index) => {
if (fieldProps?.api?.processFieldData) {
fieldProps.api.data = processActionData(fieldProps.api.data, row);
}
return (
<Grid item xs={12} key={index}>
<CippFormComponent
formControl={formHook}
addedFieldData={addedFieldData}
setAddedFieldData={setAddedFieldData}
{...fieldProps}
/>
</Grid>
);
})}
</Grid>
</DialogContent>
<DialogContent>
<CippApiResults apiObject={{ ...selectedType, data: partialResults }} />
</DialogContent>
<DialogActions>
<Button color="inherit" onClick={() => handleClose()}>
Close
</Button>
<Button variant="contained" type="submit" disabled={isFormSubmitted && !allowResubmit}>
{isFormSubmitted && allowResubmit ? "Reconfirm" : "Confirm"}
</Button>
</DialogActions>
</form>
</Dialog>
<>
{!api?.link && (
<Dialog fullWidth maxWidth="sm" onClose={handleClose} open={createDialog.open} {...other}>
<form onSubmit={formHook.handleSubmit(onSubmit)}>
<DialogTitle>{title}</DialogTitle>
<DialogContent>
<Stack spacing={2}>{confirmText}</Stack>
</DialogContent>
<DialogContent>
<Grid container spacing={2}>
{fields &&
fields.map((fieldProps, index) => {
if (fieldProps?.api?.processFieldData) {
fieldProps.api.data = processActionData(fieldProps.api.data, row);
}
return (
<Grid item xs={12} key={index}>
<CippFormComponent
formControl={formHook}
addedFieldData={addedFieldData}
setAddedFieldData={setAddedFieldData}
{...fieldProps}
/>
</Grid>
);
})}
</Grid>
</DialogContent>
<DialogContent>
<CippApiResults apiObject={{ ...selectedType, data: partialResults }} />
</DialogContent>
<DialogActions>
<Button color="inherit" onClick={() => handleClose()}>
Close
</Button>
<Button
variant="contained"
type="submit"
disabled={isFormSubmitted && !allowResubmit}
>
{isFormSubmitted && allowResubmit ? "Reconfirm" : "Confirm"}
</Button>
</DialogActions>
</form>
</Dialog>
)}
</>
);
};
4 changes: 3 additions & 1 deletion src/components/CippComponents/CippApiResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const extractAllResults = (data) => {

if (item && typeof item === "object") {
const text = item.resultText || "";
const copyField = item.copyField || text;
const copyField = item.copyField || "";
const severity =
typeof item.state === "string" ? item.state : getSeverity(item) ? "error" : "success";

Expand All @@ -47,6 +47,7 @@ const extractAllResults = (data) => {
text,
copyField,
severity,
...item,
};
}
}
Expand Down Expand Up @@ -172,6 +173,7 @@ export const CippApiResults = (props) => {
copyField: res.copyField,
severity: res.severity,
visible: true,
...res,
}))
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/components/CippComponents/CippCustomVariables.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const CippCustomVariables = ({ id }) => {
<CardContent>
<Alert severity="info" sx={{ mb: 2 }}>
{id === "AllTenants"
? "Global variables are key-value pairs that can be used to store additional information for All Tenants. These are applied to templates in standards using the format %VariableName%. If a tenant has a custom variable with the same name, the tenant's variable will take precedence."
: "Custom variables are key-value pairs that can be used to store additional information about a tenant. These are applied to templates in standards using the format %VariableName%."}
? "Global variables are key-value pairs that can be used to store additional information for All Tenants. These are applied to templates in standards using the format %variablename%. If a tenant has a custom variable with the same name, the tenant's variable will take precedence."
: "Custom variables are key-value pairs that can be used to store additional information about a tenant. These are applied to templates in standards using the format %variablename%."}
</Alert>
<CippDataTable
queryKey={`CustomVariables_${id}`}
Expand Down
23 changes: 16 additions & 7 deletions src/components/CippTable/CippDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { CippApiDialog } from "../CippComponents/CippApiDialog";
import { getCippError } from "../../utils/get-cipp-error";
import { Box } from "@mui/system";
import { useSettings } from "../../hooks/use-settings";
import { isEqual } from "lodash"; // Import lodash for deep comparison

export const CippDataTable = (props) => {
const {
Expand Down Expand Up @@ -79,9 +80,11 @@ export const CippDataTable = (props) => {

useEffect(() => {
if (Array.isArray(data) && !api?.url) {
setUsedData(data);
if (!isEqual(data, usedData)) {
setUsedData(data);
}
}
}, [data, api?.url]);
}, [data, api?.url, usedData]);

useEffect(() => {
if (getRequestData.isSuccess && !getRequestData.isFetching) {
Expand Down Expand Up @@ -127,7 +130,13 @@ export const CippDataTable = (props) => {
queryKey,
]);
useEffect(() => {
if (!Array.isArray(usedData) || usedData.length === 0 || typeof usedData[0] !== "object") {
if (
!Array.isArray(usedData) ||
usedData.length === 0 ||
typeof usedData[0] !== "object" ||
usedData === null ||
usedData === undefined
) {
return;
}
const apiColumns = utilColumnsFromAPI(usedData);
Expand Down Expand Up @@ -156,7 +165,7 @@ export const CippDataTable = (props) => {
}
setUsedColumns(finalColumns);
setColumnVisibility(newVisibility);
}, [columns.length, usedData.length, queryKey]);
}, [columns.length, usedData, queryKey]);

const createDialog = useDialog();

Expand Down Expand Up @@ -195,7 +204,7 @@ export const CippDataTable = (props) => {
},
}),
columns: memoizedColumns,
data: memoizedData,
data: memoizedData ?? [],
state: {
columnVisibility,
sorting,
Expand Down Expand Up @@ -294,8 +303,8 @@ export const CippDataTable = (props) => {
data={data}
columnVisibility={columnVisibility}
getRequestData={getRequestData}
usedColumns={usedColumns}
usedData={usedData}
usedColumns={memoizedColumns}
usedData={memoizedData ?? []}
title={title}
actions={actions}
exportEnabled={exportEnabled}
Expand Down
Loading