webapp: Don't list the public repository group when editing a git repository; it only makes sense for special remotes.
This commit is contained in:
parent
c8528864e1
commit
6469c1aca9
3 changed files with 18 additions and 5 deletions
|
@ -30,6 +30,7 @@ import Logs.PreferredContent
|
|||
import Logs.Remote
|
||||
import Types.StandardGroups
|
||||
import qualified Git
|
||||
import qualified Git.Types as Git
|
||||
import qualified Git.Command
|
||||
import qualified Git.Config
|
||||
import qualified Annex
|
||||
|
@ -137,8 +138,8 @@ setRepoConfig uuid mremote oldc newc = do
|
|||
|
||||
legalName = makeLegalName . T.unpack . repoName
|
||||
|
||||
editRepositoryAForm :: Bool -> RepoConfig -> MkAForm RepoConfig
|
||||
editRepositoryAForm ishere def = RepoConfig
|
||||
editRepositoryAForm :: Maybe Remote -> RepoConfig -> MkAForm RepoConfig
|
||||
editRepositoryAForm mremote def = RepoConfig
|
||||
<$> areq (if ishere then readonlyTextField else textField)
|
||||
"Name" (Just $ repoName def)
|
||||
<*> aopt textField "Description" (Just $ repoDescription def)
|
||||
|
@ -146,10 +147,16 @@ editRepositoryAForm ishere def = RepoConfig
|
|||
<*> associateddirectory
|
||||
<*> areq checkBoxField "Syncing enabled" (Just $ repoSyncable def)
|
||||
where
|
||||
ishere = isNothing mremote
|
||||
isspecial = fromMaybe False $
|
||||
(== Git.Unknown) . Git.location . Remote.repo <$> mremote
|
||||
groups = customgroups ++ standardgroups
|
||||
standardgroups :: [(Text, RepoGroup)]
|
||||
standardgroups = map (\g -> (T.pack $ descStandardGroup g , RepoGroupStandard g))
|
||||
[minBound :: StandardGroup .. maxBound :: StandardGroup]
|
||||
standardgroups = map (\g -> (T.pack $ descStandardGroup g , RepoGroupStandard g)) $
|
||||
filter sanegroup [minBound..maxBound]
|
||||
sanegroup
|
||||
| isspecial = const True
|
||||
| otherwise = not . specialRemoteOnly
|
||||
customgroups :: [(Text, RepoGroup)]
|
||||
customgroups = case repoGroup def of
|
||||
RepoGroupCustom s -> [(T.pack s, RepoGroupCustom s)]
|
||||
|
@ -187,7 +194,7 @@ editForm new (RepoUUID uuid) = page "Edit repository" (Just Configuration) $ do
|
|||
curr <- liftAnnex $ getRepoConfig uuid mremote
|
||||
liftAnnex $ checkAssociatedDirectory curr mremote
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap $ editRepositoryAForm (isNothing mremote) curr
|
||||
runFormPostNoToken $ renderBootstrap $ editRepositoryAForm mremote curr
|
||||
case result of
|
||||
FormSuccess input -> liftH $ do
|
||||
setRepoConfig uuid mremote curr input
|
||||
|
|
|
@ -72,6 +72,10 @@ associatedDirectory (Just c) PublicGroup = Just $
|
|||
associatedDirectory Nothing PublicGroup = Just "public"
|
||||
associatedDirectory _ _ = Nothing
|
||||
|
||||
specialRemoteOnly :: StandardGroup -> Bool
|
||||
specialRemoteOnly PublicGroup = True
|
||||
specialRemoteOnly _ = False
|
||||
|
||||
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
|
||||
preferredContent :: StandardGroup -> PreferredContentExpression
|
||||
preferredContent ClientGroup = lastResort $
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -6,6 +6,8 @@ git-annex (5.20140228) UNRELEASED; urgency=medium
|
|||
git directory anymore. (Or are bare)
|
||||
* webapp: Refuse to start in a bare git repository.
|
||||
* assistant --autostart: Refuse to start in a bare git repository.
|
||||
* webapp: Don't list the public repository group when editing a
|
||||
git repository; it only makes sense for special remotes.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Fri, 28 Feb 2014 14:52:15 -0400
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue