after setting up a new repo, go to a special version of the configuration page

This commit is contained in:
Joey Hess 2012-10-11 17:35:08 -04:00
parent 5b9900133c
commit f31d292ab1
6 changed files with 35 additions and 13 deletions

View file

@ -115,7 +115,13 @@ editRepositoryAForm def = RepoConfig
_ -> []
getEditRepositoryR :: UUID -> Handler RepHtml
getEditRepositoryR uuid = bootstrap (Just Config) $ do
getEditRepositoryR = editForm False
getEditNewRepositoryR :: UUID -> Handler RepHtml
getEditNewRepositoryR = editForm True
editForm :: Bool -> UUID -> Handler RepHtml
editForm new uuid = bootstrap (Just Config) $ do
sideBarDisplay
setTitle "Configure repository"
@ -129,11 +135,11 @@ getEditRepositoryR uuid = bootstrap (Just Config) $ do
maybe noop (changeEnabled r) =<<
runAnnex undefined (setRepoConfig r input)
redirect RepositoriesR
_ -> showform form enctype
_ -> showform form enctype curr
where
showform form enctype = do
showform form enctype curr = do
let istransfer = repoGroup curr == RepoGroupStandard TransferGroup
let authtoken = webAppFormAuthToken
description <- lift $
runAnnex T.empty $ T.pack . concat <$>
Remote.prettyListUUIDs [uuid]
$(widgetFile "configurators/editrepository")

View file

@ -185,19 +185,19 @@ getAddDriveR = bootstrap (Just Config) $ do
((res, form), enctype) <- lift $ runFormGet $
selectDriveForm (sort writabledrives) Nothing
case res of
FormSuccess (RemovableDrive { mountPoint = d }) -> lift $ do
go $ T.unpack d
redirect RepositoriesR
FormSuccess (RemovableDrive { mountPoint = d }) -> lift $
make (T.unpack d) >>= redirect . EditNewRepositoryR
_ -> do
let authtoken = webAppFormAuthToken
$(widgetFile "configurators/adddrive")
where
go mountpoint = do
make mountpoint = do
liftIO $ makerepo dir
u <- liftIO $ initRepo dir $ Just remotename
r <- addremote dir remotename
runAnnex () $ setStandardGroup u TransferGroup
syncRemote r
return u
where
dir = mountpoint </> gitAnnexAssistantDefaultDir
remotename = takeFileName mountpoint

View file

@ -125,4 +125,4 @@ makeS3Remote (S3Creds ak sk) name setup config = do
return remotename
setup r
liftIO $ syncNewRemote st (daemonStatus webapp) (scanRemotes webapp) r
redirect RepositoriesR
redirect $ EditNewRepositoryR $ Remote.uuid r

View file

@ -291,7 +291,7 @@ makeSshRepo forcersync setup sshdata = do
(scanRemotes webapp)
forcersync sshdata
setup r
redirect RepositoriesR
redirect $ EditRepositoryR $ Remote.uuid r
getAddRsyncNetR :: Handler RepHtml
getAddRsyncNetR = do

View file

@ -11,6 +11,7 @@
/config/repository/new NewRepositoryR GET
/config/repository/switchto/#FilePath SwitchToRepositoryR GET
/config/repository/edit/#UUID EditRepositoryR GET
/config/repository/edit/new/#UUID EditNewRepositoryR GET
/config/repository/add/drive AddDriveR GET
/config/repository/add/ssh AddSshR GET

View file

@ -1,6 +1,17 @@
<div .span9 .hero-unit>
<h2>
Configuring repository: #{description}
Configuring repository
$if new
<p>
This repository is set up and ready to go!
<p>
Now you can do a little more configuring of it, if you like. #
Perhaps enter a better description than the automatically generated one.
$if istransfer
<div .alert .alert-info>
This repository is currently in the transfer group. That's the #
right choice if you'll use it to shuttle data back and forth #
between other repositories. Otherwise, pick one of the other groups.
<p>
<form .form-horizontal enctype=#{enctype}>
<fieldset>
@ -11,3 +22,7 @@
Save Changes
<a .btn href="@{RepositoriesR}">
Cancel
$if new
<p>
In a hurry? Feel free to skip this step! You can always come back #
and configure this repository later.