From 878e8f40564c11b1710acfd81687a40e8b8e1a03 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sat, 28 Dec 2019 18:04:05 +0000 Subject: [PATCH] In /browse, add repo-less project table, so that all projects are listed --- src/Vervis/Handler/Client.hs | 41 +++++++++++++++++++++++------------- templates/homepage.hamlet | 15 ++++++++++++- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/Vervis/Handler/Client.hs b/src/Vervis/Handler/Client.hs index 236ce2f..ec1f5c4 100644 --- a/src/Vervis/Handler/Client.hs +++ b/src/Vervis/Handler/Client.hs @@ -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") diff --git a/templates/homepage.hamlet b/templates/homepage.hamlet index 1a316b2..811dfc7 100644 --- a/templates/homepage.hamlet +++ b/templates/homepage.hamlet @@ -63,7 +63,7 @@ $# . Repo VCS Last change - $forall (sharer, mproj, repo, vcs, ago) <- rows + $forall (sharer, mproj, repo, vcs, ago) <- rowsRepo #{shr2text sharer} @@ -86,6 +86,19 @@ $# . $nothing Error +

Projects without repos + + + + +
Sharer + Project + $forall (E.Value sharer, E.Value project) <- rowsProject +
+ #{shr2text sharer} + + #{prj2text project} +

People