From 4a374fa9996d6db6a2b21d65650bba72d009c2b0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Oct 2013 16:24:13 -0400 Subject: [PATCH] commit config changes immediately --- Assistant/WebApp/Configurators/Fsck.hs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Assistant/WebApp/Configurators/Fsck.hs b/Assistant/WebApp/Configurators/Fsck.hs index 6004d08fe2..6995325e75 100644 --- a/Assistant/WebApp/Configurators/Fsck.hs +++ b/Assistant/WebApp/Configurators/Fsck.hs @@ -22,6 +22,7 @@ import Logs.Schedule import Annex.UUID import qualified Remote import Assistant.DaemonStatus +import qualified Annex.Branch {- This adds a form to the page. It does not handle posting of the form, - because unlike a typical yesod form that posts using the same url @@ -125,22 +126,25 @@ postConfigFsckR = page "Consistency checks" (Just Configuration) $ do checks <- liftAnnex $ S.toList <$> (scheduleGet =<< getUUID) $(widgetFile "configurators/fsck") -getRemoveActivityR :: UUID -> ScheduledActivity -> Handler Html -getRemoveActivityR u activity = do - liftAnnex $ scheduleRemove u activity +changeSchedule :: Handler () -> Handler Html +changeSchedule a = do + a + liftAnnex $ Annex.Branch.commit "update" redirect ConfigFsckR +getRemoveActivityR :: UUID -> ScheduledActivity -> Handler Html +getRemoveActivityR u activity = changeSchedule $ + liftAnnex $ scheduleRemove u activity + getAddActivityR :: UUID -> Handler Html getAddActivityR = postAddActivityR postAddActivityR :: UUID -> Handler Html -postAddActivityR u = do +postAddActivityR u = changeSchedule $ withFsckForm $ scheduleAdd u - redirect ConfigFsckR getChangeActivityR :: UUID -> ScheduledActivity -> Handler Html getChangeActivityR = postChangeActivityR postChangeActivityR :: UUID -> ScheduledActivity -> Handler Html -postChangeActivityR u oldactivity = do +postChangeActivityR u oldactivity = changeSchedule $ withFsckForm $ \newactivity -> scheduleChange u $ S.insert newactivity . S.delete oldactivity - redirect ConfigFsckR