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)
|
||||
( getFirstRepositoryR
|
||||
, bootstrap (Just Config) $ do
|
||||
sideBarDisplay $ Just sidebar
|
||||
sideBarDisplay
|
||||
setTitle "Configuration"
|
||||
$(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. -}
|
||||
getAddRepositoryR :: Handler RepHtml
|
||||
getAddRepositoryR = bootstrap (Just Config) $ do
|
||||
sideBarDisplay Nothing
|
||||
sideBarDisplay
|
||||
setTitle "Add repository"
|
||||
$(widgetFile "configurators/addrepository")
|
||||
|
||||
{- A numbered list of known repositories, including the current one,
|
||||
- as well as the total number, and whether that is not enough,
|
||||
- barely enough, or more than enough. -}
|
||||
repoList :: Handler ([(String, String)], String, Bool, Bool, Bool)
|
||||
{- Lists known repositories. -}
|
||||
getListRepositoriesR :: Handler RepHtml
|
||||
getListRepositoriesR = bootstrap (Just Config) $ do
|
||||
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
|
||||
l <- runAnnex [] $ do
|
||||
u <- getUUID
|
||||
rs <- map Remote.uuid <$> Remote.remoteList
|
||||
rs' <- snd <$> trustPartition DeadTrusted rs
|
||||
Remote.prettyListUUIDs $ filter (/= webUUID) $ nub $ u:rs'
|
||||
let n = length l
|
||||
return (zip counter l, show (length l), n < enough, n == enough, n > enough)
|
||||
return $ zip counter l
|
||||
where
|
||||
counter = map show ([1..] :: [Int])
|
||||
enough = 2
|
||||
|
||||
{- An intro message, list of repositories, and nudge to make more. -}
|
||||
introDisplay :: Text -> Widget
|
||||
introDisplay ident = do
|
||||
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")
|
||||
lift $ modifyWebAppState $ \s -> s { showIntro = False }
|
||||
where
|
||||
enough = 2
|
||||
|
||||
data RepositoryPath = RepositoryPath Text
|
||||
deriving Show
|
||||
|
@ -160,7 +166,7 @@ addLocalRepositoryForm msg = do
|
|||
|
||||
getFirstRepositoryR :: Handler RepHtml
|
||||
getFirstRepositoryR = bootstrap (Just Config) $ do
|
||||
sideBarDisplay Nothing
|
||||
sideBarDisplay
|
||||
setTitle "Getting started"
|
||||
((res, form), enctype) <- lift $ runFormGet addLocalRepositoryForm
|
||||
case res of
|
||||
|
|
|
@ -68,7 +68,7 @@ getTransfersR nid = do
|
|||
{- The main dashboard. -}
|
||||
dashboard :: Bool -> Widget
|
||||
dashboard warnNoScript = do
|
||||
sideBarDisplay Nothing
|
||||
sideBarDisplay
|
||||
let content = transfersDisplay warnNoScript
|
||||
$(widgetFile "dashboard/main")
|
||||
|
||||
|
|
|
@ -17,6 +17,6 @@ import Yesod
|
|||
|
||||
getAboutR :: Handler RepHtml
|
||||
getAboutR = bootstrap (Just About) $ do
|
||||
sideBarDisplay Nothing
|
||||
sideBarDisplay
|
||||
setTitle "About git-annex"
|
||||
$(widgetFile "documentation/about")
|
||||
|
|
|
@ -22,11 +22,8 @@ import Data.Text (Text)
|
|||
import qualified Data.Map as M
|
||||
import Control.Concurrent
|
||||
|
||||
sideBarDisplay :: Maybe Widget -> Widget
|
||||
sideBarDisplay onsidebar = do
|
||||
{- If a widget was passed to include on the sidebar, display
|
||||
- it above alerts. -}
|
||||
let perpage = maybe noop id onsidebar
|
||||
sideBarDisplay :: Widget
|
||||
sideBarDisplay = do
|
||||
let content = do
|
||||
{- Any yesod message appears as the first alert. -}
|
||||
maybe noop rendermessage =<< lift getMessage
|
||||
|
@ -86,7 +83,7 @@ getSideBarR nid = do
|
|||
- to avoid slowing down user actions like closing alerts. -}
|
||||
liftIO $ threadDelay 100000
|
||||
|
||||
page <- widgetToPageContent $ sideBarDisplay Nothing
|
||||
page <- widgetToPageContent sideBarDisplay
|
||||
hamletToRepHtml $ [hamlet|^{pageBody page}|]
|
||||
|
||||
{- Called by the client to close an alert. -}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/ HomeR GET
|
||||
/noscript NoScriptR GET
|
||||
/noscriptauto NoScriptAutoR GET
|
||||
/noscript/auto NoScriptAutoR GET
|
||||
/about AboutR GET
|
||||
|
||||
/config ConfigR GET
|
||||
/config/addrepository AddRepositoryR GET
|
||||
/config/firstrepository FirstRepositoryR GET
|
||||
/config/repository/add AddRepositoryR GET
|
||||
/config/repository/first FirstRepositoryR GET
|
||||
/config/repository/list ListRepositoriesR GET
|
||||
|
||||
/transfers/#NotificationId TransfersR GET
|
||||
/sidebar/#NotificationId SideBarR GET
|
||||
|
|
|
@ -1,10 +1,52 @@
|
|||
<div .row-fluid>
|
||||
<div .span4>
|
||||
<h3>
|
||||
Clone to removable drive
|
||||
<p>
|
||||
Clone this repository to a USB drive, or other removable media, #
|
||||
for offline archiving, backups, or to #
|
||||
<a href="http://en.wikipedia.org/wiki/Sneakernet">SneakerNet</a> #
|
||||
between computers.
|
||||
|
||||
<div .span9>
|
||||
<h2>
|
||||
Add repositories
|
||||
<div .row-fluid>
|
||||
<div .span4>
|
||||
<h3>
|
||||
<a href="">
|
||||
Clone to a removable drive
|
||||
<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>
|
||||
<h2>
|
||||
Add repositories #
|
||||
<small>
|
||||
<div .row-fluid>
|
||||
<div .span4>
|
||||
<h3>
|
||||
<a href="">
|
||||
Clone to a removable drive
|
||||
<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.
|
||||
<a href="@{AddRepositoryR}">
|
||||
Add repositories
|
||||
<p>
|
||||
Distribute the files in this repository to other devices;
|
||||
make backups; and more by adding repositories.
|
||||
<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.
|
||||
<a href="@{ListRepositoriesR}">
|
||||
Repository list
|
||||
<p>
|
||||
An overview of your repositories.
|
||||
|
|
|
@ -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>
|
||||
^{perpage}
|
||||
<div .sidebar-nav ##{ident}>
|
||||
<div .span3 ##{ident}>
|
||||
<div .sidebar-nav>
|
||||
^{content}
|
||||
|
|
Loading…
Add table
Reference in a new issue