summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-03 20:54:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-03 20:54:53 -0400
commit84884c96aaf5e974cbe09a6f04790a68b694bccf (patch)
tree256d5d1d48ec2c5ff2e7bc4a42757068ed491dbb
parent2c820bbc1ae8c38eb6fd9f982cbdfaace6547b9c (diff)
streamline deletion process and improve UI
-rw-r--r--Assistant.hs1
-rw-r--r--Assistant/DeleteRemote.hs25
2 files changed, 17 insertions, 9 deletions
diff --git a/Assistant.hs b/Assistant.hs
index a436070b3..ba58be303 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -154,7 +154,6 @@ import Assistant.Threads.XMPPClient
#warning Building without the webapp. You probably need to install Yesod..
#endif
import Assistant.Environment
-import Assistant.Types.UrlRenderer
import qualified Utility.Daemon
import Utility.LogFile
import Utility.ThreadScheduler
diff --git a/Assistant/DeleteRemote.hs b/Assistant/DeleteRemote.hs
index 25dd7720f..65cd056f2 100644
--- a/Assistant/DeleteRemote.hs
+++ b/Assistant/DeleteRemote.hs
@@ -19,7 +19,6 @@ import Logs.Transfer
import Logs.Location
import Assistant.Alert
import Assistant.DaemonStatus
-import Assistant.Types.UrlRenderer
import qualified Remote
import Remote.List
import qualified Git.Command
@@ -30,8 +29,8 @@ import qualified Data.Text as T
{- Removes a remote (but leave the repository as-is), and returns the old
- Remote data. -}
-removeRemote :: UUID -> Assistant Remote
-removeRemote uuid = do
+disableRemote :: UUID -> Assistant Remote
+disableRemote uuid = do
remote <- fromMaybe (error "unknown remote")
<$> liftAnnex (Remote.remoteFromUUID uuid)
liftAnnex $ do
@@ -44,6 +43,12 @@ removeRemote uuid = do
updateSyncRemotes
return remote
+{- Removes a remote, marking it dead .-}
+removeRemote :: UUID -> Assistant Remote
+removeRemote uuid = do
+ liftAnnex $ trustSet uuid DeadTrusted
+ disableRemote uuid
+
{- Called when a Remote is probably empty, to remove it.
-
- This does one last check for any objects remaining in the Remote,
@@ -71,18 +76,22 @@ removableRemote urlrenderer uuid = do
a <- liftAnnex $ Annex.withCurrentState $ loggedKeysFor uuid
liftIO a
+{- With the webapp, this asks the user to click on a button to finish
+ - removing the remote.
+ -
+ - Without the webapp, just do the removal now.
+ -}
finishRemovingRemote :: UrlRenderer -> UUID -> Assistant ()
finishRemovingRemote urlrenderer uuid = do
- void $ removeRemote uuid
- liftAnnex $ trustSet uuid DeadTrusted
-
#ifdef WITH_WEBAPP
desc <- liftAnnex $ Remote.prettyUUID uuid
- url <- liftIO $ renderUrl urlrenderer (FinishedDeletingRepositoryContentsR uuid) []
+ url <- liftIO $ renderUrl urlrenderer (FinishDeleteRepositoryR uuid) []
close <- asIO1 removeAlert
void $ addAlert $ remoteRemovalAlert desc $ AlertButton
- { buttonLabel = T.pack "Finish removal"
+ { buttonLabel = T.pack "Finish deletion process"
, buttonUrl = url
, buttonAction = Just close
}
+#else
+
#endif