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 , 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 :: (Field WebApp WebApp Text) -> SshInput -> AForm WebApp WebApp SshInput
sshInputAForm hostnamefield def = SshInput sshInputAForm hostnamefield def = SshInput
<$> aopt check_hostname "Host name" (Just $ inputHostname def) <$> aopt check_hostname "Host name" (Just $ inputHostname def)
@ -104,6 +112,9 @@ getAddSshR = sshConfigurator $ do
where where
showform form enctype status = $(widgetFile "configurators/ssh/add") 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 {- To enable an existing rsync special remote, parse the SshInput from
- its rsyncurl, and display a form whose only real purpose is to check - 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 - 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 $ getConfirmSshR sshdata = sshConfigurator $
$(widgetFile "configurators/ssh/confirm") $(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 :: SshData -> Handler RepHtml
getMakeSshGitR = makeSsh False setupGroup getMakeSshGitR = makeSsh False setupGroup

View file

@ -33,6 +33,7 @@
/config/repository/add/drive AddDriveR GET /config/repository/add/drive AddDriveR GET
/config/repository/add/ssh AddSshR GET /config/repository/add/ssh AddSshR GET
/config/repository/add/ssh/confirm/#SshData ConfirmSshR 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/git/#SshData MakeSshGitR GET
/config/repository/add/ssh/make/rsync/#SshData MakeSshRsyncR GET /config/repository/add/ssh/make/rsync/#SshData MakeSshRsyncR GET
/config/repository/add/cloud/rsync.net AddRsyncNetR 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 * webapp: Display an alert when there are XMPP remotes, and a cloud
transfer repository needs to be configured. transfer repository needs to be configured.
* Add incrementalbackup repository group. * 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 -- Joey Hess <joeyh@debian.org> Fri, 15 Mar 2013 00:10:07 -0400

View file

@ -20,12 +20,4 @@
<div .form-actions> <div .form-actions>
<button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');"> <button .btn .btn-primary type=submit onclick="$('#testmodal').modal('show');">
Check this server Check this server
<div .modal .fade #testmodal> ^{sshTestModal}
<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.

View file

@ -2,15 +2,24 @@
<h2> <h2>
Ready to add remote server Ready to add remote server
<div .row-fluid> <div .row-fluid>
<div .span8> <div .span9>
<p> <p>
The server #{sshHostName sshdata} has been verified to be usable. The server #{sshHostName sshdata} has been verified to be usable.
$if not (rsyncOnly sshdata)
<p> <p>
You have two options for how to use the server: You have two options for how to use the server:
<p> <p>
$if not (rsyncOnly sshdata)
<a .btn .btn-primary href="@{MakeSshGitR sshdata}" onclick="$('#setupmodal').modal('show');"> <a .btn .btn-primary href="@{MakeSshGitR sshdata}" onclick="$('#setupmodal').modal('show');">
Use a git repository on the server 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>
<i .icon-warning-sign></i> #
<i>
The server needs git and git-annex installed to use this option.
<br> <br>
All your data will be uploaded to the server, including the full # 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 # git repository. This is a great choice if you want to set up #
@ -32,6 +41,7 @@
<i .icon-info-sign></i> # <i .icon-info-sign></i> #
A ssh key will be installed on the server, allowing git-annex to # A ssh key will be installed on the server, allowing git-annex to #
access it securely without a password. access it securely without a password.
^{sshTestModal}
<div .modal .fade #setupmodal> <div .modal .fade #setupmodal>
<div .modal-header> <div .modal-header>
<h3> <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.