Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Sep 19, 2024
1 parent a6c04ec commit 9f52231
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
8 changes: 5 additions & 3 deletions dashboard/components/RelationGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as d3 from "d3"
import { cloneDeep } from "lodash"
import { Fragment, useCallback, useEffect, useRef } from "react"
import {
RelationBox,
Edge,
Enter,
Position,
RelationBox,
generateRelationBackPressureEdges,
layoutItem,
} from "../lib/layout"
Expand Down Expand Up @@ -36,7 +36,7 @@ export default function RelationGraph({
const includedRelationIds = new Set<string>()
for (const relationBox of relationDependencyDag) {
let relationId = relationBox.id
layoutRelationResult.set(relationId, {
layoutRelationResult.set(relationId, {
relationName: relationBox.relationName,
schemaName: relationBox.schemaName,
})
Expand Down Expand Up @@ -92,7 +92,9 @@ export default function RelationGraph({

text
.attr("fill", "black")
.text(({ relationName, schemaName }) => `${schemaName}.${relationName}`)
.text(
({ relationName, schemaName }) => `${schemaName}.${relationName}`
)
.attr("font-family", "inherit")
.attr("text-anchor", "middle")
.attr("dx", relationNameX)
Expand Down
4 changes: 3 additions & 1 deletion dashboard/lib/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ export function generateFragmentEdges(
return links
}

export function generateRelationBackPressureEdges(layoutMap: RelationBoxPosition[]): Edge[] {
export function generateRelationBackPressureEdges(
layoutMap: RelationBoxPosition[]
): Edge[] {
const links = []
const relationMap = new Map<string, RelationBoxPosition>()
for (const x of layoutMap) {
Expand Down
21 changes: 13 additions & 8 deletions dashboard/pages/relation_graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ import {
import {
StreamingJob,
getFragmentVertexToRelationMap,
getRelationDependencies,
getSchemas,
getStreamingJobs, getRelationDependencies,
getStreamingJobs,
} from "../lib/api/streaming"
import { RelationBox } from "../lib/layout"
import { BackPressureInfo } from "../proto/gen/monitor_service"

// Refresh interval (ms) for back pressure stats
const INTERVAL_MS = 5000

function buildRelationDependencyAsEdges(relations: StreamingJob[], relationDeps: Map<number, number[]>): RelationBox[] {
function buildRelationDependencyAsEdges(
relations: StreamingJob[],
relationDeps: Map<number, number[]>
): RelationBox[] {
// Filter out non-streaming relations, e.g. source, views.
let relationIds = new Set<number>()
for (const relation of relations) {
Expand All @@ -65,10 +69,8 @@ function buildRelationDependencyAsEdges(relations: StreamingJob[], relationDeps:
width: 0,
height: 0,
parentIds: parentIds
? parentIds
.filter((x) => relationIds.has(x))
.map((x) => x.toString())
: [],
? parentIds.filter((x) => relationIds.has(x)).map((x) => x.toString())
: [],
relationName: relation.name,
schemaName: relation.schemaName ? relation.schemaName : "",
})
Expand Down Expand Up @@ -113,11 +115,14 @@ export default function Streaming() {
if (schemas) {
let relationListWithSchemaName = relationList.map((relation) => {
let schemaName = schemas.find(
(schema) => schema.id === relation.schemaId
(schema) => schema.id === relation.schemaId
)?.name
return { ...relation, schemaName }
})
const relationDep = buildRelationDependencyAsEdges(relationListWithSchemaName, relationDeps)
const relationDep = buildRelationDependencyAsEdges(
relationListWithSchemaName,
relationDeps
)
return relationDep
}
}
Expand Down

0 comments on commit 9f52231

Please sign in to comment.