1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 19:44:50 +09:00

In /browse, add repo-less project table, so that all projects are listed

This commit is contained in:
fr33domlover 2019-12-28 18:04:05 +00:00
parent d8fabbdfc5
commit 878e8f4056
2 changed files with 40 additions and 16 deletions

View file

@ -374,24 +374,34 @@ postPublishR = do
getBrowseR :: Handler Html
getBrowseR = do
rows <- do
repos <- runDB $ E.select $ E.from $
\ (repo `E.LeftOuterJoin` project `E.InnerJoin` sharer) -> do
E.on $ repo E.^. RepoSharer E.==. sharer E.^. SharerId
E.on $ repo E.^. RepoProject E.==. project E.?. ProjectId
E.orderBy
[ E.asc $ sharer E.^. SharerIdent
, E.asc $ project E.?. ProjectIdent
, E.asc $ repo E.^. RepoIdent
]
(rowsRepo, rowsProject) <- do
(repos, projects) <- runDB $ do
rs <- E.select $ E.from $
\ (repo `E.LeftOuterJoin` project `E.InnerJoin` sharer) -> do
E.on $ repo E.^. RepoSharer E.==. sharer E.^. SharerId
E.on $ repo E.^. RepoProject E.==. project E.?. ProjectId
E.orderBy
[ E.asc $ sharer E.^. SharerIdent
, E.asc $ project E.?. ProjectIdent
, E.asc $ repo E.^. RepoIdent
]
return
( sharer E.^. SharerIdent
, project E.?. ProjectIdent
, repo E.^. RepoIdent
, repo E.^. RepoVcs
)
js <- E.select $ E.from $ \ (j `E.InnerJoin` s `E.LeftOuterJoin` r) -> do
E.on $ E.just (j E.^. ProjectId) E.==. E.joinV (r E.?. RepoProject)
E.on $ j E.^. ProjectSharer E.==. s E.^. SharerId
E.where_ $ E.isNothing $ r E.?. RepoId
return
( sharer E.^. SharerIdent
, project E.?. ProjectIdent
, repo E.^. RepoIdent
, repo E.^. RepoVcs
( s E.^. SharerIdent
, j E.^. ProjectIdent
)
return (rs, js)
now <- liftIO getCurrentTime
forM repos $
repoRows <- forM repos $
\ (E.Value sharer, E.Value mproj, E.Value repo, E.Value vcs) -> do
path <- askRepoDir sharer repo
mlast <- case vcs of
@ -405,6 +415,7 @@ getBrowseR = do
FriendlyConvert $
now `diffUTCTime` t
return (sharer, mproj, repo, vcs, mlast)
return (repoRows, projects)
defaultLayout $ do
setTitle "Welcome to Vervis!"
$(widgetFile "homepage")

View file

@ -63,7 +63,7 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<th>Repo
<th>VCS
<th>Last change
$forall (sharer, mproj, repo, vcs, ago) <- rows
$forall (sharer, mproj, repo, vcs, ago) <- rowsRepo
<tr>
<td>
<a href=@{SharerR sharer}>#{shr2text sharer}
@ -86,6 +86,19 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
$nothing
Error
<h2>Projects without repos
<table>
<tr>
<th>Sharer
<th>Project
$forall (E.Value sharer, E.Value project) <- rowsProject
<tr>
<td>
<a href=@{SharerR sharer}>#{shr2text sharer}
<td>
<a href=@{ProjectR sharer project}>#{prj2text project}
<h2>People
<p>