fix(monitors): address PR feedback on mobile card views and modal selection state
This commit is contained in:
1 parent
eeee6db94e
commit
7a5ee6ba05
4 files changed
+39
-11
No files matched your search
@@ -142,7 +142,7 @@ export function DataTable<
|
||||
>
|
||||
<Typography
|
||||
component="div"
|
||||
color={theme.palette.text.primary}
|
||||
color={theme.palette.text.secondary}
|
||||
>
|
||||
{header.mobileLabel ?? header.content}
|
||||
</Typography>
|
||||
|
||||
@@ -14,14 +14,14 @@ interface BulkEditNotificationsModalProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
selectedMonitors: string[];
|
||||
onSuccess: () => void;
|
||||
onComplete: (success: boolean) => void;
|
||||
}
|
||||
|
||||
export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProps> = ({
|
||||
open,
|
||||
onClose,
|
||||
selectedMonitors,
|
||||
onSuccess,
|
||||
onComplete,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
@@ -55,9 +55,7 @@ export const BulkEditNotificationsModal: React.FC<BulkEditNotificationsModalProp
|
||||
action,
|
||||
});
|
||||
|
||||
if (res) {
|
||||
onSuccess();
|
||||
}
|
||||
onComplete(!!res);
|
||||
};
|
||||
|
||||
// Prevent submitting empty arrays unless the action is 'set' (as per PR feedback!)
|
||||
|
||||
@@ -291,6 +291,35 @@ export const MonitorTable = ({
|
||||
|
||||
return (
|
||||
<Box>
|
||||
{isSmall && (
|
||||
<Box px={1} pb={2}>
|
||||
<Stack
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
spacing={1}
|
||||
>
|
||||
<Checkbox
|
||||
checked={monitors.length > 0 && selectedMonitors.length === monitors.length}
|
||||
indeterminate={
|
||||
selectedMonitors.length > 0 && selectedMonitors.length < monitors.length
|
||||
}
|
||||
onChange={(e) => {
|
||||
if (e.target.checked) {
|
||||
onSelectAll(monitors.map((m) => m.id));
|
||||
} else {
|
||||
onSelectAll([]);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Typography
|
||||
variant="body2"
|
||||
color="text.secondary"
|
||||
>
|
||||
{t("common.selectAll", "Select All")}
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Box>
|
||||
)}
|
||||
<Table
|
||||
headers={headers}
|
||||
data={monitors}
|
||||
|
||||
@@ -137,10 +137,12 @@ const UptimeMonitorsPage = () => {
|
||||
refetch();
|
||||
};
|
||||
|
||||
const handleBulkEditSuccess = () => {
|
||||
const handleBulkEditComplete = (success: boolean) => {
|
||||
setIsBulkEditModalOpen(false);
|
||||
setSelectedRows([]);
|
||||
refetch();
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
refetch();
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@@ -267,12 +269,11 @@ const UptimeMonitorsPage = () => {
|
||||
onCancel={handleCancel}
|
||||
loading={isDeleting}
|
||||
/>
|
||||
|
||||
<BulkEditNotificationsModal
|
||||
open={isBulkEditModalOpen}
|
||||
onClose={() => setIsBulkEditModalOpen(false)}
|
||||
selectedMonitors={selectedRows}
|
||||
onSuccess={handleBulkEditSuccess}
|
||||
onComplete={handleBulkEditComplete}
|
||||
/>
|
||||
</MonitorBasePageWithStates>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user