@grafana/scenes 6.10.3--canary.1118.14843701192.0 → 6.10.3--canary.1115.14859615413.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/core/SceneTimeRange.js +1 -1
- package/dist/esm/core/SceneTimeRange.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.js +20 -16
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFilterPill.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +2 -2
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1117,7 +1117,7 @@ class SceneTimeRange extends SceneObjectBase {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
calculatePercentOfInterval(percent) {
|
|
1119
1119
|
const intervalMs = this.state.value.to.diff(this.state.value.from, "milliseconds");
|
|
1120
|
-
return Math.ceil(intervalMs / percent);
|
|
1120
|
+
return Math.ceil(intervalMs / 100 * percent);
|
|
1121
1121
|
}
|
|
1122
1122
|
getTimeZone() {
|
|
1123
1123
|
if (this.state.timeZone && getValidTimeZone(this.state.timeZone)) {
|
|
@@ -4960,23 +4960,16 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
|
4960
4960
|
}
|
|
4961
4961
|
}, [viewMode]);
|
|
4962
4962
|
if (viewMode) {
|
|
4963
|
-
const
|
|
4964
|
-
|
|
4965
|
-
let injectedRestoreText = "";
|
|
4966
|
-
if (filter.origin === "dashboard") {
|
|
4967
|
-
injectedInfoText = "Applied by default in this dashboard. If edited, it carries over to other dashboards.";
|
|
4968
|
-
injectedRestoreText = "Restore the value defined by this dashboard.";
|
|
4969
|
-
} else if (filter.origin === "scope") {
|
|
4970
|
-
injectedInfoText = "Applied automatically from your selected scope.";
|
|
4971
|
-
injectedRestoreText = "Restore the value set by your selected scope.";
|
|
4972
|
-
}
|
|
4963
|
+
const pillTextContent = `${keyLabel} ${filter.operator} ${valueLabel}`;
|
|
4964
|
+
const pillText = /* @__PURE__ */ React__default.default.createElement("span", { className: styles.pillText }, pillTextContent);
|
|
4973
4965
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
4974
4966
|
"div",
|
|
4975
4967
|
{
|
|
4976
4968
|
className: css.cx(
|
|
4977
4969
|
styles.combinedFilterPill,
|
|
4978
4970
|
readOnly && styles.readOnlyCombinedFilter,
|
|
4979
|
-
isMatchAllFilter(filter) && styles.matchAllPill
|
|
4971
|
+
isMatchAllFilter(filter) && styles.matchAllPill,
|
|
4972
|
+
filter.readOnly && styles.filterReadOnly
|
|
4980
4973
|
),
|
|
4981
4974
|
onClick: (e) => {
|
|
4982
4975
|
e.stopPropagation();
|
|
@@ -4989,12 +4982,12 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
|
4989
4982
|
handleChangeViewMode();
|
|
4990
4983
|
}
|
|
4991
4984
|
},
|
|
4992
|
-
role: "button",
|
|
4985
|
+
role: readOnly ? void 0 : "button",
|
|
4993
4986
|
"aria-label": `Edit filter with key ${keyLabel}`,
|
|
4994
4987
|
tabIndex: 0,
|
|
4995
4988
|
ref: pillWrapperRef
|
|
4996
4989
|
},
|
|
4997
|
-
|
|
4990
|
+
pillTextContent.length < LABEL_MAX_VISIBLE_LENGTH ? pillText : /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { content: /* @__PURE__ */ React__default.default.createElement("div", { className: styles.tooltipText }, pillTextContent), placement: "top" }, pillText),
|
|
4998
4991
|
!readOnly && !filter.matchAllFilter && (!filter.origin || filter.origin === "dashboard") ? /* @__PURE__ */ React__default.default.createElement(
|
|
4999
4992
|
ui.IconButton,
|
|
5000
4993
|
{
|
|
@@ -5025,8 +5018,9 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
|
5025
5018
|
tooltip: `Remove filter with key ${keyLabel}`
|
|
5026
5019
|
}
|
|
5027
5020
|
) : null,
|
|
5028
|
-
filter.origin &&
|
|
5029
|
-
filter.origin && filter.restorable && /* @__PURE__ */ React__default.default.createElement(
|
|
5021
|
+
filter.origin && filter.readOnly && /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { content: `${filter.origin} managed filter`, placement: "bottom" }, /* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "lock", size: "md", className: styles.readOnlyPillIcon })),
|
|
5022
|
+
filter.origin && !filter.restorable && !filter.readOnly && /* @__PURE__ */ React__default.default.createElement(ui.Tooltip, { content: `This is a ${filter.origin} injected filter`, placement: "bottom" }, /* @__PURE__ */ React__default.default.createElement(ui.Icon, { name: "info-circle", size: "md", className: styles.infoPillIcon })),
|
|
5023
|
+
filter.origin && filter.restorable && !filter.readOnly && /* @__PURE__ */ React__default.default.createElement(
|
|
5030
5024
|
ui.IconButton,
|
|
5031
5025
|
{
|
|
5032
5026
|
onClick: (e) => {
|
|
@@ -5043,7 +5037,7 @@ function AdHocFilterPill({ filter, model, readOnly, focusOnWipInputRef }) {
|
|
|
5043
5037
|
name: "history",
|
|
5044
5038
|
size: "md",
|
|
5045
5039
|
className: isMatchAllFilter(filter) ? styles.matchAllPillIcon : styles.pillIcon,
|
|
5046
|
-
tooltip:
|
|
5040
|
+
tooltip: `Restore filter to its original value`
|
|
5047
5041
|
}
|
|
5048
5042
|
)
|
|
5049
5043
|
);
|
|
@@ -5085,6 +5079,13 @@ const getStyles$b = (theme) => ({
|
|
|
5085
5079
|
background: theme.colors.action.selected
|
|
5086
5080
|
}
|
|
5087
5081
|
}),
|
|
5082
|
+
filterReadOnly: css.css({
|
|
5083
|
+
background: theme.colors.background.canvas,
|
|
5084
|
+
cursor: "text",
|
|
5085
|
+
"&:hover": {
|
|
5086
|
+
background: theme.colors.background.canvas
|
|
5087
|
+
}
|
|
5088
|
+
}),
|
|
5088
5089
|
pillIcon: css.css({
|
|
5089
5090
|
marginInline: theme.spacing(0.5),
|
|
5090
5091
|
cursor: "pointer",
|
|
@@ -5105,6 +5106,9 @@ const getStyles$b = (theme) => ({
|
|
|
5105
5106
|
marginInline: theme.spacing(0.5),
|
|
5106
5107
|
cursor: "pointer"
|
|
5107
5108
|
}),
|
|
5109
|
+
readOnlyPillIcon: css.css({
|
|
5110
|
+
marginInline: theme.spacing(0.5)
|
|
5111
|
+
}),
|
|
5108
5112
|
matchAllPillIcon: css.css({
|
|
5109
5113
|
marginInline: theme.spacing(0.5),
|
|
5110
5114
|
cursor: "pointer",
|
|
@@ -5526,7 +5530,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5526
5530
|
}
|
|
5527
5531
|
this.setState({
|
|
5528
5532
|
filters: this.state.filters.reduce((acc, f, index) => {
|
|
5529
|
-
if (index === filterToForceIndex) {
|
|
5533
|
+
if (index === filterToForceIndex && !f.readOnly) {
|
|
5530
5534
|
return [
|
|
5531
5535
|
...acc,
|
|
5532
5536
|
{
|
|
@@ -5548,7 +5552,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5548
5552
|
}
|
|
5549
5553
|
this.setState({
|
|
5550
5554
|
baseFilters: this.state.baseFilters.reduce((acc, f, index) => {
|
|
5551
|
-
if (index === filterToForceIndex) {
|
|
5555
|
+
if (index === filterToForceIndex && !f.readOnly) {
|
|
5552
5556
|
return [
|
|
5553
5557
|
...acc,
|
|
5554
5558
|
{
|