display alert in webapp when assistant shuts down
and remove any activity alerts
This commit is contained in:
parent
d8f8aa6921
commit
b40e8fc5da
2 changed files with 10 additions and 0 deletions
|
@ -81,6 +81,11 @@ startupScanAlert :: Alert
|
|||
startupScanAlert = activityAlert Nothing
|
||||
[Tensed "Performing" "Performed", "startup scan"]
|
||||
|
||||
{- Displayed when a shutdown is occurring, so will be seen after shutdown
|
||||
- has happened. -}
|
||||
shutdownAlert :: Alert
|
||||
shutdownAlert = warningAlert "shutdown" "git-annex has been shut down"
|
||||
|
||||
commitAlert :: Alert
|
||||
commitAlert = activityAlert Nothing
|
||||
[Tensed "Committing" "Committed", "changes to git"]
|
||||
|
|
|
@ -14,6 +14,7 @@ import Locations.UserConfig
|
|||
import Utility.LogFile
|
||||
import Assistant.DaemonStatus
|
||||
import Assistant.WebApp.Utility
|
||||
import Assistant.Alert
|
||||
|
||||
import Control.Concurrent
|
||||
import System.Posix (getProcessID, signalProcess, sigTERM)
|
||||
|
@ -25,6 +26,10 @@ getShutdownR = page "Shutdown" Nothing $
|
|||
|
||||
getShutdownConfirmedR :: Handler RepHtml
|
||||
getShutdownConfirmedR = do
|
||||
{- Remove all alerts for currently running activities. -}
|
||||
liftAssistant $ do
|
||||
updateAlertMap $ M.filter $ \a -> alertClass a /= Activity
|
||||
void $ addAlert shutdownAlert
|
||||
{- Stop transfers the assistant is running,
|
||||
- otherwise they would continue past shutdown.
|
||||
- Pausing transfers prevents more being started up (and stops
|
||||
|
|
Loading…
Reference in a new issue