@cccsaurora/howler-ui 3.0.3-dev.1436 → 3.0.4-dev.1443

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.
@@ -15,6 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import { Link, useNavigate } from 'react-router-dom';
16
16
  import { useContextSelector } from 'use-context-selector';
17
17
  import { isEvent } from '@cccsaurora/howler-ui/utils/typeUtils';
18
+ import { convertDateToLucene } from '@cccsaurora/howler-ui/utils/utils';
18
19
  import { buildViewUrl } from '@cccsaurora/howler-ui/utils/viewUtils';
19
20
  // Custom hook to select records by IDs with proper memoization
20
21
  const useSelectRecordsByIds = (recordIds) => {
@@ -87,6 +88,8 @@ const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
87
88
  const res = await dispatchApi(api.v2.search.post((view.indexes ?? ['hit']), {
88
89
  query: view.query,
89
90
  rows: limit,
91
+ sort: view.sort,
92
+ filters: view.span ? [`event.created:${convertDateToLucene(view.span)}`] : [],
90
93
  metadata: ['analytic']
91
94
  }));
92
95
  const fetchedRecords = res.items ?? [];
@@ -98,7 +101,7 @@ const ViewCard = ({ viewId, limit, refreshTick, onRefreshComplete }) => {
98
101
  isRefreshing.current = false;
99
102
  onRefreshComplete?.();
100
103
  }
101
- }, [dispatchApi, limit, view?.query, view?.indexes, loadRecords, onRefreshComplete]);
104
+ }, [dispatchApi, limit, view?.query, view?.indexes, view?.sort, view?.span, loadRecords, onRefreshComplete]);
102
105
  const debouncedRefresh = useCallback(() => {
103
106
  if (debounceTimerRef.current) {
104
107
  clearTimeout(debounceTimerRef.current);
@@ -113,6 +113,8 @@ describe('ViewCard', () => {
113
113
  expect(mockSearchPost).toHaveBeenCalledWith(['hit'], {
114
114
  query: mockView.query,
115
115
  rows: 3,
116
+ sort: mockView.sort,
117
+ filters: [`event.created:[now-1M TO now]`],
116
118
  metadata: ['analytic']
117
119
  });
118
120
  });
package/package.json CHANGED
@@ -93,7 +93,7 @@
93
93
  "url": "https://github.com/CybercentreCanada/howler"
94
94
  },
95
95
  "type": "module",
96
- "version": "3.0.3-dev.1436",
96
+ "version": "3.0.4-dev.1443",
97
97
  "exports": {
98
98
  "./i18n": "./i18n.js",
99
99
  "./index.css": "./index.css",