display repos that are being cleaned out before removal in repolist
This commit is contained in:
parent
a886c3b56d
commit
89dd5aeb95
2 changed files with 33 additions and 15 deletions
|
@ -20,6 +20,7 @@ import Remote.List (remoteListRefresh)
|
||||||
import Annex.UUID (getUUID)
|
import Annex.UUID (getUUID)
|
||||||
import Logs.Remote
|
import Logs.Remote
|
||||||
import Logs.Trust
|
import Logs.Trust
|
||||||
|
import Logs.Group
|
||||||
import Config
|
import Config
|
||||||
import Config.Cost
|
import Config.Cost
|
||||||
import qualified Git
|
import qualified Git
|
||||||
|
@ -41,6 +42,8 @@ data Actions
|
||||||
{ setupRepoLink :: Route WebApp
|
{ setupRepoLink :: Route WebApp
|
||||||
, syncToggleLink :: Route WebApp
|
, syncToggleLink :: Route WebApp
|
||||||
}
|
}
|
||||||
|
| UnwantedRepoActions
|
||||||
|
{ setupRepoLink :: Route WebApp }
|
||||||
|
|
||||||
mkSyncingRepoActions :: UUID -> Actions
|
mkSyncingRepoActions :: UUID -> Actions
|
||||||
mkSyncingRepoActions u = SyncingRepoActions
|
mkSyncingRepoActions u = SyncingRepoActions
|
||||||
|
@ -54,6 +57,11 @@ mkNotSyncingRepoActions u = NotSyncingRepoActions
|
||||||
, syncToggleLink = EnableSyncR u
|
, syncToggleLink = EnableSyncR u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mkUnwantedRepoActions :: UUID -> Actions
|
||||||
|
mkUnwantedRepoActions u = UnwantedRepoActions
|
||||||
|
{ setupRepoLink = EditRepositoryR u
|
||||||
|
}
|
||||||
|
|
||||||
needsEnabled :: Actions -> Bool
|
needsEnabled :: Actions -> Bool
|
||||||
needsEnabled (DisabledRepoActions _) = True
|
needsEnabled (DisabledRepoActions _) = True
|
||||||
needsEnabled _ = False
|
needsEnabled _ = False
|
||||||
|
@ -62,6 +70,10 @@ notSyncing :: Actions -> Bool
|
||||||
notSyncing (SyncingRepoActions _ _) = False
|
notSyncing (SyncingRepoActions _ _) = False
|
||||||
notSyncing _ = True
|
notSyncing _ = True
|
||||||
|
|
||||||
|
notWanted :: Actions -> Bool
|
||||||
|
notWanted (UnwantedRepoActions _) = True
|
||||||
|
notWanted _ = False
|
||||||
|
|
||||||
{- Called by client to get a list of repos, that refreshes
|
{- Called by client to get a list of repos, that refreshes
|
||||||
- when new repos are added.
|
- when new repos are added.
|
||||||
-
|
-
|
||||||
|
@ -115,16 +127,19 @@ repoList reposelector
|
||||||
| otherwise = list =<< (++) <$> configured <*> unconfigured
|
| otherwise = list =<< (++) <$> configured <*> unconfigured
|
||||||
where
|
where
|
||||||
configured = do
|
configured = do
|
||||||
syncing <- S.fromList . syncRemotes
|
syncing <- S.fromList . map Remote.uuid . syncRemotes
|
||||||
<$> liftAssistant getDaemonStatus
|
<$> liftAssistant getDaemonStatus
|
||||||
liftAnnex $ do
|
liftAnnex $ do
|
||||||
rs <- filter wantedrepo . concat . Remote.byCost
|
unwanted <- S.fromList
|
||||||
|
<$> filterM inUnwantedGroup (S.toList syncing)
|
||||||
|
rs <- filter selectedrepo . concat . Remote.byCost
|
||||||
<$> Remote.enabledRemoteList
|
<$> Remote.enabledRemoteList
|
||||||
let us = map Remote.uuid rs
|
let us = map Remote.uuid rs
|
||||||
let make r = if r `S.member` syncing
|
let maker u
|
||||||
then mkSyncingRepoActions $ Remote.uuid r
|
| u `S.member` unwanted = mkUnwantedRepoActions u
|
||||||
else mkNotSyncingRepoActions $ Remote.uuid r
|
| u `S.member` syncing = mkSyncingRepoActions u
|
||||||
let l = zip us $ map make rs
|
| otherwise = mkNotSyncingRepoActions u
|
||||||
|
let l = zip us $ map (maker . Remote.uuid) rs
|
||||||
if includeHere reposelector
|
if includeHere reposelector
|
||||||
then do
|
then do
|
||||||
u <- getUUID
|
u <- getUUID
|
||||||
|
@ -137,15 +152,15 @@ repoList reposelector
|
||||||
else return l
|
else return l
|
||||||
unconfigured = liftAnnex $ do
|
unconfigured = liftAnnex $ do
|
||||||
m <- readRemoteLog
|
m <- readRemoteLog
|
||||||
map snd . catMaybes . filter wantedremote
|
map snd . catMaybes . filter selectedremote
|
||||||
. map (findinfo m)
|
. map (findinfo m)
|
||||||
<$> (trustExclude DeadTrusted $ M.keys m)
|
<$> (trustExclude DeadTrusted $ M.keys m)
|
||||||
wantedrepo r
|
selectedrepo r
|
||||||
| Remote.readonly r = False
|
| Remote.readonly r = False
|
||||||
| onlyCloud reposelector = Git.repoIsUrl (Remote.repo r) && not (isXMPPRemote r)
|
| onlyCloud reposelector = Git.repoIsUrl (Remote.repo r) && not (isXMPPRemote r)
|
||||||
| otherwise = True
|
| otherwise = True
|
||||||
wantedremote Nothing = False
|
selectedremote Nothing = False
|
||||||
wantedremote (Just (iscloud, _))
|
selectedremote (Just (iscloud, _))
|
||||||
| onlyCloud reposelector = iscloud
|
| onlyCloud reposelector = iscloud
|
||||||
| otherwise = True
|
| otherwise = True
|
||||||
findinfo m u = case M.lookup u m of
|
findinfo m u = case M.lookup u m of
|
||||||
|
|
|
@ -22,11 +22,14 @@
|
||||||
<a href="@{setupRepoLink actions}">
|
<a href="@{setupRepoLink actions}">
|
||||||
<i .icon-warning-sign></i> not enabled
|
<i .icon-warning-sign></i> not enabled
|
||||||
$else
|
$else
|
||||||
<a href="@{syncToggleLink actions}">
|
$if notWanted actions
|
||||||
$if notSyncing actions
|
<i .icon-trash></i> cleaning out..
|
||||||
<i .icon-ban-circle></i> syncing disabled
|
$else
|
||||||
$else
|
<a href="@{syncToggleLink actions}">
|
||||||
<i .icon-refresh></i> syncing enabled
|
$if notSyncing actions
|
||||||
|
<i .icon-ban-circle></i> syncing disabled
|
||||||
|
$else
|
||||||
|
<i .icon-refresh></i> syncing enabled
|
||||||
<td .draghide>
|
<td .draghide>
|
||||||
$if needsEnabled actions
|
$if needsEnabled actions
|
||||||
<a href="@{setupRepoLink actions}">
|
<a href="@{setupRepoLink actions}">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue