@grafana/scenes 8.17.0 → 8.18.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/CHANGELOG.md +13 -0
- package/dist/esm/components/VizPanel/VizPanel.js +93 -9
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneDataTransformer.js +135 -13
- package/dist/esm/querying/SceneDataTransformer.js.map +1 -1
- package/dist/esm/querying/systemTransformations/constants.js +9 -0
- package/dist/esm/querying/systemTransformations/constants.js.map +1 -0
- package/dist/esm/querying/systemTransformations/systemTransformationProvider.js +19 -0
- package/dist/esm/querying/systemTransformations/systemTransformationProvider.js.map +1 -0
- package/dist/index.d.ts +180 -5
- package/dist/index.js +246 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _grafana_schema from '@grafana/schema';
|
|
2
2
|
import { VariableType, VariableHide, LoadingState, TimeZone, DataQuery, DataTopic, DataSourceRef, VariableRefresh, DashboardCursorSync, MatcherConfig, TableFieldOptions } from '@grafana/schema';
|
|
3
3
|
import * as _grafana_data from '@grafana/data';
|
|
4
|
-
import { BusEventWithPayload, EventBus, BusEvent, BusEventType, BusEventHandler, PanelMenuItem, DataQueryRequest, FieldConfigSource, PanelPlugin, AbsoluteTimeRange, PanelData, InterpolateFunction, PanelModel, TimeRange, DataTransformContext,
|
|
4
|
+
import { BusEventWithPayload, EventBus, BusEvent, BusEventType, BusEventHandler, PanelMenuItem, DataQueryRequest, DataFrame, DataTransformerConfig, CustomTransformOperator as CustomTransformOperator$1, FieldConfigSource, PanelPlugin, AbsoluteTimeRange, PanelData, InterpolateFunction, PanelModel, TimeRange, DataTransformContext, DataSourceGetTagKeysOptions, DataSourceGetTagValuesOptions, IconName, PageLayoutType, UrlQueryMap, DataQuery as DataQuery$1, DataSourceApi, Registry, RegistryItem, ScopedVars, AdHocVariableFilter, SelectableValue, GetTagResponse, MetricFindValue, DrilldownsApplicability, VariableRegexApplyTo, VariableRefresh as VariableRefresh$1, VariableSort, Scope, EventFilterOptions, AnnotationEvent, AnnotationQuery, TimeOption, FieldConfig, FieldType, FieldValueMatcherConfig, ScopedVar, RawTimeRange } from '@grafana/data';
|
|
5
5
|
import * as React$1 from 'react';
|
|
6
6
|
import React__default, { ComponentType, CSSProperties, PointerEvent, ForwardRefExoticComponent } from 'react';
|
|
7
7
|
import * as rxjs from 'rxjs';
|
|
@@ -444,6 +444,49 @@ declare class VizPanelRenderProfiler extends SceneObjectBase<VizPanelRenderProfi
|
|
|
444
444
|
}): DataTransformCompletionCallback | null;
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
+
/**
|
|
448
|
+
* Identifies the contributor that injected a system transformation.
|
|
449
|
+
*/
|
|
450
|
+
type TransformationOrigin = string;
|
|
451
|
+
/**
|
|
452
|
+
* Whether a system transformation runs before or after the user configured transformations.
|
|
453
|
+
*/
|
|
454
|
+
type SystemTransformationPosition = 'prepend' | 'append';
|
|
455
|
+
/**
|
|
456
|
+
* A provider contributed transformation.
|
|
457
|
+
*/
|
|
458
|
+
type SystemTransformation = (DataTransformerConfig | Exclude<CustomTransformerDefinition, CustomTransformOperator$1>) & {
|
|
459
|
+
origin: TransformationOrigin;
|
|
460
|
+
position: SystemTransformationPosition;
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* Contributes transformations that wrap the user configured ones.
|
|
464
|
+
* A SceneDataTransformer discovers on its parent when it activates (e.g. VizPanel).
|
|
465
|
+
* Nothing a provider contributes ever reaches `state.transformations`.
|
|
466
|
+
*/
|
|
467
|
+
interface SystemTransformationsProvider {
|
|
468
|
+
readonly isSystemTransformationsProvider: true;
|
|
469
|
+
readonly origin: TransformationOrigin;
|
|
470
|
+
/**
|
|
471
|
+
* Resolves what to run for the frames about to enter the pipeline. Called on every pass and does not write scene state.
|
|
472
|
+
* Throwing is treated as noop rather than erroring.
|
|
473
|
+
* What this returns is never interpolated. Only `state.transformations` is scanned for variable dependencies.
|
|
474
|
+
*/
|
|
475
|
+
getSystemTransformations(ctx: {
|
|
476
|
+
series: DataFrame[];
|
|
477
|
+
}): {
|
|
478
|
+
prepend?: Array<DataTransformerConfig | CustomTransformerDefinition>;
|
|
479
|
+
append?: Array<DataTransformerConfig | CustomTransformerDefinition>;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* The system transformations in effect for a given set of source frames, in pipeline order.
|
|
484
|
+
*/
|
|
485
|
+
interface ResolvedSystemTransformations {
|
|
486
|
+
prepend: SystemTransformation[];
|
|
487
|
+
append: SystemTransformation[];
|
|
488
|
+
}
|
|
489
|
+
|
|
447
490
|
interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectState {
|
|
448
491
|
/**
|
|
449
492
|
* This is usually a plugin id that references a core plugin or an external plugin. But this can also reference a
|
|
@@ -505,6 +548,10 @@ interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectSta
|
|
|
505
548
|
* see https://github.com/grafana/grafana/pull/120190
|
|
506
549
|
**/
|
|
507
550
|
_UNSAFE_clearPreviousFieldValues?: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Whether to check the panel plugin for system transformations. Set by host to gate rollout (feature toggle)
|
|
553
|
+
*/
|
|
554
|
+
applyPluginTransformations?: boolean;
|
|
508
555
|
/**
|
|
509
556
|
* Sets panel chrome collapsed state
|
|
510
557
|
*/
|
|
@@ -523,11 +570,17 @@ interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectSta
|
|
|
523
570
|
_pluginInstanceState?: any;
|
|
524
571
|
_renderCounter?: number;
|
|
525
572
|
}
|
|
526
|
-
declare class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends SceneObjectBase<VizPanelState<TOptions, TFieldConfig>> {
|
|
573
|
+
declare class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends SceneObjectBase<VizPanelState<TOptions, TFieldConfig>> implements SystemTransformationsProvider {
|
|
527
574
|
static Component: typeof VizPanelRenderer;
|
|
528
575
|
protected _variableDependency: VariableDependencyConfig<VizPanelState<{}, {}>>;
|
|
529
576
|
protected _panelContext?: PanelContext;
|
|
577
|
+
/**
|
|
578
|
+
* The plugin this panel has adopted: options have been migrated and defaulted against it, so it
|
|
579
|
+
* deliberately lags state.pluginId while a viz type change is still loading.
|
|
580
|
+
*/
|
|
530
581
|
private _plugin?;
|
|
582
|
+
/** The in-flight import, so concurrent callers share one. */
|
|
583
|
+
private _pluginImport?;
|
|
531
584
|
private _prevData?;
|
|
532
585
|
private _dataWithFieldConfig?;
|
|
533
586
|
private _structureRev;
|
|
@@ -539,6 +592,11 @@ declare class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends Scen
|
|
|
539
592
|
private _onActivate;
|
|
540
593
|
forceRender(): void;
|
|
541
594
|
private _loadPlugin;
|
|
595
|
+
/**
|
|
596
|
+
* The only place the plugin is imported. Concurrent callers (_loadPlugin, getPluginAsync) share one import,
|
|
597
|
+
* and a rejection stays cached so a plugin that fails to load is not retried on every call.
|
|
598
|
+
*/
|
|
599
|
+
private _importPlugin;
|
|
542
600
|
getLegacyPanelId(): number;
|
|
543
601
|
/**
|
|
544
602
|
* Unique id string that includes local variable values (for repeated panels)
|
|
@@ -546,7 +604,48 @@ declare class VizPanel<TOptions = {}, TFieldConfig extends {} = {}> extends Scen
|
|
|
546
604
|
getPathId(): string;
|
|
547
605
|
private _pluginLoaded;
|
|
548
606
|
private _getPluginVersion;
|
|
607
|
+
/**
|
|
608
|
+
* The plugin this panel has adopted, or undefined while it is still loading.
|
|
609
|
+
*/
|
|
549
610
|
getPlugin(): PanelPlugin | undefined;
|
|
611
|
+
/**
|
|
612
|
+
* The plugin for the current state.pluginId, importing it if it is not loaded yet. Rejects when
|
|
613
|
+
* the import does, like the host's importPanelPlugin.
|
|
614
|
+
*
|
|
615
|
+
* Unlike getPlugin this does not return undefined merely because the import has not finished, and
|
|
616
|
+
* it does not wait on the panel being activated. It does not adopt what it resolves: option
|
|
617
|
+
* migrations and the state write stay with _loadPlugin, on the render and viz change paths.
|
|
618
|
+
*/
|
|
619
|
+
getPluginAsync(): Promise<PanelPlugin>;
|
|
620
|
+
/**
|
|
621
|
+
* The plugin for the current state.pluginId when it is available without importing: the one this
|
|
622
|
+
* panel adopted, or one already in the host's cache.
|
|
623
|
+
*/
|
|
624
|
+
private _resolvePluginSync;
|
|
625
|
+
/**
|
|
626
|
+
* @internal
|
|
627
|
+
* Marks this panel as a SystemTransformationsProvider; not for app code.
|
|
628
|
+
*/
|
|
629
|
+
readonly isSystemTransformationsProvider: true;
|
|
630
|
+
/**
|
|
631
|
+
* @internal
|
|
632
|
+
* Identifies this panel's tier in its data pipeline; not for app code.
|
|
633
|
+
*/
|
|
634
|
+
readonly origin: TransformationOrigin;
|
|
635
|
+
/**
|
|
636
|
+
* @internal
|
|
637
|
+
* Called by the SceneDataTransformer that discovered this panel with the frames about to enter the pipeline.
|
|
638
|
+
*/
|
|
639
|
+
getSystemTransformations({ series }: {
|
|
640
|
+
series: DataFrame[];
|
|
641
|
+
}): {
|
|
642
|
+
prepend?: Array<DataTransformerConfig | CustomTransformerDefinition>;
|
|
643
|
+
append?: Array<DataTransformerConfig | CustomTransformerDefinition>;
|
|
644
|
+
};
|
|
645
|
+
/**
|
|
646
|
+
* The plugin that contributes the transformations for this panel.
|
|
647
|
+
*/
|
|
648
|
+
private _pluginForTransformations;
|
|
550
649
|
getPanelContext(): PanelContext;
|
|
551
650
|
onTimeRangeChange: (timeRange: AbsoluteTimeRange) => void;
|
|
552
651
|
getTimeRange: (data?: PanelData) => _grafana_data.TimeRange;
|
|
@@ -2481,7 +2580,8 @@ declare function SceneDataLayerControlsRenderer({ model }: SceneComponentProps<S
|
|
|
2481
2580
|
|
|
2482
2581
|
interface SceneDataTransformerState extends SceneDataState {
|
|
2483
2582
|
/**
|
|
2484
|
-
* Array of standard transformation configs and custom transform operators
|
|
2583
|
+
* Array of standard transformation configs and custom transform operators.
|
|
2584
|
+
* User configured only: system contributed transformations provided by getResolvedSystemTransformations.
|
|
2485
2585
|
*/
|
|
2486
2586
|
transformations: Array<DataTransformerConfig | CustomTransformerDefinition>;
|
|
2487
2587
|
}
|
|
@@ -2497,16 +2597,81 @@ declare class SceneDataTransformer extends SceneObjectBase<SceneDataTransformerS
|
|
|
2497
2597
|
private _transformSub?;
|
|
2498
2598
|
private _results;
|
|
2499
2599
|
private _prevDataFromSource?;
|
|
2600
|
+
/**
|
|
2601
|
+
* The provider found on the parent. Kept across deactivation rather than cleared with the subscription:
|
|
2602
|
+
* the transformations editor reads getResolvedSystemTransformations for panels that are not currently
|
|
2603
|
+
* rendering, and re-discovering on the next activation would be too late. Re-derived from the parent on
|
|
2604
|
+
* every activation, so it does not survive a move to a tree whose parent contributes nothing.
|
|
2605
|
+
*/
|
|
2606
|
+
private _provider?;
|
|
2607
|
+
/**
|
|
2608
|
+
* One slot memo so that a pass resolves the provider once and the editors reading
|
|
2609
|
+
* getResolvedSystemTransformations see what the pipeline used rather than re-resolving.
|
|
2610
|
+
*/
|
|
2611
|
+
private _resolvedSystem?;
|
|
2612
|
+
/**
|
|
2613
|
+
* Whether a previous activation already ran a pass, which is what makes the provider found on this one a
|
|
2614
|
+
* *change* rather than a first discovery. Not carried over by clone, unlike `_prevDataFromSource`.
|
|
2615
|
+
*/
|
|
2616
|
+
private _hasActivatedBefore;
|
|
2617
|
+
/**
|
|
2618
|
+
* The system transformations that produced the current `state.data`, as opposed to what resolves now.
|
|
2619
|
+
* Written only where `_prevDataFromSource` is, so the two always describe the same pass: a pass
|
|
2620
|
+
* cancelled by deactivation has applied neither, and must not be taken for one that landed.
|
|
2621
|
+
*/
|
|
2622
|
+
private _lastPassSystem?;
|
|
2500
2623
|
/**
|
|
2501
2624
|
* Scan transformations for variable usage and re-process transforms when a variable values change
|
|
2502
2625
|
*/
|
|
2503
2626
|
protected _variableDependency: VariableDependencyConfig<SceneDataTransformerState>;
|
|
2504
2627
|
constructor(state: SceneDataTransformerState);
|
|
2505
2628
|
private activationHandler;
|
|
2629
|
+
/**
|
|
2630
|
+
* Checks the parent for system transformation provider.
|
|
2631
|
+
* Reports whether what the pipeline should run has changed since the last pass, so the caller can force one.
|
|
2632
|
+
*/
|
|
2633
|
+
private _discoverProvider;
|
|
2634
|
+
/**
|
|
2635
|
+
* Whether the provider resolves to something other than what the last pass ran.
|
|
2636
|
+
*
|
|
2637
|
+
* The provider instance being unchanged is not enough to conclude the pipeline is unchanged: nothing
|
|
2638
|
+
* was watching while this was inactive, so a plugin that finished importing in that window resolves
|
|
2639
|
+
* differently now. Source frames usually survive a re-activation unchanged, so without this the pass
|
|
2640
|
+
* is skipped as already transformed and state.data keeps frames the reported pipeline never produced.
|
|
2641
|
+
*/
|
|
2642
|
+
private _systemChangedSinceLastPass;
|
|
2506
2643
|
private getSourceData;
|
|
2507
2644
|
setContainerWidth(width: number): void;
|
|
2508
2645
|
isDataReadyToDisplay(): boolean;
|
|
2646
|
+
/**
|
|
2647
|
+
* @internal
|
|
2648
|
+
* Whether the pass behind the current state.data applied any system transformations. A provider that has
|
|
2649
|
+
* stopped contributing still needs one more pass to take them back out.
|
|
2650
|
+
*/
|
|
2651
|
+
hasAppliedSystemTransformations(): boolean;
|
|
2509
2652
|
reprocessTransformations(): void;
|
|
2653
|
+
/**
|
|
2654
|
+
* The system transformations for the given source frames.
|
|
2655
|
+
* Public because provider output never reaches state, so this is the only way for readers
|
|
2656
|
+
* (the transformations editor, the inspect data tab) to see what the pipeline is running.
|
|
2657
|
+
*/
|
|
2658
|
+
getResolvedSystemTransformations(series?: DataFrame[]): ResolvedSystemTransformations;
|
|
2659
|
+
/**
|
|
2660
|
+
* The source frames to resolve a provider against when the caller did not supply their own.
|
|
2661
|
+
*
|
|
2662
|
+
* Mirrors getSourceData's precondition: reading what is running must not throw for a transformer that is not wired.
|
|
2663
|
+
* Since every VizPanel is a provider, a panel without `$data` would throw.
|
|
2664
|
+
*/
|
|
2665
|
+
private _sourceSeriesOrNone;
|
|
2666
|
+
private _resolveProvider;
|
|
2667
|
+
/**
|
|
2668
|
+
* The system transformations to run for the given source frames.
|
|
2669
|
+
*/
|
|
2670
|
+
private _systemTransformationsFor;
|
|
2671
|
+
/**
|
|
2672
|
+
* Places the user configured transformations between the system tiers, in prepend, user, append order.
|
|
2673
|
+
*/
|
|
2674
|
+
private _withSystemTransformations;
|
|
2510
2675
|
/**
|
|
2511
2676
|
* S3.1: Calculate transformation complexity metrics
|
|
2512
2677
|
*/
|
|
@@ -3927,6 +4092,11 @@ declare const timeShiftAlignmentProcessor: ExtraQueryDataProcessor;
|
|
|
3927
4092
|
*/
|
|
3928
4093
|
declare const loadResources: ResourceLoader;
|
|
3929
4094
|
|
|
4095
|
+
/**
|
|
4096
|
+
* Narrows SystemTransformationsProvider
|
|
4097
|
+
*/
|
|
4098
|
+
declare function isSystemTransformationsProvider(o: unknown): o is SystemTransformationsProvider;
|
|
4099
|
+
|
|
3930
4100
|
|
|
3931
4101
|
|
|
3932
4102
|
|
|
@@ -3988,5 +4158,10 @@ declare const sceneUtils: {
|
|
|
3988
4158
|
buildPathIdFor: typeof buildPathIdFor;
|
|
3989
4159
|
};
|
|
3990
4160
|
|
|
3991
|
-
|
|
3992
|
-
|
|
4161
|
+
|
|
4162
|
+
|
|
4163
|
+
|
|
4164
|
+
|
|
4165
|
+
|
|
4166
|
+
export { AdHocFiltersComboboxRenderer, AdHocFiltersVariable, AdHocFiltersVariableController, ConstantVariable, ControlsLabel, CustomVariable, DataProviderProxy, DataSourceVariable, EmbeddedScene, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, GRID_CELL_HEIGHT, GRID_COLUMN_COUNT, GROUP_BY_OPERATOR, GroupByVariable, IntervalVariable, LazyLoader, LocalValueVariable, MultiOrSingleValueSelect, MultiValueVariable, NestedScene, NewSceneObjectAddedEvent, OPERATORS, PATH_ID_SEPARATOR, PanelBuilders, PanelOptionsBuilders, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneApp, SceneAppPage, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataTransformer, SceneDebugger, SceneFlexItem, SceneFlexLayout, SceneGridItem, SceneGridLayout, SceneGridLayoutDragStartEvent, SceneGridRow, SceneObjectBase, SceneObjectRef, SceneObjectRemovedEvent, SceneObjectStateChangedEvent, SceneObjectUrlSyncConfig, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneVariableSet, SceneVariableValueChangedEvent, ScopesVariable, SplitLayout, SwitchVariable, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UserActionEvent, VariableDependencyConfig, VariableValueControl, VariableValueSelectWrapper, VariableValueSelectors, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelExploreButton, VizPanelFitScope, VizPanelMenu, index$2 as behaviors, index as dataLayers, escapeUrlPipeDelimiters, formatRegistry, getClosest, getCompareSeriesRefId, getExploreURL, getQueriesForVariables, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isFiltersRequestEnricher, isGroupByFilter, isSceneObject, isSystemTransformationsProvider, loadResources, index$1 as performanceUtils, registerQueryWithController, registerRuntimeDataSource, sceneGraph, sceneUtils, timeShiftAlignmentProcessor, useSceneApp, useSceneObjectState, useUrlSync, writePerformanceLog };
|
|
4167
|
+
export type { AdHocFilterInteractionHandler, AdHocFilterWithLabels, AdHocFiltersController, AdHocFiltersControllerState, CancelActivationHandler, ControlSourceRef, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DataSourceControlRef, DeepPartial, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FiltersRequestEnricher, FormatVariable, InterpolationFormatParameter, LazyLoaderMode, MacroVariableConstructor, MultiValueVariableState, OperatorDefinition, QueryRunnerState, ResolvedSystemTransformations, SceneActivationHandler, SceneAppDrilldownView, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneComponent, SceneComponentProps, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformerState, SceneDeactivationHandler, SceneFlexItemLike, SceneFlexItemPlacement, SceneFlexItemState, SceneGridItemLike, SceneGridItemStateLike, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectState, SceneObjectStateChangedPayload, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimeRangeLike, SceneTimeRangeState, SceneUrlSyncOptions, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSetState, SceneVariableState, SceneVariables, SystemTransformation, SystemTransformationPosition, SystemTransformationsProvider, TransformationOrigin, UrlSyncManagerLike, UseStateHookOptions, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableGetOptionsArgs, VariableValue, VariableValueOption, VariableValueOptionProperties, VariableValueSingle, VizConfig, VizPanelFitScopeProps, VizPanelState };
|