diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs index 018fbf5830..745694f59a 100644 --- a/Assistant/Alert.hs +++ b/Assistant/Alert.hs @@ -329,10 +329,10 @@ pairRequestAcknowledgedAlert who button = baseActivityAlert , alertButtons = maybeToList button } -xmppNeededAlert :: AlertButton -> Alert -xmppNeededAlert button = Alert +connectionNeededAlert :: AlertButton -> Alert +connectionNeededAlert button = Alert { alertHeader = Just "Share with friends, and keep your devices in sync across the cloud." - , alertIcon = Just TheCloud + , alertIcon = Just ConnectionIcon , alertPriority = High , alertButtons = [button] , alertClosable = True @@ -340,7 +340,7 @@ xmppNeededAlert button = Alert , alertMessageRender = renderData , alertCounter = 0 , alertBlockDisplay = True - , alertName = Just $ XMPPNeededAlert + , alertName = Just ConnectionNeededAlert , alertCombiner = Just $ dataCombiner $ \_old new -> new , alertData = [] } diff --git a/Assistant/Types/Alert.hs b/Assistant/Types/Alert.hs index 19fe55e6e2..9fd33c7a21 100644 --- a/Assistant/Types/Alert.hs +++ b/Assistant/Types/Alert.hs @@ -26,7 +26,7 @@ data AlertName | SanityCheckFixAlert | WarningAlert String | PairAlert String - | XMPPNeededAlert + | ConnectionNeededAlert | RemoteRemovalAlert String | CloudRepoNeededAlert | SyncAlert @@ -54,7 +54,7 @@ data Alert = Alert , alertButtons :: [AlertButton] } -data AlertIcon = ActivityIcon | SyncIcon | SuccessIcon | ErrorIcon | InfoIcon | UpgradeIcon | TheCloud +data AlertIcon = ActivityIcon | SyncIcon | SuccessIcon | ErrorIcon | InfoIcon | UpgradeIcon | ConnectionIcon type AlertMap = M.Map AlertId Alert diff --git a/Assistant/WebApp/Configurators.hs b/Assistant/WebApp/Configurators.hs index 625546dfee..1978e52efc 100644 --- a/Assistant/WebApp/Configurators.hs +++ b/Assistant/WebApp/Configurators.hs @@ -39,6 +39,14 @@ makeMiscRepositories = $(widgetFile "configurators/addrepository/misc") makeCloudRepositories :: Widget makeCloudRepositories = $(widgetFile "configurators/addrepository/cloud") +makeXMPPConnection :: Widget +makeXMPPConnection = $(widgetFile "configurators/addrepository/xmppconnection") + +makeSshRepository :: Widget +makeSshRepository = $(widgetFile "configurators/addrepository/ssh") + +makeConnectionRepositories :: Widget +makeConnectionRepositories = $(widgetFile "configurators/addrepository/connection") + makeArchiveRepositories :: Widget makeArchiveRepositories = $(widgetFile "configurators/addrepository/archive") - diff --git a/Assistant/WebApp/Configurators/Edit.hs b/Assistant/WebApp/Configurators/Edit.hs index f005e17792..22483dd024 100644 --- a/Assistant/WebApp/Configurators/Edit.hs +++ b/Assistant/WebApp/Configurators/Edit.hs @@ -11,11 +11,12 @@ module Assistant.WebApp.Configurators.Edit where import Assistant.WebApp.Common import Assistant.WebApp.Gpg +import Assistant.WebApp.Configurators import Assistant.DaemonStatus import Assistant.WebApp.MakeRemote (uniqueRemoteName) -import Assistant.WebApp.Configurators.XMPP (xmppNeeded) import Assistant.ScanRemotes import Assistant.Sync +import Assistant.Alert import qualified Assistant.WebApp.Configurators.AWS as AWS import qualified Assistant.WebApp.Configurators.IA as IA #ifdef WITH_S3 @@ -183,7 +184,7 @@ getEditNewCloudRepositoryR :: UUID -> Handler Html getEditNewCloudRepositoryR = postEditNewCloudRepositoryR postEditNewCloudRepositoryR :: UUID -> Handler Html -postEditNewCloudRepositoryR uuid = xmppNeeded >> editForm True (RepoUUID uuid) +postEditNewCloudRepositoryR uuid = connectionNeeded >> editForm True (RepoUUID uuid) editForm :: Bool -> RepoId -> Handler Html editForm new (RepoUUID uuid) = page "Edit repository" (Just Configuration) $ do @@ -275,3 +276,23 @@ getUpgradeRepositoryR r = go =<< liftAnnex (repoIdRemote r) liftAssistant updateSyncRemotes liftAssistant $ syncRemote rmt redirect DashboardR + +{- If there is no currently connected remote, display an alert suggesting + - to set up one. -} +connectionNeeded :: Handler () +connectionNeeded = whenM noconnection $ do + urlrender <- getUrlRender + void $ liftAssistant $ do + close <- asIO1 removeAlert + addAlert $ connectionNeededAlert $ AlertButton + { buttonLabel = "Connnect" + , buttonUrl = urlrender ConnectionNeededR + , buttonAction = Just close + , buttonPrimary = True + } + where + noconnection = S.null . currentlyConnectedRemotes <$> liftAssistant getDaemonStatus + +getConnectionNeededR :: Handler Html +getConnectionNeededR = page "Connection needed" (Just Configuration) $ do + $(widgetFile "configurators/needconnection") diff --git a/Assistant/WebApp/Configurators/XMPP.hs b/Assistant/WebApp/Configurators/XMPP.hs index e7ba6c0736..4df2e07d99 100644 --- a/Assistant/WebApp/Configurators/XMPP.hs +++ b/Assistant/WebApp/Configurators/XMPP.hs @@ -32,23 +32,6 @@ import Network import qualified Data.Text as T #endif -{- Displays an alert suggesting to configure XMPP. -} -xmppNeeded :: Handler () -#ifdef WITH_XMPP -xmppNeeded = whenM (isNothing <$> liftAnnex getXMPPCreds) $ do - urlrender <- getUrlRender - void $ liftAssistant $ do - close <- asIO1 removeAlert - addAlert $ xmppNeededAlert $ AlertButton - { buttonLabel = "Configure a Jabber account" - , buttonUrl = urlrender XMPPConfigR - , buttonAction = Just close - , buttonPrimary = True - } -#else -xmppNeeded = return () -#endif - {- When appropriate, displays an alert suggesting to configure a cloud repo - to suppliment an XMPP remote. -} checkCloudRepos :: UrlRenderer -> Remote -> Assistant () diff --git a/Assistant/WebApp/SideBar.hs b/Assistant/WebApp/SideBar.hs index 2c33ec86fb..a8f08501dd 100644 --- a/Assistant/WebApp/SideBar.hs +++ b/Assistant/WebApp/SideBar.hs @@ -103,8 +103,7 @@ htmlIcon InfoIcon = bootstrapIcon "info-sign" htmlIcon SuccessIcon = bootstrapIcon "ok" htmlIcon ErrorIcon = bootstrapIcon "exclamation-sign" htmlIcon UpgradeIcon = bootstrapIcon "arrow-up" --- utf-8 umbrella (utf-8 cloud looks too stormy) -htmlIcon TheCloud = [whamlet|☂|] +htmlIcon ConnectionIcon = bootstrapIcon "signal" bootstrapIcon :: Text -> Widget bootstrapIcon name = [whamlet||] diff --git a/Assistant/WebApp/routes b/Assistant/WebApp/routes index 44e07c6dba..3c5efc92e2 100644 --- a/Assistant/WebApp/routes +++ b/Assistant/WebApp/routes @@ -20,6 +20,7 @@ /config/xmpp/for/self XMPPConfigForPairSelfR GET POST /config/xmpp/for/frield XMPPConfigForPairFriendR GET POST /config/xmpp/needcloudrepo/#UUID NeedCloudRepoR GET +/config/needconnection ConnectionNeededR GET /config/fsck ConfigFsckR GET POST /config/fsck/preferences ConfigFsckPreferencesR POST /config/upgrade/start/#GitAnnexDistribution ConfigStartUpgradeR GET diff --git a/debian/changelog b/debian/changelog index ab632935b8..31050b9e32 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ git-annex (5.20140406) UNRELEASED; urgency=medium Requires the remote server have git-annex-shell with notifychanges support. * webapp: Show a network signal icon next to ssh and xmpp remotes that it's currently connected with. + * webapp: Rework xmpp nudge to prompt for either xmpp or a ssh remote be + set up. -- Joey Hess Mon, 07 Apr 2014 16:22:02 -0400 diff --git a/templates/configurators/addrepository/cloud.hamlet b/templates/configurators/addrepository/cloud.hamlet index 22d42fc0a8..c5dad16a4f 100644 --- a/templates/configurators/addrepository/cloud.hamlet +++ b/templates/configurators/addrepository/cloud.hamlet @@ -18,9 +18,4 @@

Good choice for professional quality storage. -

- - Remote server -

- Set up a repository on a remote server using # - ssh. +^{makeSshRepository} diff --git a/templates/configurators/addrepository/connection.hamlet b/templates/configurators/addrepository/connection.hamlet new file mode 100644 index 0000000000..fc111b0653 --- /dev/null +++ b/templates/configurators/addrepository/connection.hamlet @@ -0,0 +1,3 @@ +^{makeXMPPConnection} + +^{makeSshRepository} diff --git a/templates/configurators/addrepository/misc.hamlet b/templates/configurators/addrepository/misc.hamlet index 5f0cc6be97..79b1937e07 100644 --- a/templates/configurators/addrepository/misc.hamlet +++ b/templates/configurators/addrepository/misc.hamlet @@ -7,17 +7,7 @@ SneakerNet # between computers. -

- - Share with your other devices -

- Keep files in sync between your devices running git-annex. - -

- - Share with a friend -

- Combine your repository with a friend's repository, and share your files. +^{makeXMPPConnection}

@@ -31,3 +21,5 @@ Add another repository

Make another repository on your computer. + +^{makeSshRepository} diff --git a/templates/configurators/addrepository/ssh.hamlet b/templates/configurators/addrepository/ssh.hamlet new file mode 100644 index 0000000000..c41ad1117b --- /dev/null +++ b/templates/configurators/addrepository/ssh.hamlet @@ -0,0 +1,6 @@ +

+ + Remote server +

+ Set up a repository on a remote server using # + ssh. diff --git a/templates/configurators/addrepository/xmppconnection.hamlet b/templates/configurators/addrepository/xmppconnection.hamlet new file mode 100644 index 0000000000..2fae69deeb --- /dev/null +++ b/templates/configurators/addrepository/xmppconnection.hamlet @@ -0,0 +1,11 @@ +

+ + Share with your other devices +

+ Keep files in sync between your devices running git-annex. + +

+ + Share with a friend +

+ Combine your repository with a friend's repository, and share your files. diff --git a/templates/configurators/needconnection.hamlet b/templates/configurators/needconnection.hamlet new file mode 100644 index 0000000000..4cb9dc5de0 --- /dev/null +++ b/templates/configurators/needconnection.hamlet @@ -0,0 +1,12 @@ +

+

+ Connection needed +

+ In order to quickly sync with other repositories, # + a direct connection is needed to another git-annex. # +

+ You don't currently seem to have such a connection configured -- # + or if you do, it's not currently connected! +

+ Add a connection + ^{makeConnectionRepositories}