Skip to content

Commit

Permalink
chore: fix svelte type error in reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrasu committed Apr 14, 2024
1 parent 8d511a4 commit 0604836
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@ jobs:
cache-dependency-path: create-echoed/package-lock.json
- run: npm ci
- run: npm run check
test-reporter:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./reporter
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'npm'
cache-dependency-path: reporter/package-lock.json
- run: npm ci
- run: npm run check
27 changes: 13 additions & 14 deletions reporter/src/components/trace/TraceTree.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,24 @@
};
const dataset = traceTrees.map(createDataset);
const data: ChartConfiguration<"bar">["data"] = {
labels: label,
datasets: [
{
tree: dataset,
},
],
};
const data: ChartConfiguration<"bar", [number, number], ILabelNode2>["data"] =
{
labels: label,
datasets: [
{
// Ignore type error to allow [number, number] as value type.
// @ts-ignore
tree: dataset,
barThickness: 20,
},
],
};
onMount(() => {
const canvas = <HTMLCanvasElement>document.getElementById("canvas");
canvas.width = window.innerWidth * 0.8;
canvas.height = spans.length * 50 + 100;
const chart = new Chart(canvas, {
const chart = new Chart<"bar", [number, number], ILabelNode2>(canvas, {
type: "bar",
data: data,
options: {
Expand All @@ -157,17 +161,13 @@
},
animation: false,
responsive: true,
title: {
display: false,
},
indexAxis: "y",
layout: {
padding: {
// TODO: make dynamic according to tree's max depth
left: 250,
},
},
barThickness: 20,
scales: {
x: {
title: {
Expand All @@ -179,7 +179,6 @@
hierarchyGroupLabelPosition: "first",
ticks: {
mirror: true,
beginAtZero: true,
},
padding: 0,
type: "hierarchical",
Expand Down
2 changes: 1 addition & 1 deletion reporter/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "./app.css";
import App from "./App.svelte";

const app = new App({
target: document.getElementById("app"),
target: document.getElementById("app")!,
});

export default app;

0 comments on commit 0604836

Please sign in to comment.