Skip to content

Commit 52f8756

Browse files
Quent1OKQuent1L
authored andcommitted
app-catalog: enchance release management with filter and bulk action
Signed-off-by: Quentin Lafond <[email protected]>
1 parent 8c60a9f commit 52f8756

File tree

7 files changed

+737
-68
lines changed

7 files changed

+737
-68
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Icon } from '@iconify/react';
2+
import { Box, IconButton, Typography } from '@mui/material';
3+
4+
interface BulkActionsToolbarProps {
5+
selectedCount: number;
6+
onDelete: () => void;
7+
}
8+
9+
export function BulkActionsToolbar({ selectedCount, onDelete }: BulkActionsToolbarProps) {
10+
if (selectedCount === 0) {
11+
return null;
12+
}
13+
14+
return (
15+
<Box
16+
sx={{
17+
display: 'flex',
18+
alignItems: 'center',
19+
justifyContent: 'space-between',
20+
padding: '8px 16px',
21+
backgroundColor: 'rgba(0, 0, 0, 0.04)',
22+
borderRadius: '4px',
23+
marginBottom: '16px',
24+
}}
25+
>
26+
<Typography variant="body2">
27+
{selectedCount} {selectedCount === 1 ? 'release selected' : 'releases selected'}
28+
</Typography>
29+
<IconButton
30+
onClick={onDelete}
31+
size="small"
32+
aria-label="Delete selected releases"
33+
color="error"
34+
>
35+
<Icon icon="mdi:delete" />
36+
</IconButton>
37+
</Box>
38+
);
39+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Dialog } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
2+
import { Button, DialogActions, DialogContent, DialogContentText } from '@mui/material';
3+
4+
interface BulkDeleteDialogProps {
5+
open: boolean;
6+
count: number;
7+
isDeleting: boolean;
8+
onClose: () => void;
9+
onConfirm: () => void;
10+
}
11+
12+
export function BulkDeleteDialog({
13+
open,
14+
count,
15+
isDeleting,
16+
onClose,
17+
onConfirm,
18+
}: BulkDeleteDialogProps) {
19+
return (
20+
<Dialog open={open} maxWidth="sm" onClose={onClose} title="Uninstall Multiple Apps">
21+
<DialogContent>
22+
<DialogContentText>
23+
Are you sure you want to uninstall {count} {count === 1 ? 'release' : 'releases'}?
24+
</DialogContentText>
25+
</DialogContent>
26+
<DialogActions>
27+
<Button onClick={onClose}>{isDeleting ? 'Close' : 'No'}</Button>
28+
<Button disabled={isDeleting} onClick={onConfirm} color="error">
29+
{isDeleting ? 'Deleting...' : 'Yes'}
30+
</Button>
31+
</DialogActions>
32+
</Dialog>
33+
);
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Dialog } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
2+
import { Button, DialogActions, DialogContent, DialogContentText } from '@mui/material';
3+
4+
interface DeleteConfirmDialogProps {
5+
open: boolean;
6+
isDeleting: boolean;
7+
releaseName?: string;
8+
onClose: () => void;
9+
onConfirm: () => void;
10+
}
11+
12+
export function DeleteConfirmDialog({
13+
open,
14+
isDeleting,
15+
releaseName,
16+
onClose,
17+
onConfirm,
18+
}: DeleteConfirmDialogProps) {
19+
return (
20+
<Dialog open={open} maxWidth="sm" onClose={onClose} title="Uninstall App">
21+
<DialogContent>
22+
<DialogContentText>
23+
Are you sure you want to uninstall this release{releaseName ? ` "${releaseName}"` : ''}?
24+
</DialogContentText>
25+
</DialogContent>
26+
<DialogActions>
27+
<Button onClick={onClose}>{isDeleting ? 'Close' : 'No'}</Button>
28+
<Button disabled={isDeleting} onClick={onConfirm}>
29+
{isDeleting ? 'Deleting' : 'Yes'}
30+
</Button>
31+
</DialogActions>
32+
</Dialog>
33+
);
34+
}

0 commit comments

Comments
 (0)