1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-28 13:14:51 +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 :: Handler Html
getBrowseR = do getBrowseR = do
rows <- do (rowsRepo, rowsProject) <- do
repos <- runDB $ E.select $ E.from $ (repos, projects) <- runDB $ do
\ (repo `E.LeftOuterJoin` project `E.InnerJoin` sharer) -> do rs <- E.select $ E.from $
E.on $ repo E.^. RepoSharer E.==. sharer E.^. SharerId \ (repo `E.LeftOuterJoin` project `E.InnerJoin` sharer) -> do
E.on $ repo E.^. RepoProject E.==. project E.?. ProjectId E.on $ repo E.^. RepoSharer E.==. sharer E.^. SharerId
E.orderBy E.on $ repo E.^. RepoProject E.==. project E.?. ProjectId
[ E.asc $ sharer E.^. SharerIdent E.orderBy
, E.asc $ project E.?. ProjectIdent [ E.asc $ sharer E.^. SharerIdent
, E.asc $ repo E.^. RepoIdent , 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 return
( sharer E.^. SharerIdent ( s E.^. SharerIdent
, project E.?. ProjectIdent , j E.^. ProjectIdent
, repo E.^. RepoIdent
, repo E.^. RepoVcs
) )
return (rs, js)
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
forM repos $ repoRows <- forM repos $
\ (E.Value sharer, E.Value mproj, E.Value repo, E.Value vcs) -> do \ (E.Value sharer, E.Value mproj, E.Value repo, E.Value vcs) -> do
path <- askRepoDir sharer repo path <- askRepoDir sharer repo
mlast <- case vcs of mlast <- case vcs of
@ -405,6 +415,7 @@ getBrowseR = do
FriendlyConvert $ FriendlyConvert $
now `diffUTCTime` t now `diffUTCTime` t
return (sharer, mproj, repo, vcs, mlast) return (sharer, mproj, repo, vcs, mlast)
return (repoRows, projects)
defaultLayout $ do defaultLayout $ do
setTitle "Welcome to Vervis!" setTitle "Welcome to Vervis!"
$(widgetFile "homepage") $(widgetFile "homepage")

View file

@ -63,7 +63,7 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<th>Repo <th>Repo
<th>VCS <th>VCS
<th>Last change <th>Last change
$forall (sharer, mproj, repo, vcs, ago) <- rows $forall (sharer, mproj, repo, vcs, ago) <- rowsRepo
<tr> <tr>
<td> <td>
<a href=@{SharerR sharer}>#{shr2text sharer} <a href=@{SharerR sharer}>#{shr2text sharer}
@ -86,6 +86,19 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
$nothing $nothing
Error 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 <h2>People
<p> <p>