Skip to content

Commit

Permalink
wip: tracking down render order bug
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Oct 24, 2023
1 parent 6eeb18f commit d609581
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/elm/Pages/Build/Graph.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Pages.Build.Graph exposing (renderBuildGraph, renderBuildGraphDOT)
module Pages.Build.Graph exposing (renderBuildGraph)

import Dict exposing (Dict)
import Focus
Expand Down Expand Up @@ -47,7 +47,7 @@ renderBuildGraph model centerOnDraw =
Success g ->
Interop.renderBuildGraph <|
encodeBuildGraphRenderData
{ dot = renderBuildGraphDOT model g
{ dot = renderDOT model g
, buildID = RemoteData.unwrap -1 .id bm.build
, filter = gm.filter
, showServices = gm.showServices
Expand All @@ -60,7 +60,7 @@ renderBuildGraph model centerOnDraw =
Cmd.none


{-| renderBuildGraphDOT : constant for organizing the layout of build graph nodes
{-| builtInClusterID : constant for organizing the layout of build graph nodes
-}
builtInClusterID : Int
builtInClusterID =
Expand All @@ -81,12 +81,12 @@ serviceClusterID =
0


{-| renderBuildGraphDOT : takes model and build graph, and returns a string representation of a DOT graph using the extended Graph DOT package
{-| renderDOT : takes model and build graph, and returns a string representation of a DOT graph using the extended Graph DOT package
<https://graphviz.org/doc/info/lang.html>
<https://package.elm-lang.org/packages/elm-community/graph/latest/Graph.DOT>
-}
renderBuildGraphDOT : BuildModel.PartialModel a -> BuildGraph -> String
renderBuildGraphDOT model buildGraph =
renderDOT : BuildModel.PartialModel a -> BuildGraph -> String
renderDOT model buildGraph =
let
-- todo: BUG: single step "step" sleep 10 pipeline when you hover
-- the text changes color???
Expand Down
3 changes: 3 additions & 0 deletions src/static/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export function drawGraph(opts, content) {
edge: '.elm-build-graph-edge',
};

console.log('this sometimes happens too fast ' + opts.centerOnDraw);

var buildGraphElement = drawBaseGraphWithZoom(
opts,
graphSelectors.root,
Expand Down Expand Up @@ -122,6 +124,7 @@ function drawBaseGraphWithZoom(opts, selector, content) {
resetZoomAndCenter(opts, zoom);
}
if (opts.centerOnDraw) {
console.log("recentering");
resetZoomAndCenter(opts, zoom);
}

Expand Down
5 changes: 1 addition & 4 deletions src/static/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,15 @@ var opts = {
};

app.ports.renderBuildGraph.subscribe(function (graphData) {
const dot = graphData.dot;

const graphviz = Graphviz.load().then(res => {
var content = res.layout(dot, 'svg', 'dot');
var content = res.layout(graphData.dot, 'svg', 'dot');

// construct graph building options
opts.isRefreshDraw = opts.currentBuild === graphData.build_id;
opts.centerOnDraw = graphData.center_on_draw;
opts.currentBuild = graphData.build_id;
opts.contentFilter = graphData.filter;
opts.onGraphInteraction = app.ports.onGraphInteraction;

Graph.drawGraph(opts, content);
});
});

0 comments on commit d609581

Please sign in to comment.