@@ -2,7 +2,9 @@ import { Workspace } from "api/typesGenerated"
2
2
import { displayImpendingDeletion } from "./utils"
3
3
import { useDashboard } from "components/Dashboard/DashboardProvider"
4
4
import { Alert } from "components/Alert/Alert"
5
- import { formatDistanceToNow , differenceInDays } from "date-fns"
5
+ import { formatDistanceToNow , differenceInDays , add , format } from "date-fns"
6
+ import Link from "@mui/material/Link"
7
+ import { Link as RouterLink } from "react-router-dom"
6
8
7
9
export enum Count {
8
10
Singular ,
@@ -46,17 +48,34 @@ export const ImpendingDeletionBanner = ({
46
48
new Date ( ) ,
47
49
)
48
50
51
+ const plusFourteen = add ( new Date ( ) , { days : 14 } )
52
+
49
53
return (
50
54
< Alert
51
55
severity = { daysUntilDelete <= 7 ? "warning" : "info" }
52
56
onDismiss = { onDismiss }
53
57
dismissible
54
58
>
55
- { count === Count . Singular
56
- ? `This workspace has been unused for ${ formatDistanceToNow (
57
- Date . parse ( workspace . last_used_at ) ,
58
- ) } and is scheduled for deletion. To keep it, connect via SSH or the web terminal.`
59
- : "You have workspaces that will be deleted soon due to inactivity. To keep these workspaces, connect to them via SSH or the web terminal." }
59
+ { count === Count . Singular ? (
60
+ `This workspace has been unused for ${ formatDistanceToNow (
61
+ Date . parse ( workspace . last_used_at ) ,
62
+ ) } and is scheduled for deletion. To keep it, connect via SSH or the web terminal.`
63
+ ) : (
64
+ < >
65
+ < span > There are</ span > { " " }
66
+ < Link
67
+ component = { RouterLink }
68
+ to = { `/workspaces?filter=deleting_by:${ format (
69
+ plusFourteen ,
70
+ "y-MM-dd" ,
71
+ ) } `}
72
+ >
73
+ workspaces
74
+ </ Link > { " " }
75
+ that will be deleted soon due to inactivity. To keep these workspaces,
76
+ connect to them via SSH or the web terminal.
77
+ </ >
78
+ ) }
60
79
</ Alert >
61
80
)
62
81
}
0 commit comments