special case edit page for web remote

The crash came from calling Git.repoLocation, but it made sense to fix this
higher up, because there is nothing to edit about the web, it just is what
it is.
This commit is contained in:
Joey Hess 2014-08-12 16:35:13 -04:00
parent 62f619c3eb
commit 2418bae471
3 changed files with 34 additions and 20 deletions

View file

@ -42,6 +42,7 @@ import Utility.Gpg
import Annex.UUID import Annex.UUID
import Assistant.Ssh import Assistant.Ssh
import Config import Config
import Logs.Web (webUUID)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Map as M import qualified Data.Map as M
@ -191,26 +192,29 @@ postEditNewCloudRepositoryR :: UUID -> Handler Html
postEditNewCloudRepositoryR uuid = connectionNeeded >> editForm True (RepoUUID uuid) postEditNewCloudRepositoryR uuid = connectionNeeded >> editForm True (RepoUUID uuid)
editForm :: Bool -> RepoId -> Handler Html editForm :: Bool -> RepoId -> Handler Html
editForm new (RepoUUID uuid) = page "Edit repository" (Just Configuration) $ do editForm new (RepoUUID uuid)
mremote <- liftAnnex $ Remote.remoteFromUUID uuid | uuid == webUUID = page "The web" (Just Configuration) $ do
when (mremote == Nothing) $ $(widgetFile "configurators/edit/webrepository")
whenM ((/=) uuid <$> liftAnnex getUUID) $ | otherwise = page "Edit repository" (Just Configuration) $ do
error "unknown remote" mremote <- liftAnnex $ Remote.remoteFromUUID uuid
curr <- liftAnnex $ getRepoConfig uuid mremote when (mremote == Nothing) $
liftAnnex $ checkAssociatedDirectory curr mremote whenM ((/=) uuid <$> liftAnnex getUUID) $
((result, form), enctype) <- liftH $ error "unknown remote"
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ editRepositoryAForm mremote curr curr <- liftAnnex $ getRepoConfig uuid mremote
case result of liftAnnex $ checkAssociatedDirectory curr mremote
FormSuccess input -> liftH $ do ((result, form), enctype) <- liftH $
setRepoConfig uuid mremote curr input runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ editRepositoryAForm mremote curr
liftAnnex $ checkAssociatedDirectory input mremote case result of
redirect DashboardR FormSuccess input -> liftH $ do
_ -> do setRepoConfig uuid mremote curr input
let istransfer = repoGroup curr == RepoGroupStandard TransferGroup liftAnnex $ checkAssociatedDirectory input mremote
config <- liftAnnex $ M.lookup uuid <$> readRemoteLog redirect DashboardR
let repoInfo = getRepoInfo mremote config _ -> do
let repoEncryption = getRepoEncryption mremote config let istransfer = repoGroup curr == RepoGroupStandard TransferGroup
$(widgetFile "configurators/edit/repository") config <- liftAnnex $ M.lookup uuid <$> readRemoteLog
let repoInfo = getRepoInfo mremote config
let repoEncryption = getRepoEncryption mremote config
$(widgetFile "configurators/edit/repository")
editForm _new r@(RepoName _) = page "Edit repository" (Just Configuration) $ do editForm _new r@(RepoName _) = page "Edit repository" (Just Configuration) $ do
mr <- liftAnnex (repoIdRemote r) mr <- liftAnnex (repoIdRemote r)
let repoInfo = getRepoInfo mr Nothing let repoInfo = getRepoInfo mr Nothing

View file

@ -23,3 +23,5 @@ Not much in the logs, I see this:
[2014-07-25 08:40:14 BST] TransferWatcher: transfer starting: Download UUID "00000000-0000-0000-0000-000000000001" Chase_Adam_at_Startup_School_NY_2014.mp4 Nothing [2014-07-25 08:40:14 BST] TransferWatcher: transfer starting: Download UUID "00000000-0000-0000-0000-000000000001" Chase_Adam_at_Startup_School_NY_2014.mp4 Nothing
"""]] """]]
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,8 @@
<div .col-sm-9>
<div .content-box>
<h2>
The world wide web
<p>
git-annex can download files from the web.
<p>
This is not a normal repository, and cannot be configured.