@mastra/playground-ui 29.0.0-alpha.10 → 29.0.0-alpha.11

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @mastra/playground-ui
2
2
 
3
+ ## 29.0.0-alpha.11
4
+
5
+ ### Minor Changes
6
+
7
+ - Added a custom date range option to the Metrics page date picker. You can now filter metrics by an arbitrary start and end date and time, matching the Traces page, alongside the existing relative presets (last 24 hours, 3, 7, 14, and 30 days). ([#16832](https://github.com/mastra-ai/mastra/pull/16832))
8
+
9
+ The selected range is reflected in the URL so it can be bookmarked or shared:
10
+
11
+ ```txt
12
+ /metrics?period=custom&dateFrom=2026-05-01T00:00:00.000Z&dateTo=2026-05-07T23:59:59.999Z
13
+ ```
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`27fd1b7`](https://github.com/mastra-ai/mastra/commit/27fd1b79ac62eb7694f92587eb7d1be05b59be01), [`a702009`](https://github.com/mastra-ai/mastra/commit/a702009d3cfaa745120f501e21c783ed4d6a3072), [`8534d79`](https://github.com/mastra-ai/mastra/commit/8534d791fa1cb70fe1c19e2604c4b63cc10dd051), [`c78f8cd`](https://github.com/mastra-ai/mastra/commit/c78f8cd6222a86e6c60ae5210b6929ad5221b6fb), [`e146aad`](https://github.com/mastra-ai/mastra/commit/e146aadbba66c410ba0e74bac4c50135495cb8dd), [`1a0ec78`](https://github.com/mastra-ai/mastra/commit/1a0ec789a26cae443744e9abbd62ed6ee676af39), [`d52b6fe`](https://github.com/mastra-ai/mastra/commit/d52b6fe1c56853eb38864baae0bbfa75cc739ccb)]:
18
+ - @mastra/core@1.36.0-alpha.10
19
+ - @mastra/client-js@1.20.0-alpha.10
20
+ - @mastra/react@0.4.0-alpha.10
21
+
3
22
  ## 29.0.0-alpha.10
4
23
 
5
24
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -16783,18 +16783,70 @@ function MetricsProvider({
16783
16783
  return /* @__PURE__ */ jsxRuntime.jsx(MetricsContext.Provider, { value, children });
16784
16784
  }
16785
16785
 
16786
+ const METRICS_PRESETS = [
16787
+ "last-24h",
16788
+ "last-3d",
16789
+ "last-7d",
16790
+ "last-14d",
16791
+ "last-30d",
16792
+ "custom"
16793
+ ];
16794
+ function toPickerPreset(preset) {
16795
+ switch (preset) {
16796
+ case "3d":
16797
+ return "last-3d";
16798
+ case "7d":
16799
+ return "last-7d";
16800
+ case "14d":
16801
+ return "last-14d";
16802
+ case "30d":
16803
+ return "last-30d";
16804
+ case "custom":
16805
+ return "custom";
16806
+ default:
16807
+ return "last-24h";
16808
+ }
16809
+ }
16810
+ function fromPickerPreset(preset) {
16811
+ switch (preset) {
16812
+ case "last-3d":
16813
+ return "3d";
16814
+ case "last-7d":
16815
+ return "7d";
16816
+ case "last-14d":
16817
+ return "14d";
16818
+ case "last-30d":
16819
+ return "30d";
16820
+ case "custom":
16821
+ return "custom";
16822
+ default:
16823
+ return "24h";
16824
+ }
16825
+ }
16786
16826
  function DateRangeSelector() {
16787
- const { datePreset, setDatePreset } = useMetrics();
16827
+ const { datePreset, setDatePreset, customRange, setCustomRange } = useMetrics();
16828
+ const presetRef = React.useRef(datePreset);
16829
+ presetRef.current = datePreset;
16830
+ const customRangeRef = React.useRef(customRange);
16831
+ customRangeRef.current = customRange;
16788
16832
  return /* @__PURE__ */ jsxRuntime.jsx(
16789
- SelectFieldBlock,
16833
+ DateTimeRangePicker,
16790
16834
  {
16791
- name: "date-range",
16792
- labelIsHidden: true,
16793
- value: datePreset,
16794
- options: DATE_PRESETS.map((p) => ({ label: p.label, value: p.value })),
16795
- onValueChange: (value) => {
16796
- if (isValidPreset(value)) setDatePreset(value);
16797
- }
16835
+ preset: toPickerPreset(datePreset),
16836
+ onPresetChange: (next) => {
16837
+ const mapped = fromPickerPreset(next);
16838
+ presetRef.current = mapped;
16839
+ setDatePreset(mapped);
16840
+ },
16841
+ dateFrom: customRange?.from,
16842
+ dateTo: customRange?.to,
16843
+ onDateChange: (value, type) => {
16844
+ if (presetRef.current !== "custom") return;
16845
+ const next = { ...customRangeRef.current, [type]: value };
16846
+ customRangeRef.current = next;
16847
+ setCustomRange(next);
16848
+ },
16849
+ presets: METRICS_PRESETS
16798
16850
  }
16799
16851
  );
16800
16852
  }