webapp: Added a "Sync now" item to each repository's menu.

This commit is contained in:
Joey Hess 2014-03-06 18:11:44 -04:00
parent aa131c870a
commit 54746463bb
4 changed files with 18 additions and 1 deletions

View file

@ -31,6 +31,7 @@ import qualified Data.Map as M
import qualified Data.Set as S
import qualified Data.Text as T
import Data.Function
import Control.Concurrent
type RepoList = [(RepoDesc, RepoId, Actions)]
@ -238,3 +239,15 @@ reorderCosts remote rs = zip rs'' (insertCostAfter costs i)
costs = map Remote.cost rs'
rs'' = (\(x, y) -> x ++ [remote] ++ y) $ splitAt (i + 1) rs'
getSyncNowRepositoryR :: UUID -> Handler ()
getSyncNowRepositoryR uuid = do
u <- liftAnnex getUUID
if u == uuid
then do
thread <- liftAssistant $ asIO $
reconnectRemotes True
=<< (syncRemotes <$> getDaemonStatus)
void $ liftIO $ forkIO thread
else maybe noop (liftAssistant . syncRemote)
=<< liftAnnex (Remote.remoteFromUUID uuid)
redirectBack

View file

@ -82,6 +82,7 @@
/config/repository/reorder RepositoriesReorderR GET
/config/repository/syncnow/#UUID SyncNowRepositoryR GET
/config/repository/disable/#UUID DisableRepositoryR GET
/config/repository/delete/confirm/#UUID DeleteRepositoryR GET

1
debian/changelog vendored
View file

@ -2,6 +2,7 @@ git-annex (5.20140307) UNRELEASED; urgency=medium
* Fix zombie leak and general inneficiency when copying files to a
local git repo.
* webapp: Added a "Sync now" item to each repository's menu.
-- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400

View file

@ -39,13 +39,15 @@
$else
<span .dropdown #menu-#{show repoid}>
<a .dropdown-toggle data-toggle="dropdown" href="#menu-#{show repoid}">
<i .icon-cog></i> settings
<i .icon-cog></i> actions
<b .caret></b>
<ul .dropdown-menu>
<li>
<a href="@{setupRepoLink actions}">
<i .icon-pencil></i> Edit
$if not (lacksUUID repoid)
<a href="@{SyncNowRepositoryR $ asUUID repoid}">
<i .icon-refresh></i> Sync now
<a href="@{DisableRepositoryR $ asUUID repoid}">
<i .icon-minus></i> Disable
<a href="@{DeleteRepositoryR $ asUUID repoid}">