@cccsaurora/howler-ui 2.14.0-dev.220 → 2.14.0-dev.223

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.
@@ -19,6 +19,7 @@ const AddNewCard = ({ dashboard, addCard }) => {
19
19
  const fetchViews = useContextSelector(ViewContext, ctx => ctx.fetchViews);
20
20
  const [selectedType, setSelectedType] = useState('');
21
21
  const [analytics, setAnalytics] = useState([]);
22
+ const [analyticsLoading, setAnalyticsLoading] = useState(false);
22
23
  const [config, _setConfig] = useState({});
23
24
  const [viewOpen, setViewOpen] = useState(false);
24
25
  const [viewLoading, setViewLoading] = useState(false);
@@ -33,8 +34,27 @@ const AddNewCard = ({ dashboard, addCard }) => {
33
34
  config: JSON.stringify(config)
34
35
  });
35
36
  }, [addCard, config, selectedType]);
37
+ const fetchAllAnalytics = async () => {
38
+ setAnalyticsLoading(true);
39
+ const batchSize = 150;
40
+ let offset = 0;
41
+ let allAnalytics = [];
42
+ let total = 0;
43
+ do {
44
+ const response = await api.search.analytic.post({
45
+ query: '*:*',
46
+ rows: batchSize,
47
+ offset
48
+ });
49
+ allAnalytics = [...allAnalytics, ...(response.items ?? [])];
50
+ total = response.total ?? 0;
51
+ offset += batchSize;
52
+ } while (offset < total);
53
+ setAnalytics(allAnalytics);
54
+ setAnalyticsLoading(false);
55
+ };
36
56
  useEffect(() => {
37
- api.search.analytic.post({ query: '*:*' }).then(result => setAnalytics(result.items ?? []));
57
+ fetchAllAnalytics();
38
58
  }, []);
39
59
  useEffect(() => {
40
60
  if (selectedType === 'view') {
@@ -56,7 +76,7 @@ const AddNewCard = ({ dashboard, addCard }) => {
56
76
  setViewLoading(false);
57
77
  }
58
78
  }, [fetchViews]);
59
- return (_jsx(Grid, { item: true, xs: 12, md: 6, children: _jsxs(Card, { variant: "outlined", sx: { height: '100%' }, children: [_jsx(CardHeader, { title: t('route.home.add'), subheader: _jsx(Typography, { variant: "body2", color: "text.secondary", children: t('route.home.add.description') }) }), _jsx(CardContent, { children: _jsxs(Stack, { spacing: 1, children: [_jsxs(FormControl, { sx: theme => ({ mt: `${theme.spacing(2)} !important` }), children: [_jsx(InputLabel, { children: t('route.home.add.type') }), _jsx(Select, { value: selectedType, onChange: event => setSelectedType(event.target.value), label: t('route.home.add.type'), children: Object.keys(TYPES).map(type => (_jsx(MenuItem, { value: type, children: _jsxs(Stack, { children: [_jsx(Typography, { variant: "body1", children: t(`route.home.add.type.${type}`) }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: t(`route.home.add.type.${type}.description`) })] }) }, type))) })] }), selectedType && _jsx(Divider, { flexItem: true }), selectedType === 'analytic' && (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "body1", children: t('route.home.add.analytic.title') }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: t('route.home.add.analytic.description') }), _jsx(Autocomplete, { sx: { pt: 1 }, onChange: (__, opt) => setConfig('analyticId', opt.analytic_id), options: analytics, filterOptions: (options, state) => options.filter(opt => opt.name.toLowerCase().includes(state.inputValue.toLowerCase()) ||
79
+ return (_jsx(Grid, { item: true, xs: 12, md: 6, children: _jsxs(Card, { variant: "outlined", sx: { height: '100%' }, children: [_jsx(CardHeader, { title: t('route.home.add'), subheader: _jsx(Typography, { variant: "body2", color: "text.secondary", children: t('route.home.add.description') }) }), _jsx(CardContent, { children: _jsxs(Stack, { spacing: 1, children: [_jsxs(FormControl, { sx: theme => ({ mt: `${theme.spacing(2)} !important` }), children: [_jsx(InputLabel, { children: t('route.home.add.type') }), _jsx(Select, { value: selectedType, onChange: event => setSelectedType(event.target.value), label: t('route.home.add.type'), children: Object.keys(TYPES).map(type => (_jsx(MenuItem, { value: type, children: _jsxs(Stack, { children: [_jsx(Typography, { variant: "body1", children: t(`route.home.add.type.${type}`) }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: t(`route.home.add.type.${type}.description`) })] }) }, type))) })] }), selectedType && _jsx(Divider, { flexItem: true }), selectedType === 'analytic' && (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "body1", children: t('route.home.add.analytic.title') }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: t('route.home.add.analytic.description') }), _jsx(Autocomplete, { sx: { pt: 1 }, onChange: (__, opt) => setConfig('analyticId', opt.analytic_id), loading: analyticsLoading, options: analytics, filterOptions: (options, state) => options.filter(opt => opt.name.toLowerCase().includes(state.inputValue.toLowerCase()) ||
60
80
  opt.description?.split('\n')[0]?.toLowerCase().includes(state.inputValue.toLowerCase())), renderOption: (props, option) => (_createElement("li", { ...props, key: option.analytic_id },
61
81
  _jsxs(Stack, { children: [_jsx(Typography, { variant: "body1", children: option.name }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: option.description?.split('\n')[0] })] }))), getOptionLabel: option => option.name, renderInput: params => _jsx(TextField, { ...params, label: t('route.home.add.analytic') }) }), _jsxs(FormControl, { sx: theme => ({ mt: `${theme.spacing(2)} !important` }), children: [_jsx(InputLabel, { children: t('route.home.add.visualization') }), _jsx(Select, { value: config.type ?? '', onChange: event => setConfig('type', event.target.value), label: t('route.home.add.visualization'), children: VISUALIZATIONS.map(viz => (_jsx(MenuItem, { value: viz, children: _jsxs(Stack, { children: [_jsx(Typography, { variant: "body1", children: t(`route.home.add.visualization.${viz}`) }), _jsx(Typography, { variant: "caption", color: "text.secondary", children: t(`route.home.add.visualization.${viz}.description`) })] }) }, viz))) })] })] })), selectedType === 'view' && (_jsxs(_Fragment, { children: [_jsx(Autocomplete, { sx: { pt: 1 }, onChange: (__, opt) => setConfig('viewId', opt.view_id), onOpen: onViewOpen, onClose: () => setViewOpen(false), open: viewOpen, loading: viewLoading, options: Object.values(views), filterOptions: (options, state) => options.filter(opt => !!opt &&
62
82
  !dashboard?.find(entry => entry.type === 'view' && JSON.parse(entry.config).viewId === opt.view_id) &&
package/package.json CHANGED
@@ -95,7 +95,7 @@
95
95
  "internal-slot": "1.0.7"
96
96
  },
97
97
  "type": "module",
98
- "version": "2.14.0-dev.220",
98
+ "version": "2.14.0-dev.223",
99
99
  "exports": {
100
100
  "./i18n": "./i18n.js",
101
101
  "./index.css": "./index.css",