@grafana/scenes 6.28.2--canary.1195.16567768943.0 → 6.28.2

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.js CHANGED
@@ -646,7 +646,7 @@ class SceneRenderProfiler {
646
646
  );
647
647
  __privateSet$3(this, _trailAnimationFrameId, null);
648
648
  const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
649
- performance.measure(`DashboardInteraction ${__privateGet$3(this, _profileInProgress).origin}`, {
649
+ performance.measure("DashboardInteraction", {
650
650
  start: profileStartTs,
651
651
  end: profileEndTs
652
652
  });
@@ -664,7 +664,6 @@ class SceneRenderProfiler {
664
664
  // @ts-ignore
665
665
  totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
666
666
  });
667
- __privateSet$3(this, _profileInProgress, null);
668
667
  }
669
668
  if (window.__runs) {
670
669
  window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
@@ -677,22 +676,14 @@ class SceneRenderProfiler {
677
676
  };
678
677
  }
679
678
  startProfile(name) {
680
- if (__privateGet$3(this, _profileInProgress)) {
681
- if (__privateGet$3(this, _trailAnimationFrameId)) {
682
- cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
683
- __privateSet$3(this, _trailAnimationFrameId, null);
684
- writeSceneLog(this.constructor.name, "New profile: Stopped recording frames ");
685
- __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
686
- __privateSet$3(this, _profileStartTs, performance.now());
687
- writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
688
- } else {
689
- this.addCrumb(name);
690
- }
691
- } else {
692
- __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
693
- __privateSet$3(this, _profileStartTs, performance.now());
694
- writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
679
+ if (__privateGet$3(this, _trailAnimationFrameId)) {
680
+ cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
681
+ __privateSet$3(this, _trailAnimationFrameId, null);
682
+ writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
695
683
  }
684
+ __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
685
+ __privateSet$3(this, _profileStartTs, performance.now());
686
+ writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
696
687
  }
697
688
  recordProfileTail(measurementStartTime, profileStartTs) {
698
689
  __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
@@ -718,7 +709,6 @@ class SceneRenderProfiler {
718
709
  }
719
710
  addCrumb(crumb) {
720
711
  if (__privateGet$3(this, _profileInProgress)) {
721
- writeSceneLog(this.constructor.name, "Adding crumb:", crumb);
722
712
  __privateGet$3(this, _profileInProgress).crumbs.push(crumb);
723
713
  }
724
714
  }
@@ -767,13 +757,6 @@ function calculateNetworkTime(requests) {
767
757
  totalNetworkTime += currentEnd - currentStart;
768
758
  return totalNetworkTime;
769
759
  }
770
- const REFRESH_INTERACTION = "refresh";
771
- const TIME_RANGE_CHANGE_INTERACTION = "time_range_change";
772
- const FILTER_REMOVED_INTERACTION = "filter_removed";
773
- const FILTER_CHANGED_INTERACTION = "filter_changed";
774
- const FILTER_RESTORED_INTERACTION = "filter_restored";
775
- const VARIABLE_VALUE_CHANGED_INTERACTION = "variable_value_changed";
776
- const SCOPES_CHANGED_INTERACTION = "scopes_changed";
777
760
 
778
761
  var __typeError$2 = (msg) => {
779
762
  throw TypeError(msg);
@@ -1055,7 +1038,7 @@ class SceneTimeRange extends SceneObjectBase {
1055
1038
  );
1056
1039
  if (update.from !== this.state.from || update.to !== this.state.to) {
1057
1040
  const queryController = getQueryController(this);
1058
- queryController == null ? void 0 : queryController.startProfile(TIME_RANGE_CHANGE_INTERACTION);
1041
+ queryController == null ? void 0 : queryController.startProfile("SceneTimeRange");
1059
1042
  this._urlSync.performBrowserHistoryAction(() => {
1060
1043
  this.setState(update);
1061
1044
  });
@@ -2570,7 +2553,6 @@ function wrapPromiseInStateObservable(promise) {
2570
2553
  }
2571
2554
 
2572
2555
  async function getDataSource(datasource, scopedVars) {
2573
- var _a;
2574
2556
  if (datasource == null ? void 0 : datasource.uid) {
2575
2557
  const runtimeDataSource = runtimeDataSources.get(datasource.uid);
2576
2558
  if (runtimeDataSource) {
@@ -2586,7 +2568,7 @@ async function getDataSource(datasource, scopedVars) {
2586
2568
  if (queryControler && queryControler.state.enableProfiling) {
2587
2569
  wrapPromiseInStateObservable(dsPromise).pipe(
2588
2570
  registerQueryWithController({
2589
- type: `plugin/${(_a = datasource == null ? void 0 : datasource.type) != null ? _a : "unknown"}`,
2571
+ type: "plugin",
2590
2572
  origin: scopedVars.__sceneObject.value.valueOf()
2591
2573
  })
2592
2574
  ).subscribe(() => {
@@ -2928,7 +2910,7 @@ function VariableValueSelect({ model, state }) {
2928
2910
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
2929
2911
  onChange: (newValue) => {
2930
2912
  model.changeValueTo(newValue.value, newValue.label, true);
2931
- queryController == null ? void 0 : queryController.startProfile(VARIABLE_VALUE_CHANGED_INTERACTION);
2913
+ queryController == null ? void 0 : queryController.startProfile("VariableValueSelect");
2932
2914
  if (hasCustomValue !== newValue.__isNew__) {
2933
2915
  setHasCustomValue(newValue.__isNew__);
2934
2916
  }
@@ -3001,7 +2983,7 @@ function VariableValueSelectMulti({
3001
2983
  onInputChange,
3002
2984
  onBlur: () => {
3003
2985
  model.changeValueTo(uncommittedValue, void 0, true);
3004
- queryController == null ? void 0 : queryController.startProfile(VARIABLE_VALUE_CHANGED_INTERACTION);
2986
+ queryController == null ? void 0 : queryController.startProfile("VariableValueSelectMulti");
3005
2987
  },
3006
2988
  filterOption: filterNoOp$2,
3007
2989
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
@@ -4644,14 +4626,6 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4644
4626
  valueLabels.push((_a2 = item.label) != null ? _a2 : item.value);
4645
4627
  values.push(item.value);
4646
4628
  });
4647
- let shouldUpdate = true;
4648
- if (Array.isArray(filter2.values) && filter2.values.length === values.length) {
4649
- shouldUpdate = !filter2.values.every((v, i) => v === values[i]);
4650
- }
4651
- if (shouldUpdate) {
4652
- const queryController = getQueryController(model2);
4653
- queryController == null ? void 0 : queryController.startProfile(FILTER_CHANGED_INTERACTION);
4654
- }
4655
4629
  model2._updateFilter(filter2, { valueLabels, values, value: values[0] });
4656
4630
  setFilterMultiValues([]);
4657
4631
  }
@@ -4804,10 +4778,6 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4804
4778
  return;
4805
4779
  }
4806
4780
  focusOnWipInputRef == null ? void 0 : focusOnWipInputRef();
4807
- if (isFilterComplete(filter)) {
4808
- const queryController = getQueryController(model);
4809
- queryController == null ? void 0 : queryController.startProfile(FILTER_REMOVED_INTERACTION);
4810
- }
4811
4781
  model._handleComboboxBackspace(filter);
4812
4782
  if (isAlwaysWip) {
4813
4783
  handleResetWip();
@@ -4872,18 +4842,16 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4872
4842
  handleLocalMultiValueChange(selectedItem);
4873
4843
  setInputValue("");
4874
4844
  } else {
4875
- const payload = generateFilterUpdatePayload({
4876
- filterInputType,
4877
- item: selectedItem,
4845
+ model._updateFilter(
4878
4846
  filter,
4879
- setFilterMultiValues,
4880
- onAddCustomValue
4881
- });
4882
- if (filterInputType === "value" && payload.value !== (filter == null ? void 0 : filter.value)) {
4883
- const queryController = getQueryController(model);
4884
- queryController == null ? void 0 : queryController.startProfile(FILTER_CHANGED_INTERACTION);
4885
- }
4886
- model._updateFilter(filter, payload);
4847
+ generateFilterUpdatePayload({
4848
+ filterInputType,
4849
+ item: selectedItem,
4850
+ filter,
4851
+ setFilterMultiValues,
4852
+ onAddCustomValue
4853
+ })
4854
+ );
4887
4855
  populateInputValueOnInputTypeSwitch({
4888
4856
  populateInputOnEdit,
4889
4857
  item: selectedItem,
@@ -5131,18 +5099,16 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
5131
5099
  setInputValue("");
5132
5100
  (_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
5133
5101
  } else {
5134
- const payload = generateFilterUpdatePayload({
5135
- filterInputType,
5136
- item,
5102
+ model._updateFilter(
5137
5103
  filter,
5138
- setFilterMultiValues,
5139
- onAddCustomValue
5140
- });
5141
- if (filterInputType === "value" && payload.value !== (filter == null ? void 0 : filter.value)) {
5142
- const queryController = getQueryController(model);
5143
- queryController == null ? void 0 : queryController.startProfile(FILTER_CHANGED_INTERACTION);
5144
- }
5145
- model._updateFilter(filter, payload);
5104
+ generateFilterUpdatePayload({
5105
+ filterInputType,
5106
+ item,
5107
+ filter,
5108
+ setFilterMultiValues,
5109
+ onAddCustomValue
5110
+ })
5111
+ );
5146
5112
  populateInputValueOnInputTypeSwitch({
5147
5113
  populateInputOnEdit,
5148
5114
  item,
@@ -5868,8 +5834,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
5868
5834
  original.valueLabels = originalFilter == null ? void 0 : originalFilter.value;
5869
5835
  original.operator = originalFilter == null ? void 0 : originalFilter.operator;
5870
5836
  original.nonApplicable = originalFilter == null ? void 0 : originalFilter.nonApplicable;
5871
- const queryController = getQueryController(this);
5872
- queryController == null ? void 0 : queryController.startProfile(FILTER_RESTORED_INTERACTION);
5873
5837
  this._updateFilter(filter, original);
5874
5838
  }
5875
5839
  }
@@ -5926,8 +5890,6 @@ class AdHocFiltersVariable extends SceneObjectBase {
5926
5890
  this.setState({ _wip: void 0 });
5927
5891
  return;
5928
5892
  }
5929
- const queryController = getQueryController(this);
5930
- queryController == null ? void 0 : queryController.startProfile(FILTER_REMOVED_INTERACTION);
5931
5893
  this._setStateWithFiltersApplicabilityCheck({
5932
5894
  filters: this.state.filters.filter((f) => f !== filter),
5933
5895
  originFilters: this.state.originFilters
@@ -7570,8 +7532,6 @@ class ScopesVariable extends SceneObjectBase {
7570
7532
  const newScopes = state.value.map((scope) => scope.metadata.name);
7571
7533
  const scopesHaveChanged = !lodash.isEqual(oldScopes, newScopes);
7572
7534
  if (!loading && (scopesHaveChanged || newScopes.length === 0)) {
7573
- const queryController = getQueryController(this);
7574
- queryController == null ? void 0 : queryController.startProfile(SCOPES_CHANGED_INTERACTION);
7575
7535
  this.setState({ scopes: state.value, loading });
7576
7536
  this.publishEvent(new SceneVariableValueChangedEvent(this), true);
7577
7537
  } else {
@@ -8688,7 +8648,7 @@ class VizPanel extends SceneObjectBase {
8688
8648
  const panelPromise = importPanelPlugin(pluginId);
8689
8649
  const queryControler = sceneGraph.getQueryController(this);
8690
8650
  if (queryControler && queryControler.state.enableProfiling) {
8691
- wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: `plugin/${pluginId}`, origin: this })).subscribe(() => {
8651
+ wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
8692
8652
  });
8693
8653
  }
8694
8654
  const result = await panelPromise;
@@ -10995,6 +10955,7 @@ function VizPanelMenuRenderer({ model }) {
10995
10955
  ui.Menu.Item,
10996
10956
  {
10997
10957
  key: item.text,
10958
+ role: "menuitem",
10998
10959
  label: item.text,
10999
10960
  icon: item.iconClassName,
11000
10961
  childItems: item.subMenu ? renderItems(item.subMenu) : void 0,
@@ -12055,7 +12016,7 @@ class SceneRefreshPicker extends SceneObjectBase {
12055
12016
  this._autoRefreshBlocked = false;
12056
12017
  this.onRefresh = () => {
12057
12018
  const queryController = sceneGraph.getQueryController(this);
12058
- queryController == null ? void 0 : queryController.startProfile(REFRESH_INTERACTION);
12019
+ queryController == null ? void 0 : queryController.startProfile("SceneRefreshPicker");
12059
12020
  if (queryController == null ? void 0 : queryController.state.isRunning) {
12060
12021
  queryController.cancelAll();
12061
12022
  return;
@@ -12112,7 +12073,7 @@ class SceneRefreshPicker extends SceneObjectBase {
12112
12073
  this._intervalTimer = setInterval(() => {
12113
12074
  if (this.isTabVisible()) {
12114
12075
  const queryController = sceneGraph.getQueryController(this);
12115
- queryController == null ? void 0 : queryController.startProfile(REFRESH_INTERACTION);
12076
+ queryController == null ? void 0 : queryController.startProfile("SceneRefreshPicker");
12116
12077
  timeRange.onRefresh();
12117
12078
  } else {
12118
12079
  this._autoRefreshBlocked = true;