diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-03 17:44:34 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-03 17:48:54 -0400 |
commit | 72b25b61e9c91668e0c05a17c50462b822885eb8 (patch) | |
tree | 73a82d2033d792c0a216ce6c0e45bd1fa126b8ff /Assistant/NamedThread.hs | |
parent | f768f16999d997077be98c0d8eabd3d85fd8caa5 (diff) |
clean up urlrenderer handling when the webapp is not built
Diffstat (limited to 'Assistant/NamedThread.hs')
-rw-r--r-- | Assistant/NamedThread.hs | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/Assistant/NamedThread.hs b/Assistant/NamedThread.hs index 33af2c304..1d291ba74 100644 --- a/Assistant/NamedThread.hs +++ b/Assistant/NamedThread.hs @@ -13,6 +13,7 @@ import Common.Annex import Assistant.Types.NamedThread import Assistant.Types.ThreadName import Assistant.Types.DaemonStatus +import Assistant.Types.UrlRenderer import Assistant.DaemonStatus import Assistant.Monad @@ -32,13 +33,8 @@ import qualified Data.Text as T - - Named threads are run by a management thread, so if they crash - an alert is displayed, allowing the thread to be restarted. -} -#ifdef WITH_WEBAPP -startNamedThread :: Maybe UrlRenderer -> NamedThread -> Assistant () -startNamedThread urlrenderer namedthread@(NamedThread name a) = do -#else -startNamedThread :: Maybe Bool -> NamedThread -> Assistant () +startNamedThread :: UrlRenderer -> NamedThread -> Assistant () startNamedThread urlrenderer namedthread@(NamedThread name a) = do -#endif m <- startedThreads <$> getDaemonStatus case M.lookup name m of Nothing -> start @@ -69,17 +65,14 @@ startNamedThread urlrenderer namedthread@(NamedThread name a) = do ] hPutStrLn stderr msg #ifdef WITH_WEBAPP - button <- runAssistant d $ - case urlrenderer of - Nothing -> return Nothing - Just renderer -> do - close <- asIO1 removeAlert - url <- liftIO $ renderUrl renderer (RestartThreadR name) [] - return $ Just $ AlertButton - { buttonLabel = T.pack "Restart Thread" - , buttonUrl = url - , buttonAction = Just close - } + button <- runAssistant d $ do + close <- asIO1 removeAlert + url <- liftIO $ renderUrl urlrenderer (RestartThreadR name) [] + return $ Just $ AlertButton + { buttonLabel = T.pack "Restart Thread" + , buttonUrl = url + , buttonAction = Just close + } runAssistant d $ void $ addAlert $ (warningAlert (fromThreadName name) msg) { alertButton = button } |