This commit is contained in:
Dmitry Zuikov 2024-04-21 08:49:00 +03:00
parent 2eda0b719d
commit 129641a5f5
2 changed files with 15 additions and 11 deletions

View File

@ -13,6 +13,8 @@ import HBS2.Polling
import HBS2.Peer.RPC.API.Storage
import HBS2.Peer.RPC.Client.StorageClient
import HBS2.Git.Data.Tx.Git
import HBS2.Git.Data.RepoHead
import HBS2.Git.Local
import HBS2.Git.Local.CLI
@ -212,7 +214,7 @@ runDashboardWeb wo = do
<&> listToMaybe
>>= orFall (status status404)
lift $ html =<< renderTextT (repoManifest item)
lift $ html =<< renderTextT (thisRepoManifest item)
get "/repo/:lww/refs" do
@ -267,16 +269,18 @@ gitShowRefs what = do
path <- repoDataPath what
let cmd = [qc|git --git-dir {path} show-ref|]
-- FIXME: extract-method
gitRunCommand cmd
>>= orThrowUser ("can't read git repo" <+> pretty path)
<&> LBS8.lines
<&> fmap LBS8.words
<&> mapMaybe \case
[val,name] -> (GitRef (LBS8.toStrict name),) <$> fromStringMay @GitHash (LBS8.unpack val)
_ -> Nothing
sto <- asks _sto
fromMaybe mempty <$> runMaybeT do
(_,hd) <- lift (selectRepoList (mempty & set repoListByLww (Just what) & set repoListLimit (Just 1)))
<&> listToMaybe
>>= toMPlus
<&> rlRepoTx
>>= readRepoHeadFromTx sto . coerce
>>= toMPlus
pure $ view repoHeadRefs hd
runScotty :: DashBoardPerks m => DashBoardM m ()

View File

@ -190,8 +190,8 @@ parsedManifest RepoListItem{..} = do
pure (meta, manifest)
repoManifest :: (DashBoardPerks m, MonadReader DashBoardEnv m) => RepoListItem -> HtmlT m ()
repoManifest it@RepoListItem{..} = do
thisRepoManifest :: (DashBoardPerks m, MonadReader DashBoardEnv m) => RepoListItem -> HtmlT m ()
thisRepoManifest it@RepoListItem{..} = do
(_, manifest) <- lift $ parsedManifest it
toHtmlRaw (renderMarkdown' manifest)