moved all alert messages into one file

Makes it easier to edit for consistent voice etc.
This commit is contained in:
Joey Hess 2012-07-29 18:07:45 -04:00
parent b2dc8fdb06
commit d52c932424
6 changed files with 60 additions and 46 deletions

View file

@ -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
}