webapp: Add UI to stop assistant.

Would like to also have restart UI, but that's rather harder to do,
seems it'd need to start another copy of the webapp, and redirect the
browser to its new url, but running two assistants in the same repo at
the same time isn't good.
This commit is contained in:
Joey Hess 2013-01-03 15:16:40 -04:00
parent d5f18291c5
commit de2e287133
10 changed files with 61 additions and 10 deletions

View file

@ -25,7 +25,9 @@ inFirstRun = isNothing . relDir <$> getYesod
newWebAppState :: IO (TMVar WebAppState)
newWebAppState = do
otherrepos <- listOtherRepos
cwd <- getCurrentDirectory
otherrepos <- filter (\p -> not (snd p `dirContains` cwd))
<$> listRepos
atomically $ newTMVar $ WebAppState
{ showIntro = True
, otherRepos = otherrepos }
@ -101,14 +103,13 @@ redirectBack = do
setUltDestReferer
redirectUltDest HomeR
{- List of other known repsitories, and link to add a new one. -}
otherReposWidget :: Widget
otherReposWidget = do
controlMenu :: Widget
controlMenu = do
repolist <- lift $ otherRepos <$> getWebAppState
$(widgetFile "otherrepos")
$(widgetFile "controlmenu")
listOtherRepos :: IO [(String, String)]
listOtherRepos = do
listRepos :: IO [(String, String)]
listRepos = do
f <- autoStartFile
dirs <- nub <$> ifM (doesFileExist f) ( lines <$> readFile f, return [])
names <- mapM relHome dirs