commit config changes immediately

This commit is contained in:
Joey Hess 2013-10-14 16:24:13 -04:00
parent 92d5452a19
commit 4a374fa999

View file

@ -22,6 +22,7 @@ import Logs.Schedule
import Annex.UUID import Annex.UUID
import qualified Remote import qualified Remote
import Assistant.DaemonStatus import Assistant.DaemonStatus
import qualified Annex.Branch
{- This adds a form to the page. It does not handle posting of the form, {- 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 - 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) checks <- liftAnnex $ S.toList <$> (scheduleGet =<< getUUID)
$(widgetFile "configurators/fsck") $(widgetFile "configurators/fsck")
getRemoveActivityR :: UUID -> ScheduledActivity -> Handler Html changeSchedule :: Handler () -> Handler Html
getRemoveActivityR u activity = do changeSchedule a = do
liftAnnex $ scheduleRemove u activity a
liftAnnex $ Annex.Branch.commit "update"
redirect ConfigFsckR redirect ConfigFsckR
getRemoveActivityR :: UUID -> ScheduledActivity -> Handler Html
getRemoveActivityR u activity = changeSchedule $
liftAnnex $ scheduleRemove u activity
getAddActivityR :: UUID -> Handler Html getAddActivityR :: UUID -> Handler Html
getAddActivityR = postAddActivityR getAddActivityR = postAddActivityR
postAddActivityR :: UUID -> Handler Html postAddActivityR :: UUID -> Handler Html
postAddActivityR u = do postAddActivityR u = changeSchedule $
withFsckForm $ scheduleAdd u withFsckForm $ scheduleAdd u
redirect ConfigFsckR
getChangeActivityR :: UUID -> ScheduledActivity -> Handler Html getChangeActivityR :: UUID -> ScheduledActivity -> Handler Html
getChangeActivityR = postChangeActivityR getChangeActivityR = postChangeActivityR
postChangeActivityR :: UUID -> ScheduledActivity -> Handler Html postChangeActivityR :: UUID -> ScheduledActivity -> Handler Html
postChangeActivityR u oldactivity = do postChangeActivityR u oldactivity = changeSchedule $
withFsckForm $ \newactivity -> scheduleChange u $ withFsckForm $ \newactivity -> scheduleChange u $
S.insert newactivity . S.delete oldactivity S.insert newactivity . S.delete oldactivity
redirect ConfigFsckR