UI: If MR is applied, don't do the canApply check and display "RESOLVED"

This commit is contained in:
fr33domlover 2022-09-27 18:11:13 +00:00
parent ceee428450
commit 84b70aa7b3
2 changed files with 23 additions and 17 deletions

View file

@ -317,8 +317,11 @@ getClothR loomHash clothHash = do
let patchIDs = NE.map entityKey patches let patchIDs = NE.map entityKey patches
diffs = NE.map (patchContent . entityVal) $ NE.reverse patches diffs = NE.map (patchContent . entityVal) $ NE.reverse patches
(repoID, _, _, maybeBranch) = targetRepo (repoID, _, _, maybeBranch) = targetRepo
errorOrCanApply <- runExceptT $ canApplyPatches repoID maybeBranch diffs maybeErrorOrCanApply <-
return (bundleID, patchIDs, errorOrCanApply) case ticketStatus ticket of
TSClosed -> pure Nothing
_ -> Just <$> runExceptT (canApplyPatches repoID maybeBranch diffs)
return (bundleID, patchIDs, maybeErrorOrCanApply)
hashMessageKey <- handlerToWidget getEncodeKeyHashid hashMessageKey <- handlerToWidget getEncodeKeyHashid
let desc :: Widget let desc :: Widget
desc = toWidget $ markupHTML $ ticketDescription ticket desc = toWidget $ markupHTML $ ticketDescription ticket

View file

@ -54,7 +54,7 @@ $with (_repoID, repoHash, name, maybeBranch) <- targetRepo
<a href=@{RepoBranchSourceR repoHash branch []}> <a href=@{RepoBranchSourceR repoHash branch []}>
#{branch} #{branch}
$maybe (bundleID, patchIDs, errorOrCanApply) <- mbundle' $maybe (bundleID, patchIDs, maybeErrorOrCanApply) <- mbundle'
<div> <div>
Bundle Bundle
<a href=@{BundleR loomHash clothHash (hashBundle bundleID)}> <a href=@{BundleR loomHash clothHash (hashBundle bundleID)}>
@ -66,20 +66,23 @@ $maybe (bundleID, patchIDs, errorOrCanApply) <- mbundle'
<a href=@{PatchR loomHash clothHash (hashBundle bundleID) (hashPatch patchID)}> <a href=@{PatchR loomHash clothHash (hashBundle bundleID) (hashPatch patchID)}>
#{keyHashidText $ hashPatch patchID} #{keyHashidText $ hashPatch patchID}
<div> <div>
Status: Status: #
$case errorOrCanApply $maybe errorOrCanApply <- maybeErrorOrCanApply
$of Left e $case errorOrCanApply
<span .apply-error> $of Left e
[Error! #{e}] <span .apply-error>
^{applyButton "Try applying anyway"} [Error! #{e}]
$of Right False ^{applyButton "Try applying anyway"}
<span .apply-no> $of Right False
[Apply check failed! Possibly conflicts exist] <span .apply-no>
^{applyButton "Try applying anyway"} [Apply check failed! Possibly conflicts exist]
$of Right True ^{applyButton "Try applying anyway"}
<span .apply-yes> $of Right True
[Can apply!] <span .apply-yes>
^{applyButton "Apply"} [Can apply!]
^{applyButton "Apply"}
$nothing
RESOLVED
<div> <div>
<span> <span>