webapp: Encourage user to install git-annex on a server when adding a ssh server, rather than just funneling them through to rsync.

This commit is contained in:
Joey Hess 2013-03-16 12:58:59 -04:00
parent ab0c6db755
commit 996e899acc
6 changed files with 50 additions and 20 deletions

View file

@ -49,6 +49,14 @@ mkSshData s = SshData
, rsyncOnly = False
}
mkSshInput :: SshData -> SshInput
mkSshInput s = SshInput
{ inputHostname = Just $ sshHostName s
, inputUsername = sshUserName s
, inputDirectory = Just $ sshDirectory s
, inputPort = sshPort s
}
sshInputAForm :: (Field WebApp WebApp Text) -> SshInput -> AForm WebApp WebApp SshInput
sshInputAForm hostnamefield def = SshInput
<$> aopt check_hostname "Host name" (Just $ inputHostname def)
@ -104,6 +112,9 @@ getAddSshR = sshConfigurator $ do
where
showform form enctype status = $(widgetFile "configurators/ssh/add")
sshTestModal :: Widget
sshTestModal = $(widgetFile "configurators/ssh/testmodal")
{- To enable an existing rsync special remote, parse the SshInput from
- its rsyncurl, and display a form whose only real purpose is to check
- if ssh public keys need to be set up. From there, we can proceed with
@ -243,6 +254,11 @@ getConfirmSshR :: SshData -> Handler RepHtml
getConfirmSshR sshdata = sshConfigurator $
$(widgetFile "configurators/ssh/confirm")
getRetrySshR :: SshData -> Handler ()
getRetrySshR sshdata = do
s <- liftIO $ testServer $ mkSshInput sshdata
redirect $ either (const $ ConfirmSshR sshdata) ConfirmSshR s
getMakeSshGitR :: SshData -> Handler RepHtml
getMakeSshGitR = makeSsh False setupGroup

View file

@ -33,6 +33,7 @@
/config/repository/add/drive AddDriveR GET
/config/repository/add/ssh AddSshR GET
/config/repository/add/ssh/confirm/#SshData ConfirmSshR GET
/config/repository/add/ssh/retry/#SshData RetrySshR GET
/config/repository/add/ssh/make/git/#SshData MakeSshGitR GET
/config/repository/add/ssh/make/rsync/#SshData MakeSshRsyncR GET
/config/repository/add/cloud/rsync.net AddRsyncNetR GET

2
debian/changelog vendored
View file

@ -6,6 +6,8 @@ git-annex (4.20130315) UNRELEASED; urgency=low
* webapp: Display an alert when there are XMPP remotes, and a cloud
transfer repository needs to be configured.
* Add incrementalbackup repository group.
* webapp: Encourage user to install git-annex on a server when adding
a ssh server, rather than just funneling them through to rsync.
-- Joey Hess <joeyh@debian.org> Fri, 15 Mar 2013 00:10:07 -0400

View file

@ -20,12 +20,4 @@
<div .form-actions>
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
Check this server
<div .modal .fade #testmodal>
<div .modal-header>
<h3>
Testing server ...
<div .modal-body>
<p>
Checking ssh connection to the server. This could take a minute.
<p>
You may be prompted for your password to log into the server.
^{sshTestModal}

View file

@ -2,22 +2,31 @@
<h2>
Ready to add remote server
<div .row-fluid>
<div .span8>
<div .span9>
<p>
The server #{sshHostName sshdata} has been verified to be usable.
$if not (rsyncOnly sshdata)
<p>
You have two options for how to use the server:
<p>
<p>
You have two options for how to use the server:
<p>
$if not (rsyncOnly sshdata)
<a .btn .btn-primary href="@{MakeSshGitR sshdata}" onclick="$('#setupmodal').modal('show');">
Use a git repository on the server
$else
<a .btn .disabled .btn-warning href="@{RetrySshR sshdata}" onclick="$('#testmodal').modal('show');">
Use a git repository on the server (not available) #
<a .btn .btn-primary href="@{RetrySshR sshdata}" onclick="$('#testmodal').modal('show');">
Retry
<br>
All your data will be uploaded to the server, including the full #
git repository. This is a great choice if you want to set up #
other devices to use the same server, or share the repository with #
others.
<p style="text-align: center">
-or-
<i .icon-warning-sign></i> #
<i>
The server needs git and git-annex installed to use this option.
<br>
All your data will be uploaded to the server, including the full #
git repository. This is a great choice if you want to set up #
other devices to use the same server, or share the repository with #
others.
<p style="text-align: center">
-or-
<p>
<a .btn .btn-primary href="@{MakeSshRsyncR sshdata}" onclick="$('#setupmodal').modal('show');">
Use an encrypted rsync repository on the server
@ -32,6 +41,7 @@
<i .icon-info-sign></i> #
A ssh key will be installed on the server, allowing git-annex to #
access it securely without a password.
^{sshTestModal}
<div .modal .fade #setupmodal>
<div .modal-header>
<h3>

View file

@ -0,0 +1,9 @@
<div .modal .fade #testmodal>
<div .modal-header>
<h3>
Testing server ...
<div .modal-body>
<p>
Checking ssh connection to the server. This could take a minute.
<p>
You may be prompted for your password to log into the server.