Skip to content

Commit

Permalink
Merge pull request #33 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
pull[bot] authored Jan 23, 2025
2 parents 3d50912 + 4cfeefb commit 7596fab
Show file tree
Hide file tree
Showing 5 changed files with 570 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/components/CippCards/CippPropertyListCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ export const CippPropertyListCard = (props) => {
action: item,
ready: true,
});
createDialog.handleOpen();
if (item?.noConfirm) {
item.customFunction(item, data, {});
} else {
createDialog.handleOpen();
}
}
}
disabled={handleActionDisabled(data, item)}
Expand Down
17 changes: 13 additions & 4 deletions src/components/CippComponents/CippApiDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export const CippApiDialog = (props) => {
bulkRequest: api.multiPost === false,
onResult: (result) => {
setPartialResults((prevResults) => [...prevResults, result]);
if (api?.onSuccess) {
api.onSuccess(result);
}
},
});
const actionGetRequest = ApiGetCall({
Expand All @@ -50,6 +53,9 @@ export const CippApiDialog = (props) => {
bulkRequest: api.multiPost === false,
onResult: (result) => {
setPartialResults((prevResults) => [...prevResults, result]);
if (api?.onSuccess) {
api.onSuccess(result);
}
},
});

Expand All @@ -58,6 +64,8 @@ export const CippApiDialog = (props) => {
return api.dataFunction(row);
}
var newData = {};
console.log("the received row", row);
console.log("the received dataObject", dataObject);

if (api?.postEntireRow) {
newData = row;
Expand Down Expand Up @@ -85,6 +93,7 @@ export const CippApiDialog = (props) => {
}
});
}
console.log("output", newData);
return newData;
};
const tenantFilter = useSettings().currentTenant;
Expand Down Expand Up @@ -209,10 +218,10 @@ export const CippApiDialog = (props) => {
}
useEffect(() => {
if (api.noConfirm) {
formHook.handleSubmit(onSubmit)();
createDialog.handleClose();
formHook.handleSubmit(onSubmit)(); // Submits the form on mount
createDialog.handleClose(); // Closes the dialog after submitting
}
}, [api.noConfirm]);
}, [api.noConfirm]); // Run effect only when api.noConfirm changes

const handleClose = () => {
createDialog.handleClose();
Expand Down Expand Up @@ -251,7 +260,7 @@ export const CippApiDialog = (props) => {
Close
</Button>
<Button variant="contained" type="submit">
{actionGetRequest.isSuccess || actionPostRequest.isSuccess ? "Resubmit" : "Submit"}
Confirm
</Button>
</DialogActions>
</form>
Expand Down
5 changes: 5 additions & 0 deletions src/layouts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ export const nativeMenuItems = [
path: "/cipp/advanced/timers",
roles: ["superadmin"],
},
{
title: "Table Maintenance",
path: "/cipp/advanced/table-maintenance",
roles: ["superadmin"],
}
],
},
],
Expand Down
Loading

0 comments on commit 7596fab

Please sign in to comment.