@cccsaurora/howler-ui 2.17.0-dev.559 → 2.17.0-dev.562

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.
@@ -1,4 +1,4 @@
1
- import { HitLayout } from './HitLayout';
1
+ import type { HitLayout } from './HitLayout';
2
2
  declare const _default: import("react").NamedExoticComponent<{
3
3
  id?: string;
4
4
  layout: HitLayout;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CardContent, Skeleton } from '@mui/material';
3
3
  import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
4
4
  import { memo, useEffect } from 'react';
@@ -6,7 +6,6 @@ import { useContextSelector } from 'use-context-selector';
6
6
  import HowlerCard from '../display/HowlerCard';
7
7
  import HitBanner from './HitBanner';
8
8
  import HitLabels from './HitLabels';
9
- import { HitLayout } from './HitLayout';
10
9
  import HitOutline from './HitOutline';
11
10
  const HitCard = ({ id, layout, readOnly = true }) => {
12
11
  const getHit = useContextSelector(HitContext, ctx => ctx.getHit);
@@ -20,6 +19,6 @@ const HitCard = ({ id, layout, readOnly = true }) => {
20
19
  if (!hit) {
21
20
  return _jsx(Skeleton, { variant: "rounded", height: "200px" });
22
21
  }
23
- return (_jsx(HowlerCard, { tabIndex: 0, sx: { position: 'relative' }, children: _jsxs(CardContent, { children: [_jsx(HitBanner, { hit: hit, layout: layout }), layout !== HitLayout.DENSE && (_jsxs(_Fragment, { children: [_jsx(HitOutline, { hit: hit, layout: layout }), _jsx(HitLabels, { hit: hit, readOnly: readOnly })] }))] }) }));
22
+ return (_jsx(HowlerCard, { tabIndex: 0, sx: { position: 'relative' }, children: _jsxs(CardContent, { children: [_jsx(HitBanner, { hit: hit, layout: layout }), _jsx(HitOutline, { hit: hit, layout: layout }), _jsx(HitLabels, { hit: hit, readOnly: readOnly })] }) }));
24
23
  };
25
24
  export default memo(HitCard);
@@ -12,6 +12,6 @@ const HitLinks = ({ hit, analytic, dossiers = [] }) => {
12
12
  .slice(0, 3)
13
13
  .map(l => (_jsx(Grid, { item: true, children: _jsx(RelatedLink, { compact: true, ...l }) }, l.href))), dossiers.flatMap(_dossier => (_dossier.pivots ?? []).map((_pivot, index) => (
14
14
  // eslint-disable-next-line react/no-array-index-key
15
- _jsx(Grid, { item: true, children: _jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }) }, _dossier.dossier_id + index)))), analytic?.notebooks?.length > 0 && (_jsx(Grid, { item: true, children: _jsx(HitNotebooks, { analytic: analytic, hit: hit }) }))] })));
15
+ _jsx(Grid, { item: true, children: _jsx(PivotLink, { pivot: _pivot, hit: hit, compact: true }) }, _dossier.dossier_id + index)))), analytic?.notebooks?.length > 0 && (_jsx(Grid, { item: true, children: _jsx(HitNotebooks, { analytic: analytic, hit: hit, compact: true }) }))] })));
16
16
  };
17
17
  export default HitLinks;
@@ -4,5 +4,6 @@ declare const _default: import("react").NamedExoticComponent<{
4
4
  analytic: Analytic;
5
5
  selectedNotebook?: string;
6
6
  hit?: Hit;
7
+ compact?: boolean;
7
8
  }>;
8
9
  export default _default;
@@ -20,7 +20,7 @@ const FETCH_OPTIONS = {
20
20
  },
21
21
  mode: 'cors'
22
22
  };
23
- const HitNotebooks = ({ analytic, selectedNotebook, hit }) => {
23
+ const HitNotebooks = ({ analytic, selectedNotebook, hit, compact }) => {
24
24
  const { t } = useTranslation();
25
25
  const { config } = useContext(ApiConfigContext);
26
26
  const { showErrorMessage } = useMySnackbar();
@@ -124,14 +124,18 @@ const HitNotebooks = ({ analytic, selectedNotebook, hit }) => {
124
124
  MenuProps: {
125
125
  style: { zIndex: 35001 }
126
126
  }
127
- }, defaultValue: selectedNotebook ? analytic?.notebooks.find(n => n.name === selectedNotebook).value : '', children: [_jsx(MenuItem, { disabled: true, value: "", children: _jsx("em", { children: t('hit.notebook.select') }) }), analytic?.notebooks.sort(safeStringPropertyCompare('detection')).map(e => (_jsx(MenuItem, { value: e.value, children: _jsxs(Stack, { direction: 'row', sx: { width: '100%' }, children: [e.name, e.detection && (_jsxs(_Fragment, { children: [_jsx(Box, { flex: 1 }), _jsx(Chip, { label: e.detection, size: "small" })] }))] }) }, e.value)))] }), _jsx(Button, { variant: "outlined", disabled: loadedNotebook.name === '' || envs.length === 0, color: "success", onClick: () => checkJupyhub(), children: t('hit.notebook.goTo') })] })] }) })) }), _jsx(HowlerCard, { variant: "elevation", onClick: handleToggle, sx: [
127
+ }, defaultValue: selectedNotebook ? analytic?.notebooks.find(n => n.name === selectedNotebook).value : '', children: [_jsx(MenuItem, { disabled: true, value: "", children: _jsx("em", { children: t('hit.notebook.select') }) }), analytic?.notebooks.sort(safeStringPropertyCompare('detection')).map(e => (_jsx(MenuItem, { value: e.value, children: _jsxs(Stack, { direction: 'row', sx: { width: '100%' }, children: [e.name, e.detection && (_jsxs(_Fragment, { children: [_jsx(Box, { flex: 1 }), _jsx(Chip, { label: e.detection, size: "small" })] }))] }) }, e.value)))] }), _jsx(Button, { variant: "outlined", disabled: loadedNotebook.name === '' || envs.length === 0, color: "success", onClick: () => checkJupyhub(), children: t('hit.notebook.goTo') })] })] }) })) }), _jsx(HowlerCard, { variant: compact ? 'outlined' : 'elevation', onClick: handleToggle, sx: [
128
128
  theme => ({
129
129
  cursor: 'pointer',
130
130
  backgroundColor: 'transparent',
131
131
  transition: theme.transitions.create(['border-color']),
132
- '&:hover': { borderColor: 'primary.main' }
132
+ '&:hover': { borderColor: 'primary.main', '& a': { textDecoration: 'underline' } },
133
+ '& > div': {
134
+ height: '100%'
135
+ },
136
+ '& a': { textDecoration: 'none', color: 'text.primary' }
133
137
  }),
134
- { border: 'thin solid', borderColor: 'transparent' }
138
+ !compact && { border: 'thin solid', borderColor: 'transparent' }
135
139
  ], children: _jsxs(Stack, { direction: "row", p: 1, spacing: 1, alignItems: "center", children: [_jsx(Avatar, { variant: "rounded", src: '/images/jupyter_notebook_file_icon.png', sx: [
136
140
  theme => ({
137
141
  width: theme.spacing(3),
@@ -19,7 +19,7 @@ const HitOutline = ({ hit, layout }) => {
19
19
  hit,
20
20
  layout,
21
21
  template,
22
- fields: template.keys,
22
+ fields: layout === HitLayout.DENSE ? [...template.keys].slice(0, 3) : template.keys,
23
23
  readonly: template.type === 'readonly'
24
24
  });
25
25
  }
@@ -147,7 +147,7 @@ const Home = () => {
147
147
  clearTimeout(debounceTimerRef.current);
148
148
  };
149
149
  }, []);
150
- return (_jsx(PageCenter, { maxWidth: "1800px", textAlign: "left", height: "100%", children: _jsx(ErrorBoundary, { children: _jsxs(Stack, { direction: "column", spacing: 1, sx: { height: '100%' }, children: [_jsxs(Stack, { direction: "row", justifyContent: "end", spacing: 1, children: [isEditing && (_jsx(CustomButton, { variant: "outlined", size: "small", color: "error", startIcon: _jsx(Cancel, {}), onClick: discardChanges, children: t('cancel') })), isEditing && (_jsx(CustomButton, { variant: "outlined", size: "small", disabled: isEqual(dashboard, user.dashboard), color: 'success', startIcon: loading ? _jsx(CircularProgress, { size: 20 }) : _jsx(Check, {}), onClick: saveChanges, children: t('save') })), _jsxs(Box, { sx: { position: 'relative', display: 'inline-flex' }, children: [isRefreshing ? (_jsx(CircularProgress, { variant: "indeterminate" })) : (_jsx(CircularProgress, { variant: "determinate", value: progress })), _jsx(Box, { sx: {
150
+ return (_jsx(PageCenter, { maxWidth: "100%", textAlign: "left", height: "100%", children: _jsx(ErrorBoundary, { children: _jsxs(Stack, { direction: "column", spacing: 1, sx: { height: '100%' }, children: [_jsxs(Stack, { direction: "row", justifyContent: "end", spacing: 1, children: [isEditing && (_jsx(CustomButton, { variant: "outlined", size: "small", color: "error", startIcon: _jsx(Cancel, {}), onClick: discardChanges, children: t('cancel') })), isEditing && (_jsx(CustomButton, { variant: "outlined", size: "small", disabled: isEqual(dashboard, user.dashboard), color: 'success', startIcon: loading ? _jsx(CircularProgress, { size: 20 }) : _jsx(Check, {}), onClick: saveChanges, children: t('save') })), _jsxs(Box, { sx: { position: 'relative', display: 'inline-flex' }, children: [isRefreshing ? (_jsx(CircularProgress, { variant: "indeterminate" })) : (_jsx(CircularProgress, { variant: "determinate", value: progress })), _jsx(Box, { sx: {
151
151
  top: 0,
152
152
  left: 0,
153
153
  bottom: 0,
@@ -156,7 +156,7 @@ const Home = () => {
156
156
  display: 'flex',
157
157
  alignItems: 'center',
158
158
  justifyContent: 'center'
159
- }, children: _jsx(Tooltip, { title: t('refresh'), children: _jsx(IconButton, { onClick: refreshViews, disabled: isRefreshing, color: "primary", children: _jsx(Refresh, {}) }) }) })] }), _jsx(IconButton, { size: "small", color: "primary", onClick: handleOpenSettings, children: _jsx(MoreVert, {}) }), _jsxs(Menu, { id: "settings-menu", anchorEl: openSettings, open: !!openSettings, onClose: () => setOpenSettings(null), children: [_jsxs(MenuItem, { disabled: isEditing, onClick: () => {
159
+ }, children: _jsx(Tooltip, { title: t('refresh'), children: _jsx(IconButton, { onClick: refreshViews, disabled: isRefreshing, color: "primary", children: _jsx(Refresh, {}) }) }) })] }), _jsx(IconButton, { onClick: handleOpenSettings, children: _jsx(MoreVert, {}) }), _jsxs(Menu, { id: "settings-menu", anchorEl: openSettings, open: !!openSettings, onClose: () => setOpenSettings(null), children: [_jsxs(MenuItem, { disabled: isEditing, onClick: () => {
160
160
  setOpenSettings(null);
161
161
  setIsEditing(true);
162
162
  }, children: [_jsx(ListItemIcon, { children: _jsx(Edit, {}) }), t('page.dashboard.settings.edit')] }), _jsx(MenuItem, { disableRipple: true, disableTouchRipple: true, sx: { '&:hover': { bgcolor: 'transparent' }, cursor: 'default' }, children: _jsxs(FormControl, { sx: { px: 2, py: 1, minWidth: 250, pointerEvents: 'auto' }, children: [_jsx(FormLabel, { id: "refresh-rate-label", sx: { mb: 2 }, children: t('page.dashboard.settings.refreshRate') }), _jsx(Slider, { "aria-labelledby": "refresh-rate-label", value: REFRESH_RATES.indexOf(refreshRate), onChange: (_, value) => handleRefreshRateChange(REFRESH_RATES[value]), step: 1, marks: [
package/package.json CHANGED
@@ -101,7 +101,7 @@
101
101
  "internal-slot": "1.0.7"
102
102
  },
103
103
  "type": "module",
104
- "version": "2.17.0-dev.559",
104
+ "version": "2.17.0-dev.562",
105
105
  "exports": {
106
106
  "./i18n": "./i18n.js",
107
107
  "./index.css": "./index.css",