summaryrefslogtreecommitdiff
path: root/Assistant/Alert.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-29 18:07:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-29 18:09:24 -0400
commitd52c93242450c0bd01e7d3c1fdae375806aa6e1f (patch)
treeea3ae0b9db0f7c859b8d260a70f54b41d9a4bd3c /Assistant/Alert.hs
parentb2dc8fdb06068276869df682b439348aa96e57f5 (diff)
moved all alert messages into one file
Makes it easier to edit for consistent voice etc.
Diffstat (limited to 'Assistant/Alert.hs')
-rw-r--r--Assistant/Alert.hs52
1 files changed, 52 insertions, 0 deletions
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
+ }