diff options
author | 2012-09-09 01:02:44 -0400 | |
---|---|---|
committer | 2012-09-09 01:02:44 -0400 | |
commit | 1e41c0d85ecc24e8656bff79b2fba46c3663a054 (patch) | |
tree | 3fbd6316fed1de8866e0b8419c64ca4b821a9dde /Assistant/WebApp | |
parent | f62cc484826991bfdb5469b8cf0b7b6b7a617e43 (diff) |
update pair request alert when button is pressed
Diffstat (limited to 'Assistant/WebApp')
-rw-r--r-- | Assistant/WebApp/DashBoard.hs | 6 | ||||
-rw-r--r-- | Assistant/WebApp/SideBar.hs | 17 | ||||
-rw-r--r-- | Assistant/WebApp/routes | 3 |
3 files changed, 18 insertions, 8 deletions
diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs index 992e6ba26..b4e46bd68 100644 --- a/Assistant/WebApp/DashBoard.hs +++ b/Assistant/WebApp/DashBoard.hs @@ -116,12 +116,6 @@ postFileBrowserR = void openFileBrowser getFileBrowserR :: Handler () getFileBrowserR = whenM openFileBrowser $ redirectBack -redirectBack :: Handler () -redirectBack = do - clearUltDest - setUltDestReferer - redirectUltDest HomeR - {- Opens the system file browser on the repo, or, as a fallback, - goes to a file:// url. Returns True if it's ok to redirect away - from the page (ie, the system file browser was opened). diff --git a/Assistant/WebApp/SideBar.hs b/Assistant/WebApp/SideBar.hs index fd1f70038..2a0073319 100644 --- a/Assistant/WebApp/SideBar.hs +++ b/Assistant/WebApp/SideBar.hs @@ -76,4 +76,19 @@ getSideBarR nid = do getCloseAlert :: AlertId -> Handler () getCloseAlert i = do webapp <- getYesod - void $ liftIO $ removeAlert (daemonStatus webapp) i + liftIO $ removeAlert (daemonStatus webapp) i + +{- When an alert with a button is clicked on, the button takes us here. -} +getClickAlert :: AlertId -> Handler () +getClickAlert i = do + webapp <- getYesod + m <- alertMap <$> liftIO (getDaemonStatus $ daemonStatus webapp) + case M.lookup i m of + Just (Alert { alertButton = Just b }) -> do + {- Spawn a thread to run the action while redirecting. -} + case buttonAction b of + Nothing -> noop + Just a -> liftIO $ void $ forkIO $ a i + redirect $ buttonUrl b + _ -> redirectBack + diff --git a/Assistant/WebApp/routes b/Assistant/WebApp/routes index a266704b2..7c038389c 100644 --- a/Assistant/WebApp/routes +++ b/Assistant/WebApp/routes @@ -21,7 +21,8 @@ /sidebar/#NotificationId SideBarR GET /notifier/transfers NotifierTransfersR GET /notifier/sidebar NotifierSideBarR GET -/closealert/#AlertId CloseAlert GET +/alert/close/#AlertId CloseAlert GET +/alert/click/#AlertId ClickAlert GET /filebrowser FileBrowserR GET POST /transfer/pause/#Transfer PauseTransferR GET POST |