diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-29 19:05:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-29 19:05:51 -0400 |
commit | d62b157194248402b566e96bbc92d19b8e1ce6e8 (patch) | |
tree | b7cb5cc9966dd8ceb5f81715a382c22abc6bf1c2 /Assistant/Threads | |
parent | d52c93242450c0bd01e7d3c1fdae375806aa6e1f (diff) |
better ordering of alerts
Diffstat (limited to 'Assistant/Threads')
-rw-r--r-- | Assistant/Threads/Watcher.hs | 19 | ||||
-rw-r--r-- | Assistant/Threads/WebApp.hs | 8 |
2 files changed, 15 insertions, 12 deletions
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs index 1c8d122d5..ddbd51655 100644 --- a/Assistant/Threads/Watcher.hs +++ b/Assistant/Threads/Watcher.hs @@ -75,13 +75,18 @@ watchThread st dstatus transferqueue changechan = do startupScan :: ThreadState -> DaemonStatusHandle -> IO a -> IO a startupScan st dstatus scanner = do runThreadState st $ showAction "scanning" - r <- alertWhile dstatus startupScanAlert scanner - modifyDaemonStatus_ dstatus $ \s -> s { scanComplete = True } - - -- Notice any files that were deleted before watching was started. - runThreadState st $ do - inRepo $ Git.Command.run "add" [Param "--update"] - showAction "started" + r <- alertWhile dstatus startupScanAlert $ do + r <- scanner + modifyDaemonStatus_ dstatus $ \s -> s { scanComplete = True } + + -- Notice any files that were deleted before + -- watching was started. + runThreadState st $ do + inRepo $ Git.Command.run "add" [Param "--update"] + showAction "started" + return r + + void $ addAlert dstatus runningAlert return r diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs index 3d42db812..4d37a941a 100644 --- a/Assistant/Threads/WebApp.hs +++ b/Assistant/Threads/WebApp.hs @@ -34,7 +34,6 @@ import Network.Socket (PortNumber) import Text.Blaze.Renderer.String import Data.Text (Text, pack, unpack) import qualified Data.Map as M -import Data.Function thisThread :: String thisThread = "WebApp" @@ -158,10 +157,9 @@ sideBarDisplay noScript = do {- Add newest 10 alerts to the sidebar. -} webapp <- lift getYesod - alerts <- M.toList . alertMap + alertpairs <- M.toList . alertMap <$> liftIO (getDaemonStatus $ daemonStatus webapp) - mapM_ renderalert $ - take 10 $ reverse $ sortBy (compare `on` fst) alerts + mapM_ renderalert $ take 10 $ sortAlertPairs alertpairs ident <- lift newIdent $(widgetFile "sidebar") @@ -180,7 +178,7 @@ sideBarDisplay noScript = do renderalert (alertid, alert) = addalert (show alertid) -- Activity alerts auto-close - (not noScript && alertClass alert /= Activity) + (alertClass alert /= Activity) (alertBlockDisplay alert) (bootstrapclass $ alertClass alert) (alertHeader alert) |