From 2418bae471015ef06e1b05f0c5505c41c47c38b3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 12 Aug 2014 16:35:13 -0400 Subject: [PATCH] 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. --- Assistant/WebApp/Configurators/Edit.hs | 44 ++++++++++--------- ...oad_gives_Prelude.undefined_in_webapp.mdwn | 2 + .../configurators/edit/webrepository.hamlet | 8 ++++ 3 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 templates/configurators/edit/webrepository.hamlet diff --git a/Assistant/WebApp/Configurators/Edit.hs b/Assistant/WebApp/Configurators/Edit.hs index c8113d18dc..9268038f64 100644 --- a/Assistant/WebApp/Configurators/Edit.hs +++ b/Assistant/WebApp/Configurators/Edit.hs @@ -42,6 +42,7 @@ import Utility.Gpg import Annex.UUID import Assistant.Ssh import Config +import Logs.Web (webUUID) import qualified Data.Text as T import qualified Data.Map as M @@ -191,26 +192,29 @@ postEditNewCloudRepositoryR :: UUID -> Handler Html postEditNewCloudRepositoryR uuid = connectionNeeded >> editForm True (RepoUUID uuid) editForm :: Bool -> RepoId -> Handler Html -editForm new (RepoUUID uuid) = page "Edit repository" (Just Configuration) $ do - mremote <- liftAnnex $ Remote.remoteFromUUID uuid - when (mremote == Nothing) $ - whenM ((/=) uuid <$> liftAnnex getUUID) $ - error "unknown remote" - curr <- liftAnnex $ getRepoConfig uuid mremote - liftAnnex $ checkAssociatedDirectory curr mremote - ((result, form), enctype) <- liftH $ - runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ editRepositoryAForm mremote curr - case result of - FormSuccess input -> liftH $ do - setRepoConfig uuid mremote curr input - liftAnnex $ checkAssociatedDirectory input mremote - redirect DashboardR - _ -> do - let istransfer = repoGroup curr == RepoGroupStandard TransferGroup - config <- liftAnnex $ M.lookup uuid <$> readRemoteLog - let repoInfo = getRepoInfo mremote config - let repoEncryption = getRepoEncryption mremote config - $(widgetFile "configurators/edit/repository") +editForm new (RepoUUID uuid) + | uuid == webUUID = page "The web" (Just Configuration) $ do + $(widgetFile "configurators/edit/webrepository") + | otherwise = page "Edit repository" (Just Configuration) $ do + mremote <- liftAnnex $ Remote.remoteFromUUID uuid + when (mremote == Nothing) $ + whenM ((/=) uuid <$> liftAnnex getUUID) $ + error "unknown remote" + curr <- liftAnnex $ getRepoConfig uuid mremote + liftAnnex $ checkAssociatedDirectory curr mremote + ((result, form), enctype) <- liftH $ + runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ editRepositoryAForm mremote curr + case result of + FormSuccess input -> liftH $ do + setRepoConfig uuid mremote curr input + liftAnnex $ checkAssociatedDirectory input mremote + redirect DashboardR + _ -> do + let istransfer = repoGroup curr == RepoGroupStandard TransferGroup + 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 mr <- liftAnnex (repoIdRemote r) let repoInfo = getRepoInfo mr Nothing diff --git a/doc/bugs/youtube_web_download_gives_Prelude.undefined_in_webapp.mdwn b/doc/bugs/youtube_web_download_gives_Prelude.undefined_in_webapp.mdwn index 7112818ed2..2b4a625385 100644 --- a/doc/bugs/youtube_web_download_gives_Prelude.undefined_in_webapp.mdwn +++ b/doc/bugs/youtube_web_download_gives_Prelude.undefined_in_webapp.mdwn @@ -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 """]] + +> [[fixed|done]] --[[Joey]] diff --git a/templates/configurators/edit/webrepository.hamlet b/templates/configurators/edit/webrepository.hamlet new file mode 100644 index 0000000000..f7d1243703 --- /dev/null +++ b/templates/configurators/edit/webrepository.hamlet @@ -0,0 +1,8 @@ +
+
+

+ The world wide web +

+ git-annex can download files from the web. +

+ This is not a normal repository, and cannot be configured.