@cccsaurora/howler-ui 2.14.0-dev.210 → 2.14.0-dev.213

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,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { QueryStats, SavedSearch } from '@mui/icons-material';
3
3
  import { useAppLeftNav, useAppUser } from '@cccsaurora/howler-ui/commons/components/app/hooks';
4
- import { uniq } from 'lodash-es';
4
+ import { sortBy, uniq } from 'lodash-es';
5
5
  import { createContext, useCallback, useContext, useEffect } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useContextSelector } from 'use-context-selector';
@@ -30,7 +30,7 @@ const FavouriteProvider = ({ children }) => {
30
30
  return viewElement;
31
31
  }
32
32
  const savedViews = await fetchViews(favourites);
33
- const items = savedViews
33
+ const items = sortBy(savedViews, 'title')
34
34
  .filter(view => !!view)
35
35
  .map(view => ({
36
36
  id: view.view_id,
@@ -25,14 +25,15 @@ const ViewProvider = ({ children }) => {
25
25
  }));
26
26
  return newViews;
27
27
  }
28
- const missingIds = ids.filter(_id => !views[_id]);
28
+ const missingIds = ids.filter(_id => !has(views, _id));
29
29
  if (missingIds.length < 1) {
30
30
  return ids.map(id => views[id]);
31
31
  }
32
32
  try {
33
33
  const response = await dispatchApi(api.search.view.post({
34
34
  query: `view_id:(${missingIds.join(' OR ')})`,
35
- rows: missingIds.length
35
+ rows: missingIds.length,
36
+ sort: 'title asc'
36
37
  }));
37
38
  const newViews = Object.fromEntries(response.items.map(_view => [_view.view_id, _view]));
38
39
  setViews(_views => ({
@@ -95,17 +95,29 @@ describe('ViewContext', () => {
95
95
  it('Should search for specified views when ids are provided', async () => {
96
96
  const result = await act(async () => hook.result.current(['searched_view_id']));
97
97
  expect(hpost).toHaveBeenCalledOnce();
98
- expect(hpost).toBeCalledWith('/api/v1/search/view', { query: 'view_id:(searched_view_id)', rows: 1 });
98
+ expect(hpost).toBeCalledWith('/api/v1/search/view', {
99
+ query: 'view_id:(searched_view_id)',
100
+ rows: 1,
101
+ sort: 'title asc'
102
+ });
99
103
  expect(result).toEqual(MOCK_RESPONSES['/api/v1/search/view'].items);
100
104
  });
101
105
  it('Should search only for new views when ids are provided', async () => {
102
106
  await act(async () => hook.result.current(['searched_view_id']));
103
107
  expect(hpost).toHaveBeenCalledOnce();
104
- expect(hpost).toBeCalledWith('/api/v1/search/view', { query: 'view_id:(searched_view_id)', rows: 1 });
108
+ expect(hpost).toBeCalledWith('/api/v1/search/view', {
109
+ query: 'view_id:(searched_view_id)',
110
+ rows: 1,
111
+ sort: 'title asc'
112
+ });
105
113
  vi.mocked(hpost).mockClear();
106
114
  await act(async () => hook.result.current(['searched_view_id', 'searched_view_id_2']));
107
115
  expect(hpost).toHaveBeenCalledOnce();
108
- expect(hpost).toBeCalledWith('/api/v1/search/view', { query: 'view_id:(searched_view_id_2)', rows: 1 });
116
+ expect(hpost).toBeCalledWith('/api/v1/search/view', {
117
+ query: 'view_id:(searched_view_id_2)',
118
+ rows: 1,
119
+ sort: 'title asc'
120
+ });
109
121
  });
110
122
  it('Should provide cached instances as a response when the same views are requested', async () => {
111
123
  let result = await act(async () => hook.result.current(['searched_view_id']));
@@ -59,8 +59,8 @@ export const language = {
59
59
  'join',
60
60
  'fetch',
61
61
  'upper',
62
- 'lower',
63
- 'borealis'
62
+ 'lower'
63
+ // TODO: Handle plugin-based operators as well
64
64
  ],
65
65
  // CCCS MODIFICATION END
66
66
  tokenizer: {
@@ -620,7 +620,7 @@
620
620
  "route.dossiers.manager.pivot.label.en": "English Title",
621
621
  "route.dossiers.manager.pivot.label.fr": "Titre français",
622
622
  "route.dossiers.manager.pivot.format": "Pivot format",
623
- "route.dossiers.manager.pivot.value": "Pivot value (templatable url or borealis action ID)",
623
+ "route.dossiers.manager.pivot.value": "Pivot value",
624
624
  "route.dossiers.manager.pivot.mappings": "Pivot Mappings",
625
625
  "route.dossiers.manager.pivot.mapping.key": "Key",
626
626
  "route.dossiers.manager.pivot.mapping.field": "Hit Field",
@@ -115,7 +115,6 @@ export interface APIConfiguration {
115
115
  };
116
116
  mapping: APIMappings;
117
117
  features: {
118
- borealis: boolean;
119
118
  notebook: boolean;
120
119
  [feature: string]: boolean;
121
120
  };
package/package.json CHANGED
@@ -29,7 +29,6 @@
29
29
  "ajv-i18n": "^4.2.0",
30
30
  "axios": "^1.12.0",
31
31
  "axios-retry": "^3.9.1",
32
- "borealis-ui": "0.11.0",
33
32
  "chart.js": "^4.5.0",
34
33
  "chartjs-adapter-dayjs-4": "^1.0.4",
35
34
  "chartjs-plugin-zoom": "^2.2.0",
@@ -96,164 +95,160 @@
96
95
  "internal-slot": "1.0.7"
97
96
  },
98
97
  "type": "module",
99
- "version": "2.14.0-dev.210",
98
+ "version": "2.14.0-dev.213",
100
99
  "exports": {
101
100
  "./i18n": "./i18n.js",
102
101
  "./index.css": "./index.css",
103
- "./utils/*": "./utils/*.js",
104
- "./utils/*.json": "./utils/*.json",
105
- "./locales/*.json": "./locales/*.json",
106
- "./commons/*": "./commons/*.js",
107
102
  "./api/*": "./api/*.js",
108
103
  "./api": "./api/index.js",
109
- "./tests/*": "./tests/*.js",
110
- "./plugins/*": "./plugins/*.js",
104
+ "./models/*": "./models/*.js",
105
+ "./locales/*.json": "./locales/*.json",
111
106
  "./branding/*": "./branding/*.js",
112
- "./components/*": "./components/*.js",
107
+ "./utils/*": "./utils/*.js",
108
+ "./utils/*.json": "./utils/*.json",
113
109
  "./rest/*": "./rest/*.js",
114
110
  "./rest": "./rest/index.js",
115
- "./models/*": "./models/*.js",
116
- "./locales/fr/*.json": "./locales/fr/*.json",
117
- "./locales/en/*.json": "./locales/en/*.json",
118
- "./locales/fr/help/*.json": "./locales/fr/help/*.json",
119
- "./locales/en/help/*.json": "./locales/en/help/*.json",
120
- "./commons/components/*": "./commons/components/*.js",
121
- "./commons/components/utils/*": "./commons/components/utils/*.js",
122
- "./commons/components/topnav/*": "./commons/components/topnav/*.js",
123
- "./commons/components/app/*": "./commons/components/app/*.js",
124
- "./commons/components/display/*": "./commons/components/display/*.js",
125
- "./commons/components/breadcrumbs/*": "./commons/components/breadcrumbs/*.js",
126
- "./commons/components/search/*": "./commons/components/search/*.js",
127
- "./commons/components/pages/*": "./commons/components/pages/*.js",
128
- "./commons/components/notification/*": "./commons/components/notification/*.js",
129
- "./commons/components/notification": "./commons/components/notification/index.js",
130
- "./commons/components/leftnav/*": "./commons/components/leftnav/*.js",
131
- "./commons/components/utils/hooks/*": "./commons/components/utils/hooks/*.js",
132
- "./commons/components/app/providers/*": "./commons/components/app/providers/*.js",
133
- "./commons/components/app/hooks/*": "./commons/components/app/hooks/*.js",
134
- "./commons/components/app/hooks": "./commons/components/app/hooks/index.js",
135
- "./commons/components/display/hooks/*": "./commons/components/display/hooks/*.js",
136
- "./commons/components/pages/hooks/*": "./commons/components/pages/hooks/*.js",
137
- "./commons/components/notification/elements/*": "./commons/components/notification/elements/*.js",
138
- "./commons/components/notification/elements/item/*": "./commons/components/notification/elements/item/*.js",
111
+ "./components/*": "./components/*.js",
112
+ "./commons/*": "./commons/*.js",
113
+ "./plugins/*": "./plugins/*.js",
114
+ "./tests/*": "./tests/*.js",
115
+ "./api/analytic/*": "./api/analytic/*.js",
116
+ "./api/analytic": "./api/analytic/index.js",
139
117
  "./api/template/*": "./api/template/*.js",
140
118
  "./api/template": "./api/template/index.js",
141
- "./api/action/*": "./api/action/*.js",
142
- "./api/action": "./api/action/index.js",
143
- "./api/user/*": "./api/user/*.js",
144
- "./api/user": "./api/user/index.js",
145
119
  "./api/hit/*": "./api/hit/*.js",
146
120
  "./api/hit": "./api/hit/index.js",
147
- "./api/configs/*": "./api/configs/*.js",
148
- "./api/configs": "./api/configs/index.js",
121
+ "./api/notebook/*": "./api/notebook/*.js",
122
+ "./api/notebook": "./api/notebook/index.js",
149
123
  "./api/auth/*": "./api/auth/*.js",
150
124
  "./api/auth": "./api/auth/index.js",
151
125
  "./api/search/*": "./api/search/*.js",
152
126
  "./api/search": "./api/search/index.js",
153
- "./api/analytic/*": "./api/analytic/*.js",
154
- "./api/analytic": "./api/analytic/index.js",
155
- "./api/notebook/*": "./api/notebook/*.js",
156
- "./api/notebook": "./api/notebook/index.js",
157
- "./api/view/*": "./api/view/*.js",
158
- "./api/view": "./api/view/index.js",
159
127
  "./api/dossier/*": "./api/dossier/*.js",
160
128
  "./api/dossier": "./api/dossier/index.js",
129
+ "./api/view/*": "./api/view/*.js",
130
+ "./api/view": "./api/view/index.js",
161
131
  "./api/overview/*": "./api/overview/*.js",
162
132
  "./api/overview": "./api/overview/index.js",
163
- "./api/user/avatar/*": "./api/user/avatar/*.js",
164
- "./api/user/avatar": "./api/user/avatar/index.js",
133
+ "./api/user/*": "./api/user/*.js",
134
+ "./api/user": "./api/user/index.js",
135
+ "./api/action/*": "./api/action/*.js",
136
+ "./api/action": "./api/action/index.js",
137
+ "./api/configs/*": "./api/configs/*.js",
138
+ "./api/configs": "./api/configs/index.js",
139
+ "./api/analytic/comments/*": "./api/analytic/comments/*.js",
140
+ "./api/analytic/comments": "./api/analytic/comments/index.js",
141
+ "./api/analytic/notebooks/*": "./api/analytic/notebooks/*.js",
142
+ "./api/analytic/notebooks": "./api/analytic/notebooks/index.js",
165
143
  "./api/hit/comments/*": "./api/hit/comments/*.js",
166
144
  "./api/hit/comments": "./api/hit/comments/index.js",
167
- "./api/search/grouped/*": "./api/search/grouped/*.js",
168
- "./api/search/grouped": "./api/search/grouped/index.js",
169
- "./api/search/fields/*": "./api/search/fields/*.js",
170
- "./api/search/fields": "./api/search/fields/index.js",
171
- "./api/search/eql/*": "./api/search/eql/*.js",
172
145
  "./api/search/facet/*": "./api/search/facet/*.js",
173
146
  "./api/search/facet": "./api/search/facet/index.js",
174
147
  "./api/search/count/*": "./api/search/count/*.js",
175
148
  "./api/search/count": "./api/search/count/index.js",
149
+ "./api/search/fields/*": "./api/search/fields/*.js",
150
+ "./api/search/fields": "./api/search/fields/index.js",
151
+ "./api/search/eql/*": "./api/search/eql/*.js",
152
+ "./api/search/sigma/*": "./api/search/sigma/*.js",
153
+ "./api/search/grouped/*": "./api/search/grouped/*.js",
154
+ "./api/search/grouped": "./api/search/grouped/index.js",
176
155
  "./api/search/histogram/*": "./api/search/histogram/*.js",
177
156
  "./api/search/histogram": "./api/search/histogram/index.js",
178
- "./api/search/sigma/*": "./api/search/sigma/*.js",
179
- "./api/analytic/notebooks/*": "./api/analytic/notebooks/*.js",
180
- "./api/analytic/notebooks": "./api/analytic/notebooks/index.js",
181
- "./api/analytic/comments/*": "./api/analytic/comments/*.js",
182
- "./api/analytic/comments": "./api/analytic/comments/index.js",
183
- "./plugins/borealis/*": "./plugins/borealis/*.js",
184
- "./plugins/borealis": "./plugins/borealis/index.js",
185
- "./plugins/borealis/locales/*": "./plugins/borealis/locales/*.js",
186
- "./plugins/borealis/components/*": "./plugins/borealis/components/*.js",
157
+ "./api/user/avatar/*": "./api/user/avatar/*.js",
158
+ "./api/user/avatar": "./api/user/avatar/index.js",
159
+ "./models/socket/*": "./models/socket/*.js",
160
+ "./models/entities/*": "./models/entities/*.js",
161
+ "./models/entities/generated/*": "./models/entities/generated/*.js",
162
+ "./locales/en/*.json": "./locales/en/*.json",
163
+ "./locales/fr/*.json": "./locales/fr/*.json",
164
+ "./locales/en/help/*.json": "./locales/en/help/*.json",
165
+ "./locales/fr/help/*.json": "./locales/fr/help/*.json",
166
+ "./components/hooks/*": "./components/hooks/*.js",
187
167
  "./components/app/*": "./components/app/*.js",
168
+ "./components/logins/*": "./components/logins/*.js",
188
169
  "./components/elements/*": "./components/elements/*.js",
189
170
  "./components/routes/*": "./components/routes/*.js",
190
- "./components/logins/*": "./components/logins/*.js",
191
- "./components/hooks/*": "./components/hooks/*.js",
192
- "./components/app/providers/*": "./components/app/providers/*.js",
193
171
  "./components/app/hooks/*": "./components/app/hooks/*.js",
172
+ "./components/app/providers/*": "./components/app/providers/*.js",
194
173
  "./components/app/drawers/*": "./components/app/drawers/*.js",
195
- "./components/elements/display/*": "./components/elements/display/*.js",
174
+ "./components/logins/hooks/*": "./components/logins/hooks/*.js",
175
+ "./components/logins/auth/*": "./components/logins/auth/*.js",
176
+ "./components/elements/addons/*": "./components/elements/addons/*.js",
196
177
  "./components/elements/hit/*": "./components/elements/hit/*.js",
197
178
  "./components/elements/view/*": "./components/elements/view/*.js",
198
- "./components/elements/addons/*": "./components/elements/addons/*.js",
199
- "./components/elements/display/markdownPlugins/*.md": "./components/elements/display/markdownPlugins/*.md.js",
200
- "./components/elements/display/modals/*": "./components/elements/display/modals/*.js",
201
- "./components/elements/display/features/*": "./components/elements/display/features/*.js",
202
- "./components/elements/display/icons/*": "./components/elements/display/icons/*.js",
203
- "./components/elements/display/json/*": "./components/elements/display/json/*.js",
204
- "./components/elements/display/handlebars/*": "./components/elements/display/handlebars/*.js",
205
- "./components/elements/display/icons/svg/*": "./components/elements/display/icons/svg/*.js",
206
- "./components/elements/hit/elements/*": "./components/elements/hit/elements/*.js",
207
- "./components/elements/hit/outlines/*": "./components/elements/hit/outlines/*.js",
208
- "./components/elements/hit/related/*": "./components/elements/hit/related/*.js",
209
- "./components/elements/hit/aggregate/*": "./components/elements/hit/aggregate/*.js",
210
- "./components/elements/hit/actions/*": "./components/elements/hit/actions/*.js",
211
- "./components/elements/hit/outlines/al/*": "./components/elements/hit/outlines/al/*.js",
179
+ "./components/elements/display/*": "./components/elements/display/*.js",
212
180
  "./components/elements/addons/buttons/*": "./components/elements/addons/buttons/*.js",
213
181
  "./components/elements/addons/buttons": "./components/elements/addons/buttons/index.js",
214
- "./components/elements/addons/layout/*": "./components/elements/addons/layout/*.js",
215
182
  "./components/elements/addons/search/*": "./components/elements/addons/search/*.js",
183
+ "./components/elements/addons/layout/*": "./components/elements/addons/layout/*.js",
216
184
  "./components/elements/addons/lists/*": "./components/elements/addons/lists/*.js",
217
185
  "./components/elements/addons/lists": "./components/elements/addons/lists/index.js",
218
- "./components/elements/addons/layout/vsbox/*": "./components/elements/addons/layout/vsbox/*.js",
219
186
  "./components/elements/addons/search/phrase/*": "./components/elements/addons/search/phrase/*.js",
220
187
  "./components/elements/addons/search/phrase": "./components/elements/addons/search/phrase/index.js",
221
188
  "./components/elements/addons/search/phrase/word/*": "./components/elements/addons/search/phrase/word/*.js",
222
189
  "./components/elements/addons/search/phrase/word/consumers/*": "./components/elements/addons/search/phrase/word/consumers/*.js",
190
+ "./components/elements/addons/layout/vsbox/*": "./components/elements/addons/layout/vsbox/*.js",
223
191
  "./components/elements/addons/lists/hooks/*": "./components/elements/addons/lists/hooks/*.js",
224
192
  "./components/elements/addons/lists/table/*": "./components/elements/addons/lists/table/*.js",
225
193
  "./components/elements/addons/lists/table": "./components/elements/addons/lists/table/index.js",
226
- "./components/routes/views/*": "./components/routes/views/*.js",
227
- "./components/routes/dossiers/*": "./components/routes/dossiers/*.js",
228
- "./components/routes/action/*": "./components/routes/action/*.js",
194
+ "./components/elements/hit/aggregate/*": "./components/elements/hit/aggregate/*.js",
195
+ "./components/elements/hit/outlines/*": "./components/elements/hit/outlines/*.js",
196
+ "./components/elements/hit/related/*": "./components/elements/hit/related/*.js",
197
+ "./components/elements/hit/elements/*": "./components/elements/hit/elements/*.js",
198
+ "./components/elements/hit/actions/*": "./components/elements/hit/actions/*.js",
199
+ "./components/elements/hit/outlines/al/*": "./components/elements/hit/outlines/al/*.js",
200
+ "./components/elements/display/icons/*": "./components/elements/display/icons/*.js",
201
+ "./components/elements/display/modals/*": "./components/elements/display/modals/*.js",
202
+ "./components/elements/display/markdownPlugins/*.md": "./components/elements/display/markdownPlugins/*.md.js",
203
+ "./components/elements/display/json/*": "./components/elements/display/json/*.js",
204
+ "./components/elements/display/handlebars/*": "./components/elements/display/handlebars/*.js",
205
+ "./components/elements/display/features/*": "./components/elements/display/features/*.js",
206
+ "./components/elements/display/icons/svg/*": "./components/elements/display/icons/svg/*.js",
229
207
  "./components/routes/admin/*": "./components/routes/admin/*.js",
208
+ "./components/routes/dossiers/*": "./components/routes/dossiers/*.js",
209
+ "./components/routes/advanced/*": "./components/routes/advanced/*.js",
230
210
  "./components/routes/hits/*": "./components/routes/hits/*.js",
231
211
  "./components/routes/settings/*": "./components/routes/settings/*.js",
232
212
  "./components/routes/home/*": "./components/routes/home/*.js",
233
213
  "./components/routes/home": "./components/routes/home/index.js",
234
- "./components/routes/overviews/*": "./components/routes/overviews/*.js",
235
- "./components/routes/advanced/*": "./components/routes/advanced/*.js",
236
214
  "./components/routes/analytics/*": "./components/routes/analytics/*.js",
237
- "./components/routes/templates/*": "./components/routes/templates/*.js",
238
215
  "./components/routes/help/*": "./components/routes/help/*.js",
239
- "./components/routes/action/shared/*": "./components/routes/action/shared/*.js",
240
- "./components/routes/action/view/*": "./components/routes/action/view/*.js",
241
- "./components/routes/action/edit/*": "./components/routes/action/edit/*.js",
216
+ "./components/routes/action/*": "./components/routes/action/*.js",
217
+ "./components/routes/views/*": "./components/routes/views/*.js",
218
+ "./components/routes/overviews/*": "./components/routes/overviews/*.js",
219
+ "./components/routes/templates/*": "./components/routes/templates/*.js",
242
220
  "./components/routes/admin/users/*": "./components/routes/admin/users/*.js",
243
221
  "./components/routes/hits/search/*": "./components/routes/hits/search/*.js",
244
222
  "./components/routes/hits/view/*": "./components/routes/hits/view/*.js",
245
- "./components/routes/hits/search/shared/*": "./components/routes/hits/search/shared/*.js",
246
223
  "./components/routes/hits/search/grid/*": "./components/routes/hits/search/grid/*.js",
247
- "./components/routes/overviews/template/*": "./components/routes/overviews/template/*.js",
224
+ "./components/routes/hits/search/shared/*": "./components/routes/hits/search/shared/*.js",
248
225
  "./components/routes/analytics/widgets/*": "./components/routes/analytics/widgets/*.js",
249
- "./components/routes/help/markdown/*.md": "./components/routes/help/markdown/*.md.js",
250
226
  "./components/routes/help/components/*": "./components/routes/help/components/*.js",
251
- "./components/routes/help/markdown/fr/*.md": "./components/routes/help/markdown/fr/*.md.js",
227
+ "./components/routes/help/markdown/*.md": "./components/routes/help/markdown/*.md.js",
252
228
  "./components/routes/help/markdown/en/*.md": "./components/routes/help/markdown/en/*.md.js",
253
- "./components/logins/auth/*": "./components/logins/auth/*.js",
254
- "./components/logins/hooks/*": "./components/logins/hooks/*.js",
255
- "./models/entities/*": "./models/entities/*.js",
256
- "./models/socket/*": "./models/socket/*.js",
257
- "./models/entities/generated/*": "./models/entities/generated/*.js"
229
+ "./components/routes/help/markdown/fr/*.md": "./components/routes/help/markdown/fr/*.md.js",
230
+ "./components/routes/action/view/*": "./components/routes/action/view/*.js",
231
+ "./components/routes/action/shared/*": "./components/routes/action/shared/*.js",
232
+ "./components/routes/action/edit/*": "./components/routes/action/edit/*.js",
233
+ "./components/routes/overviews/template/*": "./components/routes/overviews/template/*.js",
234
+ "./commons/components/*": "./commons/components/*.js",
235
+ "./commons/components/utils/*": "./commons/components/utils/*.js",
236
+ "./commons/components/leftnav/*": "./commons/components/leftnav/*.js",
237
+ "./commons/components/pages/*": "./commons/components/pages/*.js",
238
+ "./commons/components/topnav/*": "./commons/components/topnav/*.js",
239
+ "./commons/components/app/*": "./commons/components/app/*.js",
240
+ "./commons/components/search/*": "./commons/components/search/*.js",
241
+ "./commons/components/breadcrumbs/*": "./commons/components/breadcrumbs/*.js",
242
+ "./commons/components/display/*": "./commons/components/display/*.js",
243
+ "./commons/components/notification/*": "./commons/components/notification/*.js",
244
+ "./commons/components/notification": "./commons/components/notification/index.js",
245
+ "./commons/components/utils/hooks/*": "./commons/components/utils/hooks/*.js",
246
+ "./commons/components/pages/hooks/*": "./commons/components/pages/hooks/*.js",
247
+ "./commons/components/app/hooks/*": "./commons/components/app/hooks/*.js",
248
+ "./commons/components/app/hooks": "./commons/components/app/hooks/index.js",
249
+ "./commons/components/app/providers/*": "./commons/components/app/providers/*.js",
250
+ "./commons/components/display/hooks/*": "./commons/components/display/hooks/*.js",
251
+ "./commons/components/notification/elements/*": "./commons/components/notification/elements/*.js",
252
+ "./commons/components/notification/elements/item/*": "./commons/components/notification/elements/item/*.js"
258
253
  }
259
254
  }
@@ -1,3 +0,0 @@
1
- import { type PropsWithChildren } from 'react';
2
- declare const Provider: React.FC<PropsWithChildren<{}>>;
3
- export default Provider;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BorealisProvider } from 'borealis-ui/dist/hooks/BorealisProvider';
3
- import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
4
- import { useContext } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { StorageKey } from '@cccsaurora/howler-ui/utils/constants';
7
- import { getStored } from '@cccsaurora/howler-ui/utils/localStorage';
8
- const Provider = ({ children }) => {
9
- const apiConfig = useContext(ApiConfigContext);
10
- return (_jsx(BorealisProvider, { baseURL: location.origin + '/api/v1/borealis', getToken: () => getStored(StorageKey.APP_TOKEN), enabled: apiConfig.config?.configuration?.features?.borealis, publicIconify: false, customIconify: location.origin.includes('localhost')
11
- ? 'https://icons.dev.analysis.cyber.gc.ca'
12
- : location.origin.replace(/howler(-stg)?/, 'icons'), defaultTimeout: 5, i18next: useTranslation('borealis'), chunkSize: 50, children: children }));
13
- };
14
- export default Provider;
@@ -1,3 +0,0 @@
1
- import type { PluginChipProps } from '@cccsaurora/howler-ui/components/elements/PluginChip';
2
- declare const _default: import("react").NamedExoticComponent<PluginChipProps>;
3
- export default _default;
@@ -1,27 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Chip } from '@mui/material';
3
- import { EnrichedChip, useBorealisEnrichSelector } from 'borealis-ui';
4
- import { memo } from 'react';
5
- const BorealisChip = ({ children, value, context, ...props }) => {
6
- const guessType = useBorealisEnrichSelector(ctx => ctx.guessType);
7
- const type = guessType(value);
8
- if (!type) {
9
- return _jsx(Chip, { ...props, children: children });
10
- }
11
- let enrichedProps = {
12
- ...props,
13
- value
14
- };
15
- delete enrichedProps.label;
16
- if (context === 'summary') {
17
- enrichedProps = {
18
- ...enrichedProps,
19
- sx: [
20
- ...(Array.isArray(enrichedProps.sx) ? enrichedProps.sx : [enrichedProps.sx]),
21
- [{ height: '24px', '& .iconify': { fontSize: '1em' } }]
22
- ]
23
- };
24
- }
25
- return _jsx(EnrichedChip, { ...enrichedProps, type: type });
26
- };
27
- export default memo(BorealisChip);
@@ -1,4 +0,0 @@
1
- import type { LeadFormProps } from '@cccsaurora/howler-ui/components/routes/dossiers/LeadEditor';
2
- import { type FC } from 'react';
3
- declare const BorealisLeadForm: FC<LeadFormProps>;
4
- export default BorealisLeadForm;
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Autocomplete, Divider, ListItemText, TextField, Typography } from '@mui/material';
3
- import { useBorealisEnrichSelector, useBorealisFetcherSelector } from 'borealis-ui';
4
- import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
5
- import { useContext, useState } from 'react';
6
- import { useTranslation } from 'react-i18next';
7
- const BorealisLeadForm = ({ lead, metadata, update, updateMetadata }) => {
8
- const { t } = useTranslation();
9
- const { config } = useContext(ApiConfigContext);
10
- const fetchers = useBorealisFetcherSelector(ctx => ctx.fetchers);
11
- const types = useBorealisEnrichSelector(ctx => ctx.typesDetection);
12
- const [showCustom, setShowCustom] = useState(false);
13
- return (_jsxs(_Fragment, { children: [_jsx(Divider, { orientation: "horizontal" }), _jsx(Autocomplete, { disabled: !lead, options: Object.keys(fetchers), renderInput: params => _jsx(TextField, { ...params, size: "small", label: t('route.dossiers.manager.borealis') }), value: Object.keys(fetchers).includes(lead?.content) ? lead.content : '', onChange: (_ev, content) => update({ content, metadata: '{}' }), renderOption: (props, option) => (_jsx(ListItemText, { ...props, sx: { flexDirection: 'column', alignItems: 'start !important' }, primary: _jsx("code", { children: option }), secondary: fetchers[option].description })) }), _jsx(Autocomplete, { options: Object.keys(types), renderInput: params => _jsx(TextField, { ...params, size: "small", label: t('route.dossiers.manager.borealis.type') }), value: metadata?.type ?? '', onChange: (_ev, type) => updateMetadata({ type }) }), _jsx(Autocomplete, { options: ['custom', ...Object.keys(config.indexes.hit)], disabled: !metadata?.type || !types[metadata.type], renderInput: params => (_jsx(TextField, { ...params, size: "small", label: t('route.dossiers.manager.borealis.value') })), getOptionLabel: opt => t(opt), value: metadata?.value ?? '', onChange: (_ev, value) => {
14
- if (value === 'custom') {
15
- setShowCustom(true);
16
- }
17
- else {
18
- setShowCustom(false);
19
- updateMetadata({ value });
20
- }
21
- } }), showCustom && (_jsxs(_Fragment, { children: [_jsx(TextField, { size: "small", label: t('route.dossiers.manager.borealis.value.custom'), value: metadata?.value ?? '', disabled: !metadata?.type || !types[metadata.type], fullWidth: true, onChange: ev => updateMetadata({ value: ev.target.value }) }), _jsx(Typography, { variant: "caption", color: "text.secondary", sx: { mt: '0 !important' }, children: t('route.dossiers.manager.borealis.value.description') })] }))] }));
22
- };
23
- export default BorealisLeadForm;
@@ -1,3 +0,0 @@
1
- import type { PivotLinkProps } from '@cccsaurora/howler-ui/components/elements/hit/related/PivotLink';
2
- declare const _default: import("react").NamedExoticComponent<PivotLinkProps>;
3
- export default _default;
@@ -1,83 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Icon } from '@iconify/react/dist/iconify.js';
3
- import { Settings } from '@mui/icons-material';
4
- import { Divider, IconButton, Stack, Typography } from '@mui/material';
5
- import { useBorealisActionsSelector, useBorealisEnrichSelector } from 'borealis-ui';
6
- import HowlerCard from '@cccsaurora/howler-ui/components/elements/display/HowlerCard';
7
- import useMySnackbar from '@cccsaurora/howler-ui/components/hooks/useMySnackbar';
8
- import { get } from 'lodash-es';
9
- import { memo, useCallback, useState } from 'react';
10
- import { useTranslation } from 'react-i18next';
11
- const BorealisPivot = ({ pivot, hit, compact }) => {
12
- const guessType = useBorealisEnrichSelector(ctx => ctx?.guessType);
13
- const { showErrorMessage } = useMySnackbar();
14
- const { i18n, t } = useTranslation();
15
- const actions = useBorealisActionsSelector(ctx => ctx?.availableActions ?? {});
16
- const executeAction = useBorealisActionsSelector(ctx => ctx?.executeAction);
17
- const [loading, setLoading] = useState(false);
18
- const onBorealisClick = useCallback(async (event, forceMenu = false) => {
19
- event.preventDefault();
20
- event.stopPropagation();
21
- if (loading) {
22
- return;
23
- }
24
- if (!actions[pivot.value]) {
25
- showErrorMessage(t('pivot.borealis.missing'));
26
- return;
27
- }
28
- setLoading(true);
29
- const data = Object.fromEntries(pivot.mappings.map(_mapping => {
30
- const value = _mapping.field !== 'custom' ? get(hit, _mapping.field) : _mapping.custom_value;
31
- if (['selector', 'selectors'].includes(_mapping.key)) {
32
- if (Array.isArray(value)) {
33
- return [
34
- _mapping.key,
35
- value.map(val => ({
36
- // TODO: Use the mapped borealis values here eventually
37
- type: guessType(val),
38
- value: val
39
- }))
40
- ];
41
- }
42
- return [
43
- _mapping.key,
44
- {
45
- // TODO: Use the mapped borealis values here eventually
46
- type: guessType(value),
47
- value
48
- }
49
- ];
50
- }
51
- return [_mapping.key, value];
52
- }));
53
- const selectors = (actions[pivot.value].accept_multiple ? [data.selectors] : [data.selector]).flat();
54
- delete data.selector;
55
- delete data.selectors;
56
- try {
57
- await executeAction(pivot.value, selectors, data, { forceMenu });
58
- }
59
- finally {
60
- setLoading(false);
61
- }
62
- }, [actions, executeAction, guessType, hit, loading, pivot.mappings, pivot.value, showErrorMessage, t]);
63
- if (!actions[pivot.value]) {
64
- return;
65
- }
66
- return (_jsx(HowlerCard, { variant: compact ? 'outlined' : 'elevation', onClick: e => onBorealisClick(e), sx: [
67
- theme => ({
68
- backgroundColor: 'transparent',
69
- transition: theme.transitions.create(['border-color']),
70
- '&:hover': { borderColor: 'primary.main' },
71
- '& > div': {
72
- height: '100%'
73
- }
74
- }),
75
- loading
76
- ? { opacity: 0.5, pointerEvents: 'none' }
77
- : {
78
- cursor: 'pointer'
79
- },
80
- !compact && { border: 'thin solid', borderColor: 'transparent' }
81
- ], children: _jsxs(Stack, { direction: "row", p: compact ? 0.5 : 1, spacing: 1, alignItems: "center", children: [_jsx(Icon, { fontSize: "1.5rem", icon: pivot.icon }), _jsx(Typography, { children: pivot.label[i18n.language] }), _jsx(Divider, { orientation: "vertical", flexItem: true }), _jsx(IconButton, { size: "small", onClick: e => onBorealisClick(e, true), children: _jsx(Settings, { fontSize: "small" }) })] }) }));
82
- };
83
- export default memo(BorealisPivot);
@@ -1,4 +0,0 @@
1
- import type { PivotFormProps } from '@cccsaurora/howler-ui/components/routes/dossiers/PivotForm';
2
- import { type FC } from 'react';
3
- declare const BorealisPivotForm: FC<PivotFormProps>;
4
- export default BorealisPivotForm;
@@ -1,44 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Autocomplete, Divider, Stack, TextField, Typography, useTheme } from '@mui/material';
3
- import { useBorealisActionsSelector } from 'borealis-ui';
4
- import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
5
- import { Fragment, useContext } from 'react';
6
- import { useTranslation } from 'react-i18next';
7
- const BorealisPivotForm = ({ pivot, update }) => {
8
- const theme = useTheme();
9
- const { t } = useTranslation();
10
- const { config } = useContext(ApiConfigContext);
11
- const actions = useBorealisActionsSelector(ctx => ctx?.availableActions);
12
- return (_jsxs(_Fragment, { children: [_jsx(Autocomplete, { fullWidth: true, disabled: !pivot, options: Object.entries(actions)
13
- .filter(([_key, definition]) => !!definition && definition.format == 'pivot')
14
- .map(([key]) => key), renderOption: ({ key, ...optionProps }, actionId) => {
15
- const definition = actions[actionId];
16
- return (_jsxs(Stack, { component: "li", ...optionProps, spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "start", alignItems: "center", children: [_jsx(Typography, { children: definition.name }), _jsx("pre", { style: {
17
- fontSize: '0.85rem',
18
- border: `thin solid ${theme.palette.divider}`,
19
- padding: theme.spacing(0.5),
20
- borderRadius: theme.shape.borderRadius
21
- }, children: actionId })] }), _jsx(Typography, { variant: "body2", color: "text.secondary", alignSelf: "start", children: definition.summary })] }, key));
22
- }, getOptionLabel: opt => actions[opt]?.name ?? '', renderInput: params => (_jsx(TextField, { ...params, size: "small", fullWidth: true, label: t('route.dossiers.manager.pivot.value') })), value: pivot?.value ?? '', onChange: (_ev, value) => update({
23
- value,
24
- mappings: [
25
- { key: actions[value].accept_multiple ? 'selectors' : 'selector', field: 'howler.id' },
26
- ...Object.entries(actions[value].params?.properties ?? [])
27
- .filter(([property]) => !['selector', 'selectors'].includes(property))
28
- .map(([prop, schema]) => ({
29
- key: prop,
30
- field: typeof schema === 'boolean' || !schema.default ? null : 'custom',
31
- custom_value: typeof schema !== 'boolean' && !!schema.default ? schema.default.toString() : null
32
- }))
33
- ]
34
- }) }), _jsx(Divider, { flexItem: true }), _jsx(Typography, { children: t('route.dossiers.manager.pivot.mappings') }), pivot?.mappings?.map((_mapping, index) => (
35
- // eslint-disable-next-line react/no-array-index-key
36
- _jsxs(Fragment, { children: [_jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(TextField, { size: "small", label: t('route.dossiers.manager.pivot.mapping.key'), disabled: !pivot, value: _mapping?.key ?? '', onChange: ev => update({
37
- mappings: pivot.mappings.map((_m, _index) => index === _index ? { ..._m, key: ev.target.value } : _m)
38
- }) }), _jsx(Autocomplete, { fullWidth: true, disabled: !pivot, options: ['custom', 'unset', ...Object.keys(config.indexes.hit)], renderInput: params => (_jsx(TextField, { ...params, size: "small", fullWidth: true, label: t('route.dossiers.manager.pivot.mapping.field'), sx: { minWidth: '150px' } })), getOptionLabel: opt => t(opt), value: _mapping.field ?? '', onChange: (_ev, field) => update({
39
- mappings: pivot.mappings.map((_m, _index) => (index === _index ? { ..._m, field } : _m))
40
- }) })] }), _mapping.field === 'custom' && (_jsx(TextField, { size: "small", label: t('route.dossiers.manager.pivot.mapping.custom'), disabled: !pivot, value: _mapping?.custom_value ?? '', onChange: ev => update({
41
- mappings: pivot.mappings.map((_m, _index) => index === _index ? { ..._m, custom_value: ev.target.value } : _m)
42
- }) }))] }, index)))] }));
43
- };
44
- export default BorealisPivotForm;
@@ -1,3 +0,0 @@
1
- import type { PluginTypographyProps } from '@cccsaurora/howler-ui/components/elements/PluginTypography';
2
- declare const _default: import("react").NamedExoticComponent<PluginTypographyProps>;
3
- export default _default;
@@ -1,55 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Typography } from '@mui/material';
3
- import { EnrichedTypography, useBorealisEnrichSelector } from 'borealis-ui';
4
- import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
5
- import { memo, useContext } from 'react';
6
- const BorealisTypography = ({ children, value, context, ...props }) => {
7
- const guessType = useBorealisEnrichSelector(ctx => ctx.guessType);
8
- const { config } = useContext(ApiConfigContext);
9
- const type = config?.configuration?.mapping?.[value] ?? guessType(value);
10
- if (!type) {
11
- return _jsx(Typography, { ...props, children: children });
12
- }
13
- let enrichedProps = {
14
- ...props,
15
- value
16
- };
17
- if (context === 'banner') {
18
- enrichedProps = {
19
- ...enrichedProps,
20
- slotProps: { stack: { component: 'span' } }
21
- };
22
- }
23
- else if (context === 'outline') {
24
- enrichedProps = {
25
- ...enrichedProps,
26
- hideLoading: true,
27
- slotProps: {
28
- stack: {
29
- sx: { mr: 'auto' },
30
- onClick: e => {
31
- e.preventDefault();
32
- e.stopPropagation();
33
- }
34
- },
35
- popover: {
36
- onClick: e => {
37
- e.preventDefault();
38
- e.stopPropagation();
39
- }
40
- }
41
- }
42
- };
43
- }
44
- else if (context === 'table') {
45
- enrichedProps = {
46
- ...enrichedProps,
47
- hideLoading: true,
48
- slotProps: {
49
- stack: { sx: { width: '100%', '& > p': { textOverflow: 'ellipsis', overflow: 'hidden' } } }
50
- }
51
- };
52
- }
53
- return _jsx(EnrichedTypography, { ...enrichedProps, type: type });
54
- };
55
- export default memo(BorealisTypography);
@@ -1,3 +0,0 @@
1
- import type { HowlerHelper } from '@cccsaurora/howler-ui/components/elements/display/handlebars/helpers';
2
- declare const HELPERS: HowlerHelper[];
3
- export default HELPERS;
@@ -1,169 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- /* eslint-disable no-console */
3
- import { Checkbox, Paper, Stack, Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material';
4
- import { EnrichedTypography, Entry, Fetcher, Group, useBorealisEnrichSelector } from 'borealis-ui';
5
- import FlexOne from '@cccsaurora/howler-ui/components/elements/addons/layout/FlexOne';
6
- import i18nInstance from '@cccsaurora/howler-ui/i18n';
7
- import { capitalize, groupBy, uniq } from 'lodash-es';
8
- import { useState } from 'react';
9
- import { useTranslation } from 'react-i18next';
10
- const BorealisTypography = props => {
11
- const { t } = useTranslation();
12
- try {
13
- const guessType = useBorealisEnrichSelector(ctx => ctx.guessType);
14
- let type = props.type;
15
- if (!type || type?.toLowerCase() === 'guess') {
16
- type = guessType(props.value);
17
- }
18
- if (!type) {
19
- return _jsx("span", { children: props.value });
20
- }
21
- return _jsx(EnrichedTypography, { ...props, type: type });
22
- }
23
- catch (err) {
24
- return (_jsxs(Stack, { children: [_jsx("strong", { style: { color: 'red' }, children: t('markdown.error') }), _jsx("strong", { children: err.toString() }), _jsx("code", { style: { fontSize: '0.8rem' }, children: _jsx("pre", { children: err.stack }) })] }));
25
- }
26
- };
27
- const BorealisGroup = props => {
28
- if (!props.enabled) {
29
- return _jsx(_Fragment, { children: props.children });
30
- }
31
- if (!props.type) {
32
- console.error('Missing required props for group helper');
33
- return (_jsxs(Stack, { spacing: 1, children: [_jsx("strong", { style: { color: 'red' }, children: i18nInstance.t('markdown.error') }), _jsxs("code", { style: { fontSize: '0.8rem' }, children: [i18nInstance.t('markdown.props.missing'), ": type"] })] }));
34
- }
35
- return _jsx(Group, { type: props.type, children: props.children });
36
- };
37
- const BorealisEntry = ({ value }) => {
38
- const [checked, setChecked] = useState(false);
39
- return (_jsx(Entry, { entry: value, selected: checked, children: _jsx(Paper, { sx: { p: 1 }, children: _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(Checkbox, { checked: checked, onChange: (_event, _checked) => setChecked(_checked) }), _jsx(BorealisTypography, { value: value }), _jsx(FlexOne, {})] }) }) }));
40
- };
41
- const BorealisCheckbox = ({ value }) => {
42
- const [checked, setChecked] = useState(false);
43
- return (_jsx(Entry, { entry: value, selected: checked, children: _jsx(Checkbox, { checked: checked, onChange: (_event, _checked) => setChecked(_checked) }) }));
44
- };
45
- const HELPERS = [
46
- {
47
- keyword: 'borealis',
48
- documentation: {
49
- en: 'Given a selector, this helper enriches the selector through borealis.',
50
- fr: 'Étant donné un sélecteur, cet assistant enrichit le sélecteur via borealis.'
51
- },
52
- componentCallback: (type, value) => {
53
- if (typeof type !== 'string' || typeof value !== 'string') {
54
- return (_jsxs(Stack, { spacing: 1, children: [_jsx("strong", { style: { color: 'red' }, children: i18nInstance.t('markdown.error') }), _jsx("code", { style: { fontSize: '0.8rem' }, children: "You must provide at least two arguments: type and value." })] }));
55
- }
56
- return (_jsx(BorealisTypography, { slotProps: { stack: { component: 'span', sx: { width: 'fit-content' } } }, component: "span", type: type, value: typeof value === 'string' ? value : null }));
57
- }
58
- },
59
- {
60
- keyword: 'fetcher',
61
- documentation: {
62
- en: 'Given a selector, this helper fetches data for the selector through borealis.',
63
- fr: 'Étant donné un sélecteur, cet assistant récupère les données pour le sélecteur via borealis.'
64
- },
65
- componentCallback: (...args) => {
66
- const options = args.pop();
67
- const props = options?.hash ?? {};
68
- if (!props.type || !props.value || !props.fetcherId) {
69
- console.error('Missing required props for fetcher helper');
70
- return (_jsxs(Stack, { spacing: 1, children: [_jsx("strong", { style: { color: 'red' }, children: i18nInstance.t('markdown.error') }), _jsxs("code", { style: { fontSize: '0.8rem' }, children: [i18nInstance.t('markdown.props.missing'), ":", ' ', ['type', 'value', 'fetcherId'].filter(key => !props[key]).join(', ')] })] }));
71
- }
72
- console.debug(`Rendering fetcher (${props.fetcherId}) for selector ${props.type}:${props.value}`);
73
- return (_jsx(Fetcher, { slotProps: { stack: { component: 'span', sx: { width: 'fit-content' } } }, component: "span", ...props }));
74
- }
75
- },
76
- {
77
- keyword: 'borealis_group',
78
- documentation: {
79
- en: 'Initializes a borealis group',
80
- fr: 'Initialise un groupe borealis'
81
- },
82
- componentCallback: (values, ...args) => {
83
- const options = args.pop();
84
- const props = options?.hash ?? {};
85
- const missing = [];
86
- if (!Array.isArray(values)) {
87
- missing.push('values');
88
- }
89
- if (!props.type) {
90
- missing.push('type');
91
- }
92
- if (missing.length > 0) {
93
- return (_jsxs(Stack, { spacing: 1, children: [_jsx("strong", { style: { color: 'red' }, children: i18nInstance.t('markdown.error') }), _jsxs("code", { style: { fontSize: '0.8rem' }, children: [i18nInstance.t('markdown.props.missing'), ": ", missing.join(', ')] })] }));
94
- }
95
- return (_jsx(BorealisGroup, { type: props.type, enabled: true, children: _jsx(Stack, { spacing: 1, mt: 1, children: uniq(values).map(value => (_jsx(BorealisEntry, { value: value }, value))) }) }));
96
- }
97
- },
98
- {
99
- keyword: 'borealis_table',
100
- documentation: {
101
- en: `Render a table with optional Borealis enrichments and actions.
102
-
103
- Borealis enrichments are performed for cells with a borealis_type.
104
-
105
- Borealis actions are enabled by specifying a borealis action type using the optional borealis_action_type parameter. If enabled, cells with borealis_entity==true will be selectable for use with Borealis enrichments and actions, with a value of action_value if present, and otherwise value.
106
-
107
- Example:
108
- \`\`\`markdown
109
- {{curly 'borealis_table borealis_table_cells borealis_action_type="ip"'}}
110
- \`\`\`
111
- where borealis_table_cells is an array with properties:
112
-
113
- \`\`\`
114
- column: string;
115
- row: string;
116
- value: string;
117
- borealis_type (optional): string;
118
- borealis_entity (optional): boolean;
119
- action_value (optional): string;
120
- \`\`\`
121
- `,
122
- fr: `Affiche un tableau avec des enrichissements et actions Borealis optionnels.
123
-
124
- Les enrichissements Borealis sont effectués pour les cellules avec un borealis_type.
125
-
126
- Les actions Borealis sont activées en spécifiant un type d'action borealis en utilisant le paramètre optionnel borealis_action_type. Si activé, les cellules avec borealis_entity==true seront sélectionnables pour utilisation avec les enrichissements et actions Borealis, avec une valeur de action_value si présente, sinon la valeur.
127
-
128
- Exemple :
129
- \`\`\`markdown
130
- {{curly 'borealis_table borealis_table_cells borealis_action_type="ip"'}}
131
- \`\`\`
132
- où borealis_table_cells est un tableau avec les propriétés :
133
-
134
- \`\`\`
135
- column: string;
136
- row: string;
137
- value: string;
138
- borealis_type (optionnel): string;
139
- borealis_entity (optionnel): boolean;
140
- action_value (optionnel): string;
141
- \`\`\`
142
- `
143
- },
144
- componentCallback: (cells, ...args) => {
145
- const options = args.pop();
146
- const props = options?.hash ?? {};
147
- const columns = Object.keys(groupBy(cells, 'column'));
148
- const rows = groupBy(cells, 'row');
149
- const enableBorealisActions = !props.borealis_action_type ? false : true;
150
- const borealisActionType = !props.borealis_action_type ? 'false' : props.borealis_action_type;
151
- return (_jsx(Paper, { sx: { width: '95%', overflowX: 'auto', m: 1 }, children: _jsx(BorealisGroup, { type: borealisActionType, enabled: enableBorealisActions, children: _jsxs(Table, { children: [_jsx(TableHead, { children: _jsx(TableRow, { children: columns.map(col => (_jsx(TableCell, { sx: { maxWidth: '150px' }, children: col
152
- .split(/[_-]/)
153
- .map(word => capitalize(word))
154
- .join(' ') }, col))) }) }), _jsx(TableBody, { sx: { '& td': { wordBreak: 'break-word' } }, children: Object.entries(rows).map(([rowId, _cells]) => {
155
- return (_jsx(TableRow, { children: columns.map(col => {
156
- const cell = _cells.find(row => row.column === col);
157
- return (_jsxs(TableCell, { children: [enableBorealisActions && cell.borealis_entity === true ? (_jsx(BorealisCheckbox, { value: cell.action_value ?? cell.value })) : null, typeof cell.borealis_type === 'string' ? (_jsx(BorealisTypography, { slotProps: {
158
- stack: {
159
- component: 'span',
160
- sx: { width: 'fit-content' },
161
- display: 'inline-flex'
162
- }
163
- }, component: "span", type: cell?.borealis_type, value: cell?.value })) : ((cell?.value ?? 'N/A'))] }, col + cell?.value));
164
- }) }, rowId));
165
- }) })] }) }) }));
166
- }
167
- }
168
- ];
169
- export default HELPERS;
@@ -1,21 +0,0 @@
1
- import type { HowlerHelper } from '@cccsaurora/howler-ui/components/elements/display/handlebars/helpers';
2
- import type { PluginChipProps } from '@cccsaurora/howler-ui/components/elements/PluginChip';
3
- import type { PluginTypographyProps } from '@cccsaurora/howler-ui/components/elements/PluginTypography';
4
- import { type i18n as I18N } from 'i18next';
5
- import HowlerPlugin from '@cccsaurora/howler-ui/plugins/HowlerPlugin';
6
- declare class BorealisPlugin extends HowlerPlugin {
7
- name: string;
8
- version: string;
9
- author: string;
10
- description: string;
11
- activate(): void;
12
- provider(): import("react").FC<{
13
- children?: import("react").ReactNode | undefined;
14
- }>;
15
- setup(): () => void;
16
- localization(i18nInstance: I18N): void;
17
- helpers(): HowlerHelper[];
18
- typography(_props: PluginTypographyProps): import("react/jsx-runtime").JSX.Element;
19
- chip(_props: PluginChipProps): import("react/jsx-runtime").JSX.Element;
20
- }
21
- export default BorealisPlugin;
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box } from '@mui/material';
3
- import { Fetcher } from 'borealis-ui';
4
- import borealisEN from 'borealis-ui/dist/en/translation.json';
5
- import borealisFR from 'borealis-ui/dist/fr/translation.json';
6
- import {} from 'i18next';
7
- import HowlerPlugin from '@cccsaurora/howler-ui/plugins/HowlerPlugin';
8
- import BorealisChip from './components/BorealisChip';
9
- import BorealisLeadForm from './components/BorealisLeadForm';
10
- import BorealisPivot from './components/BorealisPivot';
11
- import BorealisPivotForm from './components/BorealisPivotForm';
12
- import BorealisTypography from './components/BorealisTypography';
13
- import HELPERS from './helpers';
14
- import Provider from './Provider';
15
- import useSetup from './setup';
16
- class BorealisPlugin extends HowlerPlugin {
17
- name = 'BorealisPlugin';
18
- version = '0.0.1';
19
- author = 'Matthew Rafuse <matthew.rafuse@cyber.gc.ca>';
20
- description = 'This plugin enables borealis enrichment in Howler.';
21
- activate() {
22
- super.activate();
23
- super.addLead('borealis', props => _jsx(BorealisLeadForm, { ...props }), (content, metadata) => (_jsx(Box, { p: 1, flex: 1, display: "flex", alignItems: "stretch", children: _jsx(Fetcher, { fetcherId: content, ...JSON.parse(metadata) }) })));
24
- super.addPivot('borealis', props => _jsx(BorealisPivotForm, { ...props }), props => _jsx(BorealisPivot, { ...props }));
25
- }
26
- provider() {
27
- return Provider;
28
- }
29
- setup() {
30
- return useSetup;
31
- }
32
- localization(i18nInstance) {
33
- i18nInstance.addResourceBundle('en', 'borealis', borealisEN, true, true);
34
- i18nInstance.addResourceBundle('fr', 'borealis', borealisFR, true, true);
35
- }
36
- helpers() {
37
- return HELPERS;
38
- }
39
- typography(_props) {
40
- return _jsx(BorealisTypography, { ..._props });
41
- }
42
- chip(_props) {
43
- return _jsx(BorealisChip, { ..._props });
44
- }
45
- }
46
- export default BorealisPlugin;
@@ -1,7 +0,0 @@
1
- {
2
- "route.dossiers.manager.borealis": "Borealis Fetcher ID",
3
- "route.dossiers.manager.borealis.type": "Selector Type",
4
- "route.dossiers.manager.borealis.value": "Selector Value",
5
- "route.dossiers.manager.borealis.value.custom": "Custom Selector Value",
6
- "route.dossiers.manager.borealis.value.description": "You can use handlebars notation to insert fields from the corresponding alert (i.e. {{howler.id}})."
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "route.dossiers.manager.borealis": "ID du sélecteur Borealis",
3
- "route.dossiers.manager.borealis.type": "Type de sélecteur",
4
- "route.dossiers.manager.borealis.value": "Valeur du sélecteur",
5
- "route.dossiers.manager.borealis.value.custom": "Valeur du sélecteur personnalisé",
6
- "route.dossiers.manager.borealis.value.description": "Vous pouvez utiliser la notation « handlebars » pour insérer des champs à partir de l'alerte correspondante (c'est-à-dire {{howler.id}})."
7
- }
@@ -1,2 +0,0 @@
1
- declare const useSetup: () => void;
2
- export default useSetup;
@@ -1,44 +0,0 @@
1
- import { SNACKBAR_EVENT_ID, useBorealis } from 'borealis-ui';
2
- import { useAppUser } from '@cccsaurora/howler-ui/commons/components/app/hooks';
3
- import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
4
- import useMySnackbar from '@cccsaurora/howler-ui/components/hooks/useMySnackbar';
5
- import { useContext, useEffect } from 'react';
6
- const useSetup = () => {
7
- const borealis = useBorealis();
8
- const appUser = useAppUser();
9
- const apiConfig = useContext(ApiConfigContext);
10
- const { showSuccessMessage, showErrorMessage, showInfoMessage, showWarningMessage } = useMySnackbar();
11
- useEffect(() => {
12
- // eslint-disable-next-line no-console
13
- console.debug('Initializing borealis snackbar event handler');
14
- const handleMessage = (event) => {
15
- const { detail } = event;
16
- if (detail.level === 'success') {
17
- showSuccessMessage(detail.message, detail.timeout, detail.options);
18
- }
19
- else if (detail.level === 'error') {
20
- showErrorMessage(detail.message, detail.timeout, detail.options);
21
- }
22
- else if (detail.level === 'info') {
23
- showInfoMessage(detail.message, detail.timeout, detail.options);
24
- }
25
- else if (detail.level === 'warning') {
26
- showWarningMessage(detail.message, detail.timeout, detail.options);
27
- }
28
- };
29
- window.addEventListener(SNACKBAR_EVENT_ID, handleMessage);
30
- return () => {
31
- window.removeEventListener(SNACKBAR_EVENT_ID, handleMessage);
32
- };
33
- }, [showErrorMessage, showInfoMessage, showSuccessMessage, showWarningMessage]);
34
- useEffect(() => {
35
- if (!appUser.isReady()) {
36
- return;
37
- }
38
- if (apiConfig.config.configuration?.features?.borealis) {
39
- borealis.setReady(true);
40
- }
41
- // eslint-disable-next-line react-hooks/exhaustive-deps
42
- }, [apiConfig.config.configuration?.features?.borealis, appUser.isReady()]);
43
- };
44
- export default useSetup;