From d52c93242450c0bd01e7d3c1fdae375806aa6e1f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 29 Jul 2012 18:07:45 -0400 Subject: moved all alert messages into one file Makes it easier to edit for consistent voice etc. --- Assistant/Alert.hs | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'Assistant/Alert.hs') diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs index f4220eea9..6b0804fd8 100644 --- a/Assistant/Alert.hs +++ b/Assistant/Alert.hs @@ -9,6 +9,9 @@ module Assistant.Alert where +import Common.Annex +import qualified Remote + import Yesod type Widget = forall sub master. GWidget sub master () @@ -34,3 +37,52 @@ activityAlert header message = Alert , alertMessage = StringAlert message , alertBlockDisplay = False } + +startupScanAlert :: Alert +startupScanAlert = activityAlert Nothing "Performing startup scan" + +pushAlert :: [Remote] -> Alert +pushAlert rs = activityAlert Nothing $ + "Syncing with " ++ unwords (map Remote.name rs) + +pushRetryAlert :: [Remote] -> Alert +pushRetryAlert rs = activityAlert (Just "Retrying sync") $ + "with " ++ unwords (map Remote.name rs) ++ ", which failed earlier." + +syncMountAlert :: FilePath -> [Remote] -> Alert +syncMountAlert dir rs = Alert + { alertClass = Activity + , alertHeader = Just $ "Syncing with " ++ unwords (map Remote.name rs) + , alertMessage = StringAlert $ unwords + ["I noticed you plugged in" + , dir + , " -- let's get it in sync!" + ] + , alertBlockDisplay = True + } + +scanAlert :: Remote -> Alert +scanAlert r = Alert + { alertClass = Activity + , alertHeader = Just $ "Scanning " ++ Remote.name r + , alertMessage = StringAlert $ unwords + [ "Ensuring that ", Remote.name r + , "is fully in sync." ] + , alertBlockDisplay = True + } + +sanityCheckAlert :: Alert +sanityCheckAlert = activityAlert (Just "Running daily sanity check") + "to make sure I've not missed anything." + +sanityCheckFixAlert :: String -> Alert +sanityCheckFixAlert msg = Alert + { alertClass = Warning + , alertHeader = Just "Fixed a problem" + , alertMessage = StringAlert $ unwords + [ "The daily sanity check found and fixed a problem:" + , msg + , "If these problems persist, consider filing a bug report." + ] + , alertBlockDisplay = True + } -- cgit v1.2.3