Skip to content
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

Feat: Add resizer for timeseries leaderboard split #6256

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions web-common/src/features/dashboards/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ export const MEASURE_CONFIG = {
height: 125,
fullHeight: 220,
},
container: {
width: { full: 580, breakpoint: 420 },
},
bigNumber: {
widthWithChart: 140,
widthWithoutChart: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

export let exploreName: string;
export let workspaceWidth: number;
export let timeSeriesWidth: number;
export let hideStartPivotButton = false;

const {
Expand Down Expand Up @@ -290,6 +291,7 @@
end={endValue}
start={startValue}
{workspaceWidth}
{timeSeriesWidth}
>
<div class:mb-6={isAlternateChart} class="flex items-center gap-x-1 px-2.5">
{#if isInTimeDimensionView}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ A container GraphicContext for the time series in a metrics dashboard.
export let start: Date | undefined;
export let end: Date | undefined;
export let workspaceWidth: number;
export let timeSeriesWidth: number;
export let enableFullWidth = false;

const paddingForFullWidth = 80;
const paddingForSplitView = 30;
</script>

<div class="max-w-full h-fit flex flex-col max-h-full pr-2">
Expand All @@ -26,10 +28,7 @@ A container GraphicContext for the time series in a metrics dashboard.
width={Math.max(
enableFullWidth
? workspaceWidth - paddingForFullWidth
: workspaceWidth >= MEASURE_CONFIG.breakpoint
? MEASURE_CONFIG.container.width.full
: MEASURE_CONFIG.container.width.breakpoint,
400,
: timeSeriesWidth - paddingForSplitView,
) - MEASURE_CONFIG.bigNumber.widthWithChart}
xMax={end}
xMaxTweenProps={{ duration: 400 }}
Expand Down
22 changes: 20 additions & 2 deletions web-common/src/features/dashboards/workspace/Dashboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { useExploreValidSpec } from "@rilldata/web-common/features/explores/selectors";
import { featureFlags } from "@rilldata/web-common/features/feature-flags";
import { navigationOpen } from "@rilldata/web-common/layout/navigation/Navigation.svelte";
import Resizer from "@rilldata/web-common/layout/Resizer.svelte";
import { useExploreState } from "web-common/src/features/dashboards/stores/dashboard-stores";
import { runtime } from "../../../runtime-client/runtime-store";
import MeasuresContainer from "../big-number/MeasuresContainer.svelte";
Expand Down Expand Up @@ -83,6 +84,10 @@
: undefined;

$: metricsView = $validSpecStore.data?.metricsView ?? {};

let metricsWidth = 580; // Default width for metrics section
const MIN_METRICS_WIDTH = 440;
let resizing = false;
</script>

<article
Expand Down Expand Up @@ -124,11 +129,12 @@
class:flex-row={!expandedMeasureName}
class:left-shift={extraLeftPadding}
>
<div class="pt-2">
<div class="pt-2 flex-none" style:width="{metricsWidth}px">
{#key exploreName}
{#if hasTimeSeries}
<MetricsTimeSeriesCharts
{exploreName}
timeSeriesWidth={metricsWidth}
workspaceWidth={exploreContainerWidth}
hideStartPivotButton={hidePivot}
/>
Expand All @@ -146,7 +152,19 @@
hideStartPivotButton={hidePivot}
/>
{:else}
<div class="pt-2 pl-1 border-l overflow-auto w-full">
<div class="relative flex-none bg-gray-200 w-[1px]">
<Resizer
dimension={metricsWidth}
min={MIN_METRICS_WIDTH}
max={exploreContainerWidth - 500}
bind:resizing
side="right"
onUpdate={(width) => {
metricsWidth = width;
}}
/>
</div>
<div class="pt-2 pl-1 overflow-auto w-full">
{#if selectedDimension}
<DimensionDisplay
dimension={selectedDimension}
Expand Down
2 changes: 2 additions & 0 deletions web-common/src/layout/Resizer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
class:absolute
class="{direction} {side} justify-{justify}"
class:hang
class:minned={dimension === min}
class:maxed={dimension === max}
on:mousedown|stopPropagation|preventDefault={handleMousedown}
on:dblclick|stopPropagation={handleDoubleClick}
on:mouseenter={() => {
Expand Down
Loading