Rewrite GitGraph.js#12137
Merged
Merged
Conversation
Contributor
Author
|
Although this is a rewrite it may be appropriate to backport to 1.12 as the gitgraph is broken there. Otherwise we could backport a simple hacky fix that will prevent the graph from disappearing by just assigning a '#000' flow whenever a flow is missing e.g. for 1.12 apply the below patch: diff --git a/web_src/js/vendor/gitgraph.js b/web_src/js/vendor/gitgraph.js
index 0cf5d0f75..7a5777598 100644
--- a/web_src/js/vendor/gitgraph.js
+++ b/web_src/js/vendor/gitgraph.js
@@ -376,7 +376,18 @@ export default function gitGraph(canvas, rawGraphList, config) {
flows.splice(colomnIndex, 0, genNewFlow());
}
- color = flows[colomnIndex].color;
+ if (colomnIndex < flows.length) {
+ color = flows[colomnIndex].color;
+ } else {
+ console.error({
+ message: "Missing flow!",
+ colomnIndex,
+ colomn,
+ prevColomn,
+ flowSwapPos,
+ });
+ color = "#000";
+ }
switch (colomn) {
case '-': |
Contributor
Author
|
Good example graphs to test this can be found in #11981: https://try.gitea.io/ahaha/glu/graph |
silverwind
reviewed
Jul 4, 2020
silverwind
reviewed
Jul 4, 2020
silverwind
reviewed
Jul 4, 2020
The current vendored gitgraph.js is no longer maintained and is difficult to understand, fix and maintain. This PR completely rewrites its logic - hopefully in a clearer fashion and easier to maintain. It also includes @silverwind's improvements of coloring the commit dots and preventing the flash of incorrect content. Further changes to contemplate in future will be abstracting out of the flows to an object, storing the involved commit references on the flows etc. However, this is probably a required step for this. Replaces go-gitea#12131 Fixes go-gitea#11981 (part 3) Signed-off-by: Andrew Thornton <art27@cantab.net>
fd31d11 to
8c55116
Compare
lafriks
approved these changes
Jul 4, 2020
silverwind
approved these changes
Jul 5, 2020
Member
|
🚀 |
ydelafollye
pushed a commit
to ydelafollye/gitea
that referenced
this pull request
Jul 31, 2020
The current vendored gitgraph.js is no longer maintained and is difficult to understand, fix and maintain. This PR completely rewrites its logic - hopefully in a clearer fashion and easier to maintain. It also includes @silverwind's improvements of coloring the commit dots and preventing the flash of incorrect content. Further changes to contemplate in future will be abstracting out of the flows to an object, storing the involved commit references on the flows etc. However, this is probably a required step for this. Replaces go-gitea#12131 Fixes go-gitea#11981 (part 3) Signed-off-by: Andrew Thornton <art27@cantab.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current vendored gitgraph.js is no longer maintained and is
difficult to understand, fix and maintain.
This PR completely rewrites its logic - hopefully in a clearer fashion
and easier to maintain.
It also includes @silverwind's improvements of coloring the commit dots
and preventing the flash of incorrect content.
Further changes to contemplate in future will be abstracting out of the
flows to an object, storing the involved commit references on the flows
etc. However, this is probably a required step for this.
Replaces #12131
Fixes #11981 (part 3)
Signed-off-by: Andrew Thornton art27@cantab.net