improved config
This commit is contained in:
parent
1bd2be549f
commit
e0c3958d9a
10 changed files with 103 additions and 105 deletions
|
@ -35,46 +35,52 @@ getConfigR :: Handler RepHtml
|
||||||
getConfigR = ifM (inFirstRun)
|
getConfigR = ifM (inFirstRun)
|
||||||
( getFirstRepositoryR
|
( getFirstRepositoryR
|
||||||
, bootstrap (Just Config) $ do
|
, bootstrap (Just Config) $ do
|
||||||
sideBarDisplay $ Just sidebar
|
sideBarDisplay
|
||||||
setTitle "Configuration"
|
setTitle "Configuration"
|
||||||
$(widgetFile "configurators/main")
|
$(widgetFile "configurators/main")
|
||||||
)
|
)
|
||||||
where
|
|
||||||
sidebar = do
|
|
||||||
(_repolist, numrepos, notenough, barelyenough, morethanenough)
|
|
||||||
<- lift repoList
|
|
||||||
$(widgetFile "configurators/main/sidebar")
|
|
||||||
|
|
||||||
{- Lists different types of repositories that can be added. -}
|
{- Lists different types of repositories that can be added. -}
|
||||||
getAddRepositoryR :: Handler RepHtml
|
getAddRepositoryR :: Handler RepHtml
|
||||||
getAddRepositoryR = bootstrap (Just Config) $ do
|
getAddRepositoryR = bootstrap (Just Config) $ do
|
||||||
sideBarDisplay Nothing
|
sideBarDisplay
|
||||||
setTitle "Add repository"
|
setTitle "Add repository"
|
||||||
$(widgetFile "configurators/addrepository")
|
$(widgetFile "configurators/addrepository")
|
||||||
|
|
||||||
{- A numbered list of known repositories, including the current one,
|
{- Lists known repositories. -}
|
||||||
- as well as the total number, and whether that is not enough,
|
getListRepositoriesR :: Handler RepHtml
|
||||||
- barely enough, or more than enough. -}
|
getListRepositoriesR = bootstrap (Just Config) $ do
|
||||||
repoList :: Handler ([(String, String)], String, Bool, Bool, Bool)
|
sideBarDisplay
|
||||||
|
setTitle "Repository list"
|
||||||
|
repolist <- lift repoList
|
||||||
|
$(widgetFile "configurators/listrepositories")
|
||||||
|
|
||||||
|
{- A numbered list of known repositories, including the current one. -}
|
||||||
|
repoList :: Handler [(String, String)]
|
||||||
repoList = do
|
repoList = do
|
||||||
l <- runAnnex [] $ do
|
l <- runAnnex [] $ do
|
||||||
u <- getUUID
|
u <- getUUID
|
||||||
rs <- map Remote.uuid <$> Remote.remoteList
|
rs <- map Remote.uuid <$> Remote.remoteList
|
||||||
rs' <- snd <$> trustPartition DeadTrusted rs
|
rs' <- snd <$> trustPartition DeadTrusted rs
|
||||||
Remote.prettyListUUIDs $ filter (/= webUUID) $ nub $ u:rs'
|
Remote.prettyListUUIDs $ filter (/= webUUID) $ nub $ u:rs'
|
||||||
let n = length l
|
return $ zip counter l
|
||||||
return (zip counter l, show (length l), n < enough, n == enough, n > enough)
|
|
||||||
where
|
where
|
||||||
counter = map show ([1..] :: [Int])
|
counter = map show ([1..] :: [Int])
|
||||||
enough = 2
|
|
||||||
|
|
||||||
{- An intro message, list of repositories, and nudge to make more. -}
|
{- An intro message, list of repositories, and nudge to make more. -}
|
||||||
introDisplay :: Text -> Widget
|
introDisplay :: Text -> Widget
|
||||||
introDisplay ident = do
|
introDisplay ident = do
|
||||||
webapp <- lift getYesod
|
webapp <- lift getYesod
|
||||||
(repolist, numrepos, notenough, barelyenough, morethanenough) <- lift repoList
|
repolist <- lift repoList
|
||||||
|
let n = length repolist
|
||||||
|
let numrepos = show n
|
||||||
|
let notenough = n < enough
|
||||||
|
let barelyenough = n == enough
|
||||||
|
let morethanenough = n > enough
|
||||||
$(widgetFile "configurators/intro")
|
$(widgetFile "configurators/intro")
|
||||||
lift $ modifyWebAppState $ \s -> s { showIntro = False }
|
lift $ modifyWebAppState $ \s -> s { showIntro = False }
|
||||||
|
where
|
||||||
|
enough = 2
|
||||||
|
|
||||||
data RepositoryPath = RepositoryPath Text
|
data RepositoryPath = RepositoryPath Text
|
||||||
deriving Show
|
deriving Show
|
||||||
|
@ -160,7 +166,7 @@ addLocalRepositoryForm msg = do
|
||||||
|
|
||||||
getFirstRepositoryR :: Handler RepHtml
|
getFirstRepositoryR :: Handler RepHtml
|
||||||
getFirstRepositoryR = bootstrap (Just Config) $ do
|
getFirstRepositoryR = bootstrap (Just Config) $ do
|
||||||
sideBarDisplay Nothing
|
sideBarDisplay
|
||||||
setTitle "Getting started"
|
setTitle "Getting started"
|
||||||
((res, form), enctype) <- lift $ runFormGet addLocalRepositoryForm
|
((res, form), enctype) <- lift $ runFormGet addLocalRepositoryForm
|
||||||
case res of
|
case res of
|
||||||
|
|
|
@ -68,7 +68,7 @@ getTransfersR nid = do
|
||||||
{- The main dashboard. -}
|
{- The main dashboard. -}
|
||||||
dashboard :: Bool -> Widget
|
dashboard :: Bool -> Widget
|
||||||
dashboard warnNoScript = do
|
dashboard warnNoScript = do
|
||||||
sideBarDisplay Nothing
|
sideBarDisplay
|
||||||
let content = transfersDisplay warnNoScript
|
let content = transfersDisplay warnNoScript
|
||||||
$(widgetFile "dashboard/main")
|
$(widgetFile "dashboard/main")
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,6 @@ import Yesod
|
||||||
|
|
||||||
getAboutR :: Handler RepHtml
|
getAboutR :: Handler RepHtml
|
||||||
getAboutR = bootstrap (Just About) $ do
|
getAboutR = bootstrap (Just About) $ do
|
||||||
sideBarDisplay Nothing
|
sideBarDisplay
|
||||||
setTitle "About git-annex"
|
setTitle "About git-annex"
|
||||||
$(widgetFile "documentation/about")
|
$(widgetFile "documentation/about")
|
||||||
|
|
|
@ -22,11 +22,8 @@ import Data.Text (Text)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
|
||||||
sideBarDisplay :: Maybe Widget -> Widget
|
sideBarDisplay :: Widget
|
||||||
sideBarDisplay onsidebar = do
|
sideBarDisplay = do
|
||||||
{- If a widget was passed to include on the sidebar, display
|
|
||||||
- it above alerts. -}
|
|
||||||
let perpage = maybe noop id onsidebar
|
|
||||||
let content = do
|
let content = do
|
||||||
{- Any yesod message appears as the first alert. -}
|
{- Any yesod message appears as the first alert. -}
|
||||||
maybe noop rendermessage =<< lift getMessage
|
maybe noop rendermessage =<< lift getMessage
|
||||||
|
@ -86,7 +83,7 @@ getSideBarR nid = do
|
||||||
- to avoid slowing down user actions like closing alerts. -}
|
- to avoid slowing down user actions like closing alerts. -}
|
||||||
liftIO $ threadDelay 100000
|
liftIO $ threadDelay 100000
|
||||||
|
|
||||||
page <- widgetToPageContent $ sideBarDisplay Nothing
|
page <- widgetToPageContent sideBarDisplay
|
||||||
hamletToRepHtml $ [hamlet|^{pageBody page}|]
|
hamletToRepHtml $ [hamlet|^{pageBody page}|]
|
||||||
|
|
||||||
{- Called by the client to close an alert. -}
|
{- Called by the client to close an alert. -}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
/ HomeR GET
|
/ HomeR GET
|
||||||
/noscript NoScriptR GET
|
/noscript NoScriptR GET
|
||||||
/noscriptauto NoScriptAutoR GET
|
/noscript/auto NoScriptAutoR GET
|
||||||
/about AboutR GET
|
/about AboutR GET
|
||||||
|
|
||||||
/config ConfigR GET
|
/config ConfigR GET
|
||||||
/config/addrepository AddRepositoryR GET
|
/config/repository/add AddRepositoryR GET
|
||||||
/config/firstrepository FirstRepositoryR GET
|
/config/repository/first FirstRepositoryR GET
|
||||||
|
/config/repository/list ListRepositoriesR GET
|
||||||
|
|
||||||
/transfers/#NotificationId TransfersR GET
|
/transfers/#NotificationId TransfersR GET
|
||||||
/sidebar/#NotificationId SideBarR GET
|
/sidebar/#NotificationId SideBarR GET
|
||||||
|
|
|
@ -1,10 +1,52 @@
|
||||||
<div .row-fluid>
|
<div .span9>
|
||||||
<div .span4>
|
<h2>
|
||||||
<h3>
|
Add repositories
|
||||||
Clone to removable drive
|
<div .row-fluid>
|
||||||
<p>
|
<div .span4>
|
||||||
Clone this repository to a USB drive, or other removable media, #
|
<h3>
|
||||||
for offline archiving, backups, or to #
|
<a href="">
|
||||||
<a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
|
Clone to a removable drive
|
||||||
between computers.
|
<p>
|
||||||
|
Clone this repository to a USB drive, memory stick, or other #
|
||||||
|
removable media.
|
||||||
|
<p>
|
||||||
|
For offline archiving, backups, or to #
|
||||||
|
<a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
|
||||||
|
between computers.
|
||||||
|
<div .span4>
|
||||||
|
<h3>
|
||||||
|
<a href="">
|
||||||
|
Pair with a local computer
|
||||||
|
<p>
|
||||||
|
Automatically keep files in sync between computers on your #
|
||||||
|
local network.
|
||||||
|
<p>
|
||||||
|
For easy sharing with family and friends, or between your devices.
|
||||||
|
<div .span4>
|
||||||
|
<h3>
|
||||||
|
<a href="">
|
||||||
|
Connect to your phone
|
||||||
|
<p>
|
||||||
|
Save photos and recordings from your phone.
|
||||||
|
<p>
|
||||||
|
Send selected files to your phone.
|
||||||
|
<div .row-fluid>
|
||||||
|
<div .span4>
|
||||||
|
<h3>
|
||||||
|
<a href="">
|
||||||
|
Store data in the cloud
|
||||||
|
<p>
|
||||||
|
Store your data on a third-party cloud platform, #
|
||||||
|
including Amazon S3, Box.com, and Rsync.net.
|
||||||
|
<p>
|
||||||
|
Pay someone to keep your data safe and available. #
|
||||||
|
With strong encryption to protect your privacy.
|
||||||
|
<div .span4>
|
||||||
|
<h3>
|
||||||
|
<a href="">
|
||||||
|
Clone to a remote server
|
||||||
|
<p>
|
||||||
|
Set up a repository on a remote server using #
|
||||||
|
<tt>ssh</tt> or <tt>rsync</tt>.
|
||||||
|
<p>
|
||||||
|
To use your own personal cloud.
|
||||||
|
|
9
templates/configurators/listrepositories.hamlet
Normal file
9
templates/configurators/listrepositories.hamlet
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<div .span9>
|
||||||
|
<table .table .table-striped .table-condensed>
|
||||||
|
<tbody>
|
||||||
|
$forall (num, name) <- repolist
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
#{num}
|
||||||
|
<td>
|
||||||
|
#{name}
|
|
@ -1,53 +1,15 @@
|
||||||
<div .span9>
|
<div .span9>
|
||||||
<h2>
|
|
||||||
Add repositories #
|
|
||||||
<small>
|
|
||||||
<div .row-fluid>
|
<div .row-fluid>
|
||||||
<div .span4>
|
<div .span4>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="">
|
<a href="@{AddRepositoryR}">
|
||||||
Clone to a removable drive
|
Add repositories
|
||||||
<p>
|
<p>
|
||||||
Clone this repository to a USB drive, memory stick, or other #
|
Distribute the files in this repository to other devices;
|
||||||
removable media.
|
make backups; and more by adding repositories.
|
||||||
<p>
|
|
||||||
For offline archiving, backups, or to #
|
|
||||||
<a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
|
|
||||||
between computers.
|
|
||||||
<div .span4>
|
<div .span4>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="">
|
<a href="@{ListRepositoriesR}">
|
||||||
Pair with a local computer
|
Repository list
|
||||||
<p>
|
<p>
|
||||||
Automatically keep files in sync between computers on your #
|
An overview of your repositories.
|
||||||
local network.
|
|
||||||
<p>
|
|
||||||
For easy sharing with family and friends, or between your devices.
|
|
||||||
<div .span4>
|
|
||||||
<h3>
|
|
||||||
<a href="">
|
|
||||||
Connect to your phone
|
|
||||||
<p>
|
|
||||||
Save photos and recordings from your phone.
|
|
||||||
<p>
|
|
||||||
Send selected files to your phone.
|
|
||||||
<div .row-fluid>
|
|
||||||
<div .span4>
|
|
||||||
<h3>
|
|
||||||
<a href="">
|
|
||||||
Store data in the cloud
|
|
||||||
<p>
|
|
||||||
Store your data on a third-party cloud platform, #
|
|
||||||
including Amazon S3, Box.com, and Rsync.net.
|
|
||||||
<p>
|
|
||||||
Pay someone to keep your data safe and available. #
|
|
||||||
With strong encryption to protect your privacy.
|
|
||||||
<div .span4>
|
|
||||||
<h3>
|
|
||||||
<a href="">
|
|
||||||
Clone to a remote server
|
|
||||||
<p>
|
|
||||||
Set up a repository on a remote server using #
|
|
||||||
<tt>ssh</tt> or <tt>rsync</tt>.
|
|
||||||
<p>
|
|
||||||
To use your own personal cloud.
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<div .alert .alert-info>
|
|
||||||
<h4 .alert-heading>
|
|
||||||
git-annex is managing #
|
|
||||||
$if notenough
|
|
||||||
only #
|
|
||||||
<span .badge .badge-error>#{numrepos}</span> repository. #
|
|
||||||
$else
|
|
||||||
$if barelyenough
|
|
||||||
<span .badge .badge-warning>#{numrepos}</span> repositories. #
|
|
||||||
$else
|
|
||||||
<span .badge .badge-success>#{numrepos}</span> repositories. #
|
|
||||||
$if notenough
|
|
||||||
Recommend you add more clones to avoid data loss.
|
|
||||||
$else
|
|
||||||
$if barelyenough
|
|
||||||
Consider adding more.
|
|
||||||
$else
|
|
||||||
Adding more can't hurt!
|
|
|
@ -1,4 +1,3 @@
|
||||||
<div .span3>
|
<div .span3 ##{ident}>
|
||||||
^{perpage}
|
<div .sidebar-nav>
|
||||||
<div .sidebar-nav ##{ident}>
|
|
||||||
^{content}
|
^{content}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue