Skip to content

feat(site): add display for workspace timings #14773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5268b1e
Add base components for the chart
BrunoQuaresma Sep 19, 2024
4d509f9
Improve spacing calc
BrunoQuaresma Sep 19, 2024
d48624b
Make bars clickable
BrunoQuaresma Sep 19, 2024
62152ce
Refactor code to allow multiple views
BrunoQuaresma Sep 20, 2024
fd84ed9
Add basic view and breadcrumbs
BrunoQuaresma Sep 23, 2024
f7f09ff
Add resource filtering
BrunoQuaresma Sep 23, 2024
2ffc75a
Find the right tick spacings
BrunoQuaresma Sep 23, 2024
a8372e1
Add colors to the bars
BrunoQuaresma Sep 23, 2024
f7c7488
Do not display Coder resource
BrunoQuaresma Sep 23, 2024
0868185
Add legends
BrunoQuaresma Sep 23, 2024
54d13c8
Handle empty search
BrunoQuaresma Sep 23, 2024
714e37b
Improve coder resource filter and adjust bar hover
BrunoQuaresma Sep 24, 2024
a2dd126
Only scroll the chart
BrunoQuaresma Sep 24, 2024
0b4747e
Add tooltip
BrunoQuaresma Sep 24, 2024
49d3a72
Refactor code and improve legends
BrunoQuaresma Sep 25, 2024
647635d
Adjust columns to fit the space
BrunoQuaresma Sep 25, 2024
6c742aa
Customize scroll
BrunoQuaresma Sep 25, 2024
9a8bb59
Add info tooltip
BrunoQuaresma Sep 25, 2024
4139151
Fix fmt
BrunoQuaresma Sep 25, 2024
bcff9c6
Fix nblock gen
BrunoQuaresma Sep 25, 2024
97b25d9
Fix key
BrunoQuaresma Sep 25, 2024
6d5c344
Debug on chromatic
BrunoQuaresma Sep 25, 2024
c4bd74e
Another debug image
BrunoQuaresma Sep 25, 2024
939ec9a
Try with useEffect
BrunoQuaresma Sep 25, 2024
49c69e0
Fix labels alignment
BrunoQuaresma Sep 26, 2024
61008a3
Increase border radius tooltip
BrunoQuaresma Sep 26, 2024
f969ef2
Add scroll mask
BrunoQuaresma Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix fmt
  • Loading branch information
BrunoQuaresma committed Sep 25, 2024
commit 41391518efb2fbbf16d219bfcc460d6f94852a84
2 changes: 1 addition & 1 deletion site/src/modules/workspaces/WorkspaceTiming/Chart/Bar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Interpolation, Theme } from "@emotion/react";
import { type ButtonHTMLAttributes, forwardRef, type HTMLProps } from "react";
import { type ButtonHTMLAttributes, type HTMLProps, forwardRef } from "react";
import { CSSVars } from "./constants";

export type BarColors = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Interpolation, Theme } from "@emotion/react";
import { MoreHorizOutlined } from "@mui/icons-material";
import { useLayoutEffect, useRef, useState, type FC } from "react";
import MoreHorizOutlined from "@mui/icons-material/MoreHorizOutlined";
import { type FC, useLayoutEffect, useRef, useState } from "react";

const sidePadding = 8;
const spaceBetweenBlocks = 4;
Expand Down Expand Up @@ -34,12 +34,10 @@ export const BarBlocks: FC<BarBlocksProps> = ({ count }) => {
(freeSize - moreIconSize) / (blockSize + spaceBetweenBlocks),
);
const nOfBlocks = hasSpacing ? count : nOfPossibleBlocks;
console.log("POSSIBLE ->", count, nOfPossibleBlocks);

return (
<div ref={blocksRef} css={styles.blocks}>
{Array.from({ length: nOfBlocks }).map((_, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: we are using the index as a key here because the blocks are not expected to be reordered
{Array.from(Array(nOfBlocks).keys()).map((i) => (
<div key={i} css={styles.block} style={{ minWidth: blockSize }} />
))}
{!hasSpacing && (
Expand Down
8 changes: 4 additions & 4 deletions site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Interpolation, Theme } from "@emotion/react";
import {
type FC,
type HTMLProps,
useLayoutEffect,
useRef,
useState,
type FC,
type HTMLProps,
} from "react";
import type { Interpolation, Theme } from "@emotion/react";
import { YAxisCaptionHeight } from "./YAxis";
import { formatTime } from "./utils";
import { CSSVars, XAxisLabelsHeight, XAxisRowsGap } from "./constants";
import { formatTime } from "./utils";

export const XAxisMinWidth = 130;
export const XAxisSidePadding = 16;
Expand Down
36 changes: 18 additions & 18 deletions site/src/modules/workspaces/WorkspaceTiming/ResourcesChart.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
import { css } from "@emotion/css";
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined";
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip";
import { type FC, useState } from "react";
import { Link } from "react-router-dom";
import { Bar } from "./Chart/Bar";
import {
Chart,
ChartBreadcrumbs,
ChartContent,
type ChartLegend,
ChartLegends,
ChartSearch,
ChartToolbar,
} from "./Chart/Chart";
import {
XAxis,
XAxisMinWidth,
XAxisRow,
XAxisRows,
XAxisSections,
XAxisMinWidth,
} from "./Chart/XAxis";
import { useState, type FC } from "react";
import {
YAxis,
YAxisCaption,
YAxisLabel,
YAxisLabels,
YAxisSection,
} from "./Chart/YAxis";
import { Bar } from "./Chart/Bar";
import {
type BaseTiming,
calcDuration,
calcOffset,
combineTimings,
formatTime,
makeTicks,
type BaseTiming,
} from "./Chart/utils";
import {
Chart,
ChartBreadcrumbs,
ChartContent,
type ChartLegend,
ChartLegends,
ChartSearch,
ChartToolbar,
} from "./Chart/Chart";
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip";
import { css } from "@emotion/css";
import { Link } from "react-router-dom";
import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined";

const legendsByAction: Record<string, ChartLegend> = {
"state refresh": {
Expand Down
20 changes: 10 additions & 10 deletions site/src/modules/workspaces/WorkspaceTiming/StagesChart.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import { css } from "@emotion/css";
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
import InfoOutlined from "@mui/icons-material/InfoOutlined";
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip";
import type { FC, PropsWithChildren } from "react";
import { Bar, ClickableBar } from "./Chart/Bar";
import { BarBlocks } from "./Chart/BarBlocks";
import { Chart, ChartContent } from "./Chart/Chart";
import {
XAxis,
XAxisMinWidth,
XAxisRow,
XAxisRows,
XAxisSections,
XAxisMinWidth,
} from "./Chart/XAxis";
import type { FC, PropsWithChildren } from "react";
import {
YAxis,
YAxisCaption,
YAxisLabel,
YAxisLabels,
YAxisSection,
} from "./Chart/YAxis";
import { Bar, ClickableBar } from "./Chart/Bar";
import {
type BaseTiming,
calcDuration,
calcOffset,
combineTimings,
formatTime,
makeTicks,
type BaseTiming,
} from "./Chart/utils";
import { Chart, ChartContent } from "./Chart/Chart";
import { BarBlocks } from "./Chart/BarBlocks";
import InfoOutlined from "@mui/icons-material/InfoOutlined";
import { useTheme, type Interpolation, type Theme } from "@emotion/react";
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip";
import { css } from "@emotion/css";

// TODO: Add "workspace boot" when scripting timings are done.
const stageCategories = ["provisioning"] as const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ProvisionerTiming } from "api/typesGenerated";
import { useState, type FC } from "react";
import type { Interpolation, Theme } from "@emotion/react";
import { stages, StagesChart } from "./StagesChart";
import type { ProvisionerTiming } from "api/typesGenerated";
import { type FC, useState } from "react";
import { type BaseTiming, combineTimings } from "./Chart/utils";
import { ResourcesChart } from "./ResourcesChart";
import { StagesChart, stages } from "./StagesChart";

type TimingView =
| { name: "stages" }
Expand Down
Loading