@@ -13,16 +13,19 @@ import Alert from "../components/Alert";
1313import { ConfigurationSettingsField } from "../repositories/detail/ConfigurationSettingsField" ;
1414import { Heading3 } from "@podkit/typography/Headings" ;
1515
16+ export const DEFAULT_MESSAGE =
17+ "On XX-YY-ZZZZ from HH:MM to HH:MM UTC. Workspaces will be stopped and cannot be started during this time." ;
18+
1619export const MaintenanceNotificationCard : FC = ( ) => {
1720 const { isNotificationEnabled, notificationMessage, isLoading } = useMaintenanceNotification ( ) ;
1821 const setMaintenanceNotificationMutation = useSetMaintenanceNotificationMutation ( ) ;
19- const [ message , setMessage ] = useState ( notificationMessage ) ;
22+ const [ message , setMessage ] = useState ( notificationMessage || DEFAULT_MESSAGE ) ;
2023 const [ isEditing , setIsEditing ] = useState ( false ) ;
2124 const toast = useToast ( ) ;
2225
2326 // Update local state when the data from the API changes
2427 useEffect ( ( ) => {
25- setMessage ( notificationMessage ) ;
28+ setMessage ( notificationMessage || DEFAULT_MESSAGE ) ;
2629 } , [ notificationMessage ] ) ;
2730
2831 const toggleNotification = async ( ) => {
@@ -104,7 +107,7 @@ export const MaintenanceNotificationCard: FC = () => {
104107 < Button
105108 variant = "secondary"
106109 onClick = { ( ) => {
107- setMessage ( notificationMessage ) ;
110+ setMessage ( notificationMessage || DEFAULT_MESSAGE ) ;
108111 setIsEditing ( false ) ;
109112 } }
110113 >
@@ -116,11 +119,7 @@ export const MaintenanceNotificationCard: FC = () => {
116119 ) : (
117120 < div >
118121 < div className = "px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-300 min-h-[4rem]" >
119- { message || (
120- < span className = "text-gray-400 dark:text-gray-500 italic" >
121- Default message will be used
122- </ span >
123- ) }
122+ { message }
124123 </ div >
125124 < div className = "mt-2 flex justify-end" >
126125 < Button variant = "secondary" onClick = { ( ) => setIsEditing ( true ) } >
@@ -136,9 +135,7 @@ export const MaintenanceNotificationCard: FC = () => {
136135 < Alert type = "warning" className = "mb-0" >
137136 < div className = "flex items-center" >
138137 < span className = "font-semibold" > Scheduled Maintenance:</ span >
139- < span className = "ml-2" >
140- { message || "Maintenance is scheduled for this system. Please save your work." }
141- </ span >
138+ < span className = "ml-2" > { message } </ span >
142139 </ div >
143140 </ Alert >
144141 </ div >
0 commit comments