@sentio/ui-dashboard 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DurationLike, ButtonProps } from '@sentio/ui-core';
1
+ import { DurationLike, ButtonProps, DateTimeValue } from '@sentio/ui-core';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as react from 'react';
4
4
  import react__default, { ReactNode, CSSProperties } from 'react';
@@ -383,6 +383,28 @@ interface MetricInfoLike {
383
383
  };
384
384
  }
385
385
 
386
+ /** A single data point: [timestamp, value, ...extra values]. */
387
+ type SeriesDataLike<T = Date> = [T, number | null, ...number[]];
388
+ /** One rendered series (echarts-ready). */
389
+ interface SeriesLike<T = Date> {
390
+ name: string;
391
+ data: SeriesDataLike<T>[];
392
+ showSymbol: boolean;
393
+ type: 'line' | 'bar';
394
+ areaStyle?: any;
395
+ lineStyle?: any;
396
+ stack?: string;
397
+ stackStrategy?: string;
398
+ emphasis?: any;
399
+ id: string;
400
+ xAxisIndex?: number;
401
+ symbolSize?: number | ((v: SeriesDataLike<T>) => number);
402
+ itemStyle?: {
403
+ color?: string;
404
+ };
405
+ smooth?: boolean;
406
+ }
407
+
386
408
  interface Props$s {
387
409
  metric?: MetricInfoLike;
388
410
  value: QueryLike;
@@ -617,6 +639,110 @@ interface QueryValueChartProps {
617
639
  }
618
640
  declare const QueryValueChart: react.ForwardRefExoticComponent<QueryValueChartProps & react.RefAttributes<EChartsHandle>>;
619
641
 
642
+ interface Mark {
643
+ value?: number;
644
+ label?: string;
645
+ above?: boolean;
646
+ below?: boolean;
647
+ color?: string;
648
+ from?: Date;
649
+ to?: Date;
650
+ }
651
+ type MarkLine = Mark;
652
+ type MarkArea = Omit<Mark, 'above' | 'below' | 'value'>;
653
+ /** Overlay outputs injected by the app (computed by its overlay-series hook). */
654
+ interface TimeSeriesOverlay {
655
+ seriesIdToYAxisName: Map<string, string>;
656
+ overlaySeriesIdToFormatter: Map<string, (v: number) => string>;
657
+ applyOverlaySeries: (option: EChartsOption) => EChartsOption;
658
+ }
659
+ /**
660
+ * Context built by the presentational chart for a hovered/clicked series, handed
661
+ * out to the app so it can build the log/cohort URL + navigation. The app combines
662
+ * `value` (the data point, holding the timestamp) with its own time range.
663
+ */
664
+ interface ViewActionContext {
665
+ value: any;
666
+ labels: Record<string, string>;
667
+ name: string;
668
+ id?: string;
669
+ isEventSeries: boolean;
670
+ eventName?: string;
671
+ query?: {
672
+ selectorExpr?: unknown;
673
+ };
674
+ }
675
+ interface TimeSeriesChartProps {
676
+ group?: string;
677
+ title?: string;
678
+ startTime?: DateTimeValue;
679
+ endTime?: DateTimeValue;
680
+ tz?: string;
681
+ minHeight?: number;
682
+ onSelectTimeRange?: (start: DateTimeValue, end: DateTimeValue) => void;
683
+ loading?: boolean;
684
+ controls?: boolean;
685
+ config?: ChartConfigLike;
686
+ onChangeConfig?: (config: ChartConfigLike) => void;
687
+ style?: CSSProperties;
688
+ chartType?: ChartTypeLike;
689
+ allowClick?: boolean;
690
+ showSymbol?: boolean;
691
+ sourceType?: string;
692
+ getEventNameById?: (id?: string) => string;
693
+ noLegend?: boolean;
694
+ onInitChart?: (chart: ECharts) => void;
695
+ markAreas?: MarkArea[];
696
+ markLines?: MarkLine[];
697
+ nonXAxis?: boolean;
698
+ /** Already-computed primary series (app runs the worker compute). */
699
+ series: SeriesLike<Date>[];
700
+ /** Already-computed compare-period series (already styled by the app, or styled here). */
701
+ compareSeries?: SeriesLike<Date>[];
702
+ /** Legend entries for the primary series. */
703
+ legend?: string[];
704
+ /** Formats a value for axis/tooltip display (replaces lib/metrics/formatter). */
705
+ numberFormatter: (value: number, seriesId?: string) => string;
706
+ /** Overlay outputs computed by the app (replaces the overlay-series hook). */
707
+ overlay?: TimeSeriesOverlay;
708
+ /** Template-variable keys (replaces the app's template-variables atom). */
709
+ templateVariableKeys?: string[];
710
+ /**
711
+ * Per-series metric labels, indexed by series index (the worker compute's
712
+ * `seriesToMetricLabels`; the original read `labelsRef.current[idx]`).
713
+ */
714
+ seriesToMetricLabels?: {
715
+ name: string;
716
+ labels: Record<string, string>;
717
+ id?: string;
718
+ }[];
719
+ /** Map of series id → event name (the original `eventNameMapRef.current`). */
720
+ eventNameMap?: Map<string, string>;
721
+ /** Map of series id → events query (the original `eventsQueryMapRef.current`). */
722
+ eventsQueryMap?: Map<string, {
723
+ selectorExpr?: unknown;
724
+ }>;
725
+ /**
726
+ * Navigate to logs for a clicked series. The presentational builds the context
727
+ * (from the hovered tooltip value + injected labels/event maps) and hands it out;
728
+ * the app maps it to a URL + navigation using its own time range.
729
+ */
730
+ onViewLogs?: (ctx: ViewActionContext) => void;
731
+ /** Navigate to users/accounts for a clicked series (the app builds the cohort query). */
732
+ onViewUsers?: (ctx: ViewActionContext) => void;
733
+ /**
734
+ * Whether the "View Logs" action should be disabled. The component computes the
735
+ * context (may be null) and passes it; the app decides disabled.
736
+ */
737
+ viewLogDisabled?: (ctx: ViewActionContext | null) => boolean;
738
+ /** Whether the "View Users" action should be disabled. */
739
+ viewUsersDisabled?: (ctx: ViewActionContext | null) => boolean;
740
+ /** Counts of returned/total samples for the data-truncation banner. */
741
+ returnedSeries?: number;
742
+ totalSeries?: number;
743
+ }
744
+ declare const TimeSeriesChart: react.ForwardRefExoticComponent<TimeSeriesChartProps & react.RefAttributes<EChartsHandle>>;
745
+
620
746
  interface Props$j {
621
747
  config?: LineConfigLike;
622
748
  defaultOpen?: boolean;
@@ -1534,4 +1660,4 @@ interface Props {
1534
1660
  }
1535
1661
  declare const SvgIcon: ({ className }: Props) => react_jsx_runtime.JSX.Element;
1536
1662
 
1537
- export { AggregateInput, SvgIcon$6 as AreaIcon, type ArgumentDef, ArgumentInput, ArgumentType, BarGaugeChart, type BarGaugeChartProps, BarGaugeControls, SvgIcon$4 as BarGuageIcon, SvgIcon$5 as BarIcon, type ChartConfigLike, ChartLegend, type ChartLike, ChartTooltip, ChartTypeButtonGroup, type ChartTypeLike, type DashboardExtraLike, type DashboardLike, type DashboardVisibilityLike, DataControls, type DataSourceTypeLike, type EChartsHandle, type EChartsOption, EventsFunctionCategories, EventsFunctionMap, type FunctionDef, FunctionInput, FunctionMap, FunctionsCategories, FunctionsPanel, type GroupLike, type GroupStyleLike, LabelControls, LabelSearchProvider, LabelsInput, type LayoutItemLike, type LayoutsLike, LineControls, SvgIcon$7 as LineIcon, MarkerControls, type NoteAlignmentLike, type NoteFontSizeLike, type NoteLike, type NoteVerticalAlignmentLike, type OverlayGraphLike, type PanelLike, PieChart, PieChartControls, type PieChartProps, SvgIcon$3 as PieIcon, type PieSeriesInput, QueryValueChart, type QueryValueChartProps, SvgIcon$2 as QueryValueIcon, ReactEChartsBase, type ReactEChartsProps, RefreshButton, RefreshContext, type ResponsiveLayoutsLike, ScatterChartTooltip, ScatterControls, SvgIcon$1 as ScatterIcon, SystemLabels, SvgIcon as TableIcon, type TemplateVariableLike, type TemplateViewLike, ValueControls, type ValueFormatter, ValueFormatters, ValueOptions, ValueStringMapping, XAxisControls, type YAxisConfigLike, YaxisControls, defaultConfig$4 as defaultBarGaugeConfig, defaultConfig$1 as defaultDataConfig, defaultConfig$5 as defaultPieConfig, defaultConfig as defaultScatterConfig, defaultConfig$3 as defaultValueConfig, defaultConfig$2 as defaultValueControlsConfig, isAggrOrRollupFunction, sentioColors, sentioTheme, sentioThemeDark, sortMetricByName, useLabelSearch, useLabelSearchContext };
1663
+ export { AggregateInput, SvgIcon$6 as AreaIcon, type ArgumentDef, ArgumentInput, ArgumentType, BarGaugeChart, type BarGaugeChartProps, BarGaugeControls, SvgIcon$4 as BarGuageIcon, SvgIcon$5 as BarIcon, type ChartConfigLike, ChartLegend, type ChartLike, ChartTooltip, ChartTypeButtonGroup, type ChartTypeLike, type DashboardExtraLike, type DashboardLike, type DashboardVisibilityLike, DataControls, type DataSourceTypeLike, type EChartsHandle, type EChartsOption, EventsFunctionCategories, EventsFunctionMap, type FunctionDef, FunctionInput, FunctionMap, FunctionsCategories, FunctionsPanel, type GroupLike, type GroupStyleLike, LabelControls, LabelSearchProvider, LabelsInput, type LayoutItemLike, type LayoutsLike, LineControls, SvgIcon$7 as LineIcon, type MarkArea, type MarkLine, MarkerControls, type NoteAlignmentLike, type NoteFontSizeLike, type NoteLike, type NoteVerticalAlignmentLike, type OverlayGraphLike, type PanelLike, PieChart, PieChartControls, type PieChartProps, SvgIcon$3 as PieIcon, type PieSeriesInput, QueryValueChart, type QueryValueChartProps, SvgIcon$2 as QueryValueIcon, ReactEChartsBase, type ReactEChartsProps, RefreshButton, RefreshContext, type ResponsiveLayoutsLike, ScatterChartTooltip, ScatterControls, SvgIcon$1 as ScatterIcon, SystemLabels, SvgIcon as TableIcon, type TemplateVariableLike, type TemplateViewLike, TimeSeriesChart, type TimeSeriesChartProps, ValueControls, type ValueFormatter, ValueFormatters, ValueOptions, ValueStringMapping, type ViewActionContext, XAxisControls, type YAxisConfigLike, YaxisControls, defaultConfig$4 as defaultBarGaugeConfig, defaultConfig$1 as defaultDataConfig, defaultConfig$5 as defaultPieConfig, defaultConfig as defaultScatterConfig, defaultConfig$3 as defaultValueConfig, defaultConfig$2 as defaultValueControlsConfig, isAggrOrRollupFunction, sentioColors, sentioTheme, sentioThemeDark, sortMetricByName, useLabelSearch, useLabelSearchContext };