@grafana/scenes 6.37.0--canary.1240.17829532252.0 → 6.37.0--canary.1250.17837997062.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/esm/behaviors/SceneRenderProfiler.js +2 -65
- package/dist/esm/behaviors/SceneRenderProfiler.js.map +1 -1
- package/dist/esm/behaviors/index.js +0 -1
- package/dist/esm/behaviors/index.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +4 -1
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +16 -15
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +0 -8
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/index.d.ts +0 -26
- package/dist/index.js +18 -124
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/behaviors/SceneInteractionTracker.js +0 -30
- package/dist/esm/behaviors/SceneInteractionTracker.js.map +0 -1
- package/dist/esm/core/sceneGraph/getInteractionTracker.js +0 -19
- package/dist/esm/core/sceneGraph/getInteractionTracker.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1058,7 +1058,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
1058
1058
|
return __privateGet$2(obj, member, getter);
|
|
1059
1059
|
}
|
|
1060
1060
|
});
|
|
1061
|
-
var _profileInProgress,
|
|
1061
|
+
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans, _longFrameDetector, _longFramesCount, _longFramesTotalTime, _visibilityChangeHandler;
|
|
1062
1062
|
const POST_STORM_WINDOW = 2e3;
|
|
1063
1063
|
const DEFAULT_LONG_FRAME_THRESHOLD = 30;
|
|
1064
1064
|
const TAB_INACTIVE_THRESHOLD = 1e3;
|
|
@@ -1066,7 +1066,6 @@ class SceneRenderProfiler {
|
|
|
1066
1066
|
constructor(queryController) {
|
|
1067
1067
|
this.queryController = queryController;
|
|
1068
1068
|
__privateAdd$2(this, _profileInProgress, null);
|
|
1069
|
-
__privateAdd$2(this, _interactionInProgress, null);
|
|
1070
1069
|
__privateAdd$2(this, _profileStartTs, null);
|
|
1071
1070
|
__privateAdd$2(this, _trailAnimationFrameId, null);
|
|
1072
1071
|
// Will keep measured lengths trailing frames
|
|
@@ -1076,7 +1075,6 @@ class SceneRenderProfiler {
|
|
|
1076
1075
|
__privateAdd$2(this, _longFramesCount, 0);
|
|
1077
1076
|
__privateAdd$2(this, _longFramesTotalTime, 0);
|
|
1078
1077
|
__privateAdd$2(this, _visibilityChangeHandler, null);
|
|
1079
|
-
__privateAdd$2(this, _onInteractionComplete, null);
|
|
1080
1078
|
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
|
1081
1079
|
var _a, _b, _c, _d;
|
|
1082
1080
|
const currentFrameTime = performance.now();
|
|
@@ -1193,14 +1191,10 @@ class SceneRenderProfiler {
|
|
|
1193
1191
|
};
|
|
1194
1192
|
__privateSet$2(this, _longFrameDetector, new LongFrameDetector());
|
|
1195
1193
|
this.setupVisibilityChangeHandler();
|
|
1196
|
-
__privateSet$2(this, _interactionInProgress, null);
|
|
1197
1194
|
}
|
|
1198
1195
|
setQueryController(queryController) {
|
|
1199
1196
|
this.queryController = queryController;
|
|
1200
1197
|
}
|
|
1201
|
-
setInteractionCompleteHandler(handler) {
|
|
1202
|
-
__privateSet$2(this, _onInteractionComplete, handler != null ? handler : null);
|
|
1203
|
-
}
|
|
1204
1198
|
setupVisibilityChangeHandler() {
|
|
1205
1199
|
if (__privateGet$2(this, _visibilityChangeHandler)) {
|
|
1206
1200
|
return;
|
|
@@ -1239,55 +1233,6 @@ class SceneRenderProfiler {
|
|
|
1239
1233
|
this._startNewProfile(name);
|
|
1240
1234
|
}
|
|
1241
1235
|
}
|
|
1242
|
-
startInteraction(interaction) {
|
|
1243
|
-
if (__privateGet$2(this, _interactionInProgress)) {
|
|
1244
|
-
writeSceneLog("profile", "Cancelled interaction:", __privateGet$2(this, _interactionInProgress));
|
|
1245
|
-
__privateSet$2(this, _interactionInProgress, null);
|
|
1246
|
-
}
|
|
1247
|
-
__privateSet$2(this, _interactionInProgress, {
|
|
1248
|
-
interaction,
|
|
1249
|
-
startTs: performance.now()
|
|
1250
|
-
});
|
|
1251
|
-
writeSceneLog("SceneRenderProfiler", "Started interaction:", interaction);
|
|
1252
|
-
}
|
|
1253
|
-
stopInteraction() {
|
|
1254
|
-
if (!__privateGet$2(this, _interactionInProgress)) {
|
|
1255
|
-
return;
|
|
1256
|
-
}
|
|
1257
|
-
const endTs = performance.now();
|
|
1258
|
-
const interactionDuration = endTs - __privateGet$2(this, _interactionInProgress).startTs;
|
|
1259
|
-
const networkDuration = captureNetwork(__privateGet$2(this, _interactionInProgress).startTs, endTs);
|
|
1260
|
-
writeSceneLog("SceneRenderProfiler", "Completed interaction:");
|
|
1261
|
-
writeSceneLog("", ` \u251C\u2500 Total time: ${interactionDuration.toFixed(1)}ms`);
|
|
1262
|
-
writeSceneLog("", ` \u251C\u2500 Network duration: ${networkDuration.toFixed(1)}ms`);
|
|
1263
|
-
writeSceneLog("", ` \u251C\u2500 StartTs: ${__privateGet$2(this, _interactionInProgress).startTs.toFixed(1)}ms`);
|
|
1264
|
-
writeSceneLog("", ` \u2514\u2500 EndTs: ${endTs.toFixed(1)}ms`);
|
|
1265
|
-
if (__privateGet$2(this, _onInteractionComplete) && __privateGet$2(this, _profileInProgress)) {
|
|
1266
|
-
__privateGet$2(this, _onInteractionComplete).call(this, {
|
|
1267
|
-
origin: __privateGet$2(this, _interactionInProgress).interaction,
|
|
1268
|
-
duration: interactionDuration,
|
|
1269
|
-
networkDuration,
|
|
1270
|
-
startTs: __privateGet$2(this, _interactionInProgress).startTs,
|
|
1271
|
-
endTs
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
performance.mark(`${__privateGet$2(this, _interactionInProgress).interaction}_start`, {
|
|
1275
|
-
startTime: __privateGet$2(this, _interactionInProgress).startTs
|
|
1276
|
-
});
|
|
1277
|
-
performance.mark(`${__privateGet$2(this, _interactionInProgress).interaction}_end`, {
|
|
1278
|
-
startTime: endTs
|
|
1279
|
-
});
|
|
1280
|
-
performance.measure(
|
|
1281
|
-
`Interaction_${__privateGet$2(this, _interactionInProgress).interaction}`,
|
|
1282
|
-
`${__privateGet$2(this, _interactionInProgress).interaction}_start`,
|
|
1283
|
-
`${__privateGet$2(this, _interactionInProgress).interaction}_end`
|
|
1284
|
-
);
|
|
1285
|
-
__privateSet$2(this, _interactionInProgress, null);
|
|
1286
|
-
}
|
|
1287
|
-
getCurrentInteraction() {
|
|
1288
|
-
var _a, _b;
|
|
1289
|
-
return (_b = (_a = __privateGet$2(this, _interactionInProgress)) == null ? void 0 : _a.interaction) != null ? _b : null;
|
|
1290
|
-
}
|
|
1291
1236
|
/**
|
|
1292
1237
|
* Starts a new profile for performance measurement.
|
|
1293
1238
|
*
|
|
@@ -1333,9 +1278,6 @@ class SceneRenderProfiler {
|
|
|
1333
1278
|
}
|
|
1334
1279
|
tryCompletingProfile() {
|
|
1335
1280
|
var _a;
|
|
1336
|
-
if (!__privateGet$2(this, _profileInProgress)) {
|
|
1337
|
-
return;
|
|
1338
|
-
}
|
|
1339
1281
|
writeSceneLog("SceneRenderProfiler", "Trying to complete profile", __privateGet$2(this, _profileInProgress));
|
|
1340
1282
|
if (((_a = this.queryController) == null ? void 0 : _a.runningQueriesCount()) === 0 && __privateGet$2(this, _profileInProgress)) {
|
|
1341
1283
|
writeSceneLog("SceneRenderProfiler", "All queries completed, starting tail measurement");
|
|
@@ -1376,7 +1318,6 @@ class SceneRenderProfiler {
|
|
|
1376
1318
|
}
|
|
1377
1319
|
}
|
|
1378
1320
|
_profileInProgress = new WeakMap();
|
|
1379
|
-
_interactionInProgress = new WeakMap();
|
|
1380
1321
|
_profileStartTs = new WeakMap();
|
|
1381
1322
|
_trailAnimationFrameId = new WeakMap();
|
|
1382
1323
|
_recordedTrailingSpans = new WeakMap();
|
|
@@ -1384,7 +1325,6 @@ _longFrameDetector = new WeakMap();
|
|
|
1384
1325
|
_longFramesCount = new WeakMap();
|
|
1385
1326
|
_longFramesTotalTime = new WeakMap();
|
|
1386
1327
|
_visibilityChangeHandler = new WeakMap();
|
|
1387
|
-
_onInteractionComplete = new WeakMap();
|
|
1388
1328
|
function processRecordedSpans(spans) {
|
|
1389
1329
|
for (let i = spans.length - 1; i >= 0; i--) {
|
|
1390
1330
|
if (spans[i] > DEFAULT_LONG_FRAME_THRESHOLD) {
|
|
@@ -1434,9 +1374,6 @@ const FILTER_CHANGED_INTERACTION = "filter_changed";
|
|
|
1434
1374
|
const FILTER_RESTORED_INTERACTION = "filter_restored";
|
|
1435
1375
|
const VARIABLE_VALUE_CHANGED_INTERACTION = "variable_value_changed";
|
|
1436
1376
|
const SCOPES_CHANGED_INTERACTION = "scopes_changed";
|
|
1437
|
-
const ADHOC_KEYS_DROPDOWN_INTERACTION = "adhoc_keys_dropdown";
|
|
1438
|
-
const ADHOC_VALUES_DROPDOWN_INTERACTION = "adhoc_values_dropdown";
|
|
1439
|
-
const GROUPBY_DIMENSIONS_INTERACTION = "groupby_dimensions";
|
|
1440
1377
|
|
|
1441
1378
|
class SceneTimeRange extends SceneObjectBase {
|
|
1442
1379
|
constructor(state = {}) {
|
|
@@ -3718,47 +3655,6 @@ const GroupByValueContainer = ({
|
|
|
3718
3655
|
return /* @__PURE__ */ React__default.default.createElement("div", { className: css.cx(styles.multiValueContainer, !isApplicable && css.cx(disabledPill, strikethrough)) }, children);
|
|
3719
3656
|
};
|
|
3720
3657
|
|
|
3721
|
-
function isInteractionTracker(s) {
|
|
3722
|
-
return "isInteractionTracker" in s;
|
|
3723
|
-
}
|
|
3724
|
-
class SceneInteractionTracker extends SceneObjectBase {
|
|
3725
|
-
constructor(state = {}, renderProfiler) {
|
|
3726
|
-
super(state);
|
|
3727
|
-
this.renderProfiler = renderProfiler;
|
|
3728
|
-
this.isInteractionTracker = true;
|
|
3729
|
-
if (renderProfiler) {
|
|
3730
|
-
this.renderProfiler = renderProfiler;
|
|
3731
|
-
this.renderProfiler.setInteractionCompleteHandler(state.onInteractionComplete);
|
|
3732
|
-
}
|
|
3733
|
-
}
|
|
3734
|
-
startInteraction(name) {
|
|
3735
|
-
var _a;
|
|
3736
|
-
if (!this.state.enableInteractionTracking) {
|
|
3737
|
-
return;
|
|
3738
|
-
}
|
|
3739
|
-
(_a = this.renderProfiler) == null ? void 0 : _a.startInteraction(name);
|
|
3740
|
-
}
|
|
3741
|
-
stopInteraction() {
|
|
3742
|
-
var _a;
|
|
3743
|
-
(_a = this.renderProfiler) == null ? void 0 : _a.stopInteraction();
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
|
|
3747
|
-
function getInteractionTracker(sceneObject) {
|
|
3748
|
-
let parent = sceneObject;
|
|
3749
|
-
while (parent) {
|
|
3750
|
-
if (parent.state.$behaviors) {
|
|
3751
|
-
for (const behavior of parent.state.$behaviors) {
|
|
3752
|
-
if (isInteractionTracker(behavior)) {
|
|
3753
|
-
return behavior;
|
|
3754
|
-
}
|
|
3755
|
-
}
|
|
3756
|
-
}
|
|
3757
|
-
parent = parent.parent;
|
|
3758
|
-
}
|
|
3759
|
-
return void 0;
|
|
3760
|
-
}
|
|
3761
|
-
|
|
3762
3658
|
class GroupByVariable extends MultiValueVariable {
|
|
3763
3659
|
constructor(initialState) {
|
|
3764
3660
|
super({
|
|
@@ -4064,13 +3960,10 @@ function GroupByVariableRenderer({ model }) {
|
|
|
4064
3960
|
setUncommittedValue(newValue);
|
|
4065
3961
|
},
|
|
4066
3962
|
onOpenMenu: async () => {
|
|
4067
|
-
const profiler = getInteractionTracker(model);
|
|
4068
|
-
profiler == null ? void 0 : profiler.startInteraction(GROUPBY_DIMENSIONS_INTERACTION);
|
|
4069
3963
|
setIsFetchingOptions(true);
|
|
4070
3964
|
await rxjs.lastValueFrom(model.validateAndUpdate());
|
|
4071
3965
|
setIsFetchingOptions(false);
|
|
4072
3966
|
setIsOptionsOpen(true);
|
|
4073
|
-
profiler == null ? void 0 : profiler.stopInteraction();
|
|
4074
3967
|
},
|
|
4075
3968
|
onCloseMenu: () => {
|
|
4076
3969
|
setIsOptionsOpen(false);
|
|
@@ -4120,13 +4013,10 @@ function GroupByVariableRenderer({ model }) {
|
|
|
4120
4013
|
}
|
|
4121
4014
|
},
|
|
4122
4015
|
onOpenMenu: async () => {
|
|
4123
|
-
const profiler = getInteractionTracker(model);
|
|
4124
|
-
profiler == null ? void 0 : profiler.startInteraction(GROUPBY_DIMENSIONS_INTERACTION);
|
|
4125
4016
|
setIsFetchingOptions(true);
|
|
4126
4017
|
await rxjs.lastValueFrom(model.validateAndUpdate());
|
|
4127
4018
|
setIsFetchingOptions(false);
|
|
4128
4019
|
setIsOptionsOpen(true);
|
|
4129
|
-
profiler == null ? void 0 : profiler.stopInteraction();
|
|
4130
4020
|
},
|
|
4131
4021
|
onCloseMenu: () => {
|
|
4132
4022
|
setIsOptionsOpen(false);
|
|
@@ -4383,11 +4273,13 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
4383
4273
|
});
|
|
4384
4274
|
}
|
|
4385
4275
|
};
|
|
4276
|
+
const operatorDefinition = OPERATORS.find((op) => filter.operator === op.value);
|
|
4386
4277
|
const valueSelect = /* @__PURE__ */ React__default.default.createElement(
|
|
4387
4278
|
ui.Select,
|
|
4388
4279
|
{
|
|
4389
4280
|
virtualized: true,
|
|
4390
4281
|
allowCustomValue: (_b = model.state.allowCustomValue) != null ? _b : true,
|
|
4282
|
+
createOptionPosition: (operatorDefinition == null ? void 0 : operatorDefinition.isRegex) ? "first" : "last",
|
|
4391
4283
|
isValidNewOption: (inputValue) => inputValue.trim().length > 0,
|
|
4392
4284
|
allowCreateWhileLoading: true,
|
|
4393
4285
|
formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
|
|
@@ -4445,6 +4337,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
4445
4337
|
className: css.cx(styles.key, isKeysOpen ? styles.widthWhenOpen : void 0),
|
|
4446
4338
|
width: "auto",
|
|
4447
4339
|
allowCustomValue: (_c = model.state.allowCustomValue) != null ? _c : true,
|
|
4340
|
+
createOptionPosition: (operatorDefinition == null ? void 0 : operatorDefinition.isRegex) ? "first" : "last",
|
|
4448
4341
|
value: keyValue,
|
|
4449
4342
|
placeholder: i18n.t(
|
|
4450
4343
|
"grafana-scenes.variables.ad-hoc-filter-renderer.key-select.placeholder-select-label",
|
|
@@ -5280,22 +5173,26 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
|
5280
5173
|
handleOptionGroups(optionsSearcher(preventFiltering ? "" : inputValue))
|
|
5281
5174
|
);
|
|
5282
5175
|
if (allowCustomValue && filterInputType !== "operator" && inputValue) {
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5176
|
+
const operatorDefinition = OPERATORS.find((op) => (filter == null ? void 0 : filter.operator) === op.value);
|
|
5177
|
+
if (operatorDefinition == null ? void 0 : operatorDefinition.isRegex) {
|
|
5178
|
+
filteredDropDownItems.unshift({
|
|
5179
|
+
value: inputValue.trim(),
|
|
5180
|
+
label: inputValue.trim(),
|
|
5181
|
+
isCustom: true
|
|
5182
|
+
});
|
|
5183
|
+
} else {
|
|
5184
|
+
filteredDropDownItems.push({
|
|
5185
|
+
value: inputValue.trim(),
|
|
5186
|
+
label: inputValue.trim(),
|
|
5187
|
+
isCustom: true
|
|
5188
|
+
});
|
|
5189
|
+
}
|
|
5288
5190
|
}
|
|
5289
5191
|
const onAddCustomValue = model.state.onAddCustomValue;
|
|
5290
5192
|
const maxOptionWidth = setupDropdownAccessibility(filteredDropDownItems, listRef, disabledIndicesRef);
|
|
5291
5193
|
const handleFetchOptions = React.useCallback(
|
|
5292
5194
|
async (inputType) => {
|
|
5293
5195
|
var _a2;
|
|
5294
|
-
const profiler = getInteractionTracker(model);
|
|
5295
|
-
const interactionName = inputType === "key" ? ADHOC_KEYS_DROPDOWN_INTERACTION : ADHOC_VALUES_DROPDOWN_INTERACTION;
|
|
5296
|
-
if (inputType !== "operator") {
|
|
5297
|
-
profiler == null ? void 0 : profiler.startInteraction(interactionName);
|
|
5298
|
-
}
|
|
5299
5196
|
setOptionsError(false);
|
|
5300
5197
|
setOptionsLoading(true);
|
|
5301
5198
|
setOptions([]);
|
|
@@ -5309,7 +5206,6 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
|
5309
5206
|
options2 = await model._getValuesFor(filter);
|
|
5310
5207
|
}
|
|
5311
5208
|
if (filterInputTypeRef.current !== inputType) {
|
|
5312
|
-
profiler == null ? void 0 : profiler.stopInteraction();
|
|
5313
5209
|
return;
|
|
5314
5210
|
}
|
|
5315
5211
|
setOptions(options2);
|
|
@@ -5322,7 +5218,6 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
|
5322
5218
|
setOptionsError(true);
|
|
5323
5219
|
}
|
|
5324
5220
|
setOptionsLoading(false);
|
|
5325
|
-
profiler == null ? void 0 : profiler.stopInteraction();
|
|
5326
5221
|
},
|
|
5327
5222
|
[filter, model]
|
|
5328
5223
|
);
|
|
@@ -9976,7 +9871,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
9976
9871
|
ActWhenVariableChanged: ActWhenVariableChanged,
|
|
9977
9872
|
CursorSync: CursorSync,
|
|
9978
9873
|
LiveNowTimer: LiveNowTimer,
|
|
9979
|
-
SceneInteractionTracker: SceneInteractionTracker,
|
|
9980
9874
|
SceneQueryController: SceneQueryController
|
|
9981
9875
|
});
|
|
9982
9876
|
|