summaryrefslogtreecommitdiff
path: root/Assistant/Alert.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Alert.hs')
-rw-r--r--Assistant/Alert.hs18
1 files changed, 13 insertions, 5 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index df5ee2910..e7b731a8c 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -27,17 +27,19 @@ import Assistant.WebApp
import Yesod
#endif
-{- Makes a button for an alert that opens a Route. The button will
- - close the alert it's attached to when clicked. -}
+{- Makes a button for an alert that opens a Route.
+ -
+ - If autoclose is set, the button will close the alert it's
+ - attached to when clicked. -}
#ifdef WITH_WEBAPP
-mkAlertButton :: T.Text -> UrlRenderer -> Route WebApp -> Assistant AlertButton
-mkAlertButton label urlrenderer route = do
+mkAlertButton :: Bool -> T.Text -> UrlRenderer -> Route WebApp -> Assistant AlertButton
+mkAlertButton autoclose label urlrenderer route = do
close <- asIO1 removeAlert
url <- liftIO $ renderUrl urlrenderer route []
return $ AlertButton
{ buttonLabel = label
, buttonUrl = url
- , buttonAction = Just close
+ , buttonAction = if autoclose then Just close else Nothing
}
#endif
@@ -147,6 +149,12 @@ sanityCheckFixAlert msg = Alert
alerthead = "The daily sanity check found and fixed a problem:"
alertfoot = "If these problems persist, consider filing a bug report."
+fsckAlert :: AlertButton -> Alert
+fsckAlert button = baseActivityAlert
+ { alertData = [ UnTensed "Consistency check in progress" ]
+ , alertButton = Just button
+ }
+
pairingAlert :: AlertButton -> Alert
pairingAlert button = baseActivityAlert
{ alertData = [ UnTensed "Pairing in progress" ]