update pair request alert when button is pressed
This commit is contained in:
parent
f62cc48482
commit
1e41c0d85e
7 changed files with 54 additions and 18 deletions
|
@ -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).
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue