@cccsaurora/howler-ui 2.16.0-dev.383 → 2.16.0-dev.390
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/components/routes/help/AuthDocumentation.js +8 -1
- package/components/routes/help/ClientDocumentation.js +8 -1
- package/components/routes/help/NotebookDocumentation.d.ts +1 -1
- package/components/routes/help/NotebookDocumentation.js +14 -6
- package/components/routes/help/RetentionDocumentation.js +8 -1
- package/components/routes/help/TemplateDocumentation.js +6 -2
- package/components/routes/help/ViewDocumentation.js +8 -1
- package/package.json +3 -3
- package/plugins/HowlerPlugin.d.ts +1 -0
- package/plugins/HowlerPlugin.js +3 -0
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -0
|
@@ -4,12 +4,19 @@ import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown
|
|
|
4
4
|
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
8
|
+
import { usePluginStore } from 'react-pluggable';
|
|
9
|
+
import { modifyDocumentation } from '@cccsaurora/howler-ui/utils/utils';
|
|
7
10
|
import AUTH_EN from './markdown/en/authentication.md';
|
|
8
11
|
import AUTH_FR from './markdown/fr/authentication.md';
|
|
9
12
|
const AuthDocumentation = () => {
|
|
10
13
|
const { i18n } = useTranslation();
|
|
14
|
+
const pluginStore = usePluginStore();
|
|
11
15
|
useScrollRestoration();
|
|
12
|
-
const md = useMemo(() =>
|
|
16
|
+
const md = useMemo(() => {
|
|
17
|
+
let original = (i18n.language === 'en' ? AUTH_EN : AUTH_FR).replace(/\$CURRENT_URL/g, window.location.origin);
|
|
18
|
+
return modifyDocumentation(original, howlerPluginStore, pluginStore);
|
|
19
|
+
}, [i18n.language, pluginStore]);
|
|
13
20
|
return (_jsx(PageCenter, { margin: 4, width: "100%", textAlign: "left", children: _jsx(Markdown, { md: md }) }));
|
|
14
21
|
};
|
|
15
22
|
export default AuthDocumentation;
|
|
@@ -4,12 +4,19 @@ import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
7
|
+
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
8
|
+
import { usePluginStore } from 'react-pluggable';
|
|
9
|
+
import { modifyDocumentation } from '@cccsaurora/howler-ui/utils/utils';
|
|
7
10
|
import CLIENT_EN from './markdown/en/client.md';
|
|
8
11
|
import CLIENT_FR from './markdown/fr/client.md';
|
|
9
12
|
const ClientDocumentation = () => {
|
|
10
13
|
const { i18n } = useTranslation();
|
|
14
|
+
const pluginStore = usePluginStore();
|
|
11
15
|
useScrollRestoration();
|
|
12
|
-
const md = useMemo(() =>
|
|
16
|
+
const md = useMemo(() => {
|
|
17
|
+
let original = (i18n.language === 'en' ? CLIENT_EN : CLIENT_FR).replace(/\$CURRENT_URL/g, window.location.origin);
|
|
18
|
+
return modifyDocumentation(original, howlerPluginStore, pluginStore);
|
|
19
|
+
}, [i18n.language, pluginStore]);
|
|
13
20
|
return (_jsx(PageCenter, { margin: 4, width: "100%", textAlign: "left", children: _jsx(Markdown, { md: md }) }));
|
|
14
21
|
};
|
|
15
22
|
export default ClientDocumentation;
|
|
@@ -2,17 +2,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import PageCenter from '@cccsaurora/howler-ui/commons/components/pages/PageCenter';
|
|
3
3
|
import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown';
|
|
4
4
|
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
5
|
+
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
6
|
+
import { useMemo } from 'react';
|
|
5
7
|
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { usePluginStore } from 'react-pluggable';
|
|
9
|
+
import { modifyDocumentation } from '@cccsaurora/howler-ui/utils/utils';
|
|
6
10
|
import NOTEBOOK_EN from './markdown/en/notebook.md';
|
|
7
11
|
import NOTEBOOK_FR from './markdown/fr/notebook.md';
|
|
8
12
|
const NotebookDocumentation = () => {
|
|
9
13
|
const { i18n } = useTranslation();
|
|
14
|
+
const pluginStore = usePluginStore();
|
|
10
15
|
useScrollRestoration();
|
|
11
|
-
const
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const md = useMemo(() => {
|
|
17
|
+
let markdown = (i18n.language === 'en' ? NOTEBOOK_EN : NOTEBOOK_FR)
|
|
18
|
+
.replaceAll('$NBGALLERY_URL', window.location.host.startsWith('localhost')
|
|
19
|
+
? 'https://nbgallery.dev.analysis.cyber.gc.ca'
|
|
20
|
+
: window.location.origin.replace(/howler(-stg)/, 'nbgallery'))
|
|
21
|
+
.replaceAll('$CURRENT_URL', window.location.origin);
|
|
22
|
+
return modifyDocumentation(markdown, howlerPluginStore, pluginStore);
|
|
23
|
+
}, [i18n.language, pluginStore]);
|
|
24
|
+
return (_jsx(PageCenter, { margin: 4, width: "100%", textAlign: "left", children: _jsx(Markdown, { md: md }) }));
|
|
17
25
|
};
|
|
18
26
|
export default NotebookDocumentation;
|
|
@@ -9,14 +9,21 @@ import api from '@cccsaurora/howler-ui/api';
|
|
|
9
9
|
import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
|
|
10
10
|
import HitCard from '@cccsaurora/howler-ui/components/elements/hit/HitCard';
|
|
11
11
|
import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayout';
|
|
12
|
+
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
13
|
+
import { usePluginStore } from 'react-pluggable';
|
|
14
|
+
import { modifyDocumentation } from '@cccsaurora/howler-ui/utils/utils';
|
|
12
15
|
import AUTH_EN from './markdown/en/retention.md';
|
|
13
16
|
import AUTH_FR from './markdown/fr/retention.md';
|
|
14
17
|
const RetentionDocumentation = () => {
|
|
15
18
|
const { i18n } = useTranslation();
|
|
16
19
|
const { config } = useContext(ApiConfigContext);
|
|
20
|
+
const pluginStore = usePluginStore();
|
|
17
21
|
useScrollRestoration();
|
|
18
22
|
const [hitId, setHitId] = useState();
|
|
19
|
-
const md = useMemo(() =>
|
|
23
|
+
const md = useMemo(() => {
|
|
24
|
+
let original = (i18n.language === 'en' ? AUTH_EN : AUTH_FR).replace(/\$CURRENT_URL/g, window.location.origin);
|
|
25
|
+
return modifyDocumentation(original, howlerPluginStore, pluginStore);
|
|
26
|
+
}, [i18n.language, pluginStore]);
|
|
20
27
|
useEffect(() => {
|
|
21
28
|
api.search.hit
|
|
22
29
|
.post({
|
|
@@ -6,8 +6,11 @@ import { HitLayout } from '@cccsaurora/howler-ui/components/elements/hit/HitLayo
|
|
|
6
6
|
import DefaultOutline from '@cccsaurora/howler-ui/components/elements/hit/outlines/DefaultOutline';
|
|
7
7
|
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
|
+
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
9
10
|
import { useMemo } from 'react';
|
|
10
11
|
import { useTranslation } from 'react-i18next';
|
|
12
|
+
import { usePluginStore } from 'react-pluggable';
|
|
13
|
+
import { modifyDocumentation } from '@cccsaurora/howler-ui/utils/utils';
|
|
11
14
|
import TEMPLATES_EN from './markdown/en/templates.md';
|
|
12
15
|
import TEMPLATES_FR from './markdown/fr/templates.md';
|
|
13
16
|
const ALERTS = [
|
|
@@ -32,6 +35,7 @@ const ALERTS = [
|
|
|
32
35
|
];
|
|
33
36
|
const TemplateDocumentation = () => {
|
|
34
37
|
const { i18n } = useTranslation();
|
|
38
|
+
const pluginStore = usePluginStore();
|
|
35
39
|
useScrollRestoration();
|
|
36
40
|
const [md1, md2] = useMemo(() => {
|
|
37
41
|
let markdown = i18n.language === 'en' ? TEMPLATES_EN : TEMPLATES_FR;
|
|
@@ -39,8 +43,8 @@ const TemplateDocumentation = () => {
|
|
|
39
43
|
ALERTS.forEach((alert, index) => {
|
|
40
44
|
markdown = markdown.replace(`$ALERT_${index + 1}`, JSON.stringify(alert, null, 2));
|
|
41
45
|
});
|
|
42
|
-
return markdown.split('\n===SPLIT===\n');
|
|
43
|
-
}, [i18n.language]);
|
|
46
|
+
return modifyDocumentation(markdown.split('\n===SPLIT===\n'), howlerPluginStore, pluginStore);
|
|
47
|
+
}, [i18n.language, pluginStore]);
|
|
44
48
|
return (_jsxs(PageCenter, { margin: 4, width: "100%", textAlign: "left", children: [_jsx(Markdown, { md: md1 }), _jsx(Stack, { spacing: 1, children: ALERTS.map(alert => (_jsx(Card, { variant: "outlined", children: _jsx(CardContent, { children: _jsx(DefaultOutline, { hit: alert, fields: Object.keys(alert).flatMap(key => Object.keys(alert[key]).map(key2 => [key, key2].join('.'))), layout: HitLayout.NORMAL, readonly: true }) }) }, alert.howler.id))) }), _jsx(Markdown, { md: md2 })] }));
|
|
45
49
|
};
|
|
46
50
|
export default TemplateDocumentation;
|
|
@@ -3,14 +3,21 @@ import { Search } from '@mui/icons-material';
|
|
|
3
3
|
import PageCenter from '@cccsaurora/howler-ui/commons/components/pages/PageCenter';
|
|
4
4
|
import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown';
|
|
5
5
|
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
6
|
+
import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { modifyDocumentation } from '@cccsaurora/howler-ui/utils/utils';
|
|
10
|
+
import { usePluginStore } from 'react-pluggable';
|
|
8
11
|
import VIEWS_EN from './markdown/en/views.md';
|
|
9
12
|
import VIEWS_FR from './markdown/fr/views.md';
|
|
10
13
|
const ViewDocumentation = () => {
|
|
11
14
|
const { i18n } = useTranslation();
|
|
15
|
+
const pluginStore = usePluginStore();
|
|
12
16
|
useScrollRestoration();
|
|
13
|
-
const md = useMemo(() =>
|
|
17
|
+
const md = useMemo(() => {
|
|
18
|
+
let original = (i18n.language === 'en' ? VIEWS_EN : VIEWS_FR).replace(/\$CURRENT_URL/g, window.location.origin);
|
|
19
|
+
return modifyDocumentation(original, howlerPluginStore, pluginStore);
|
|
20
|
+
}, [i18n.language, pluginStore]);
|
|
14
21
|
return (_jsx(PageCenter, { margin: 4, width: "100%", textAlign: "left", children: _jsx(Markdown, { md: md, components: {
|
|
15
22
|
search: _jsx(Search, { fontSize: "inherit" })
|
|
16
23
|
} }) }));
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"handlebars-async-helpers": "^1.0.6",
|
|
38
38
|
"i18next": "^23.16.8",
|
|
39
39
|
"i18next-browser-languagedetector": "^7.2.2",
|
|
40
|
-
"lodash-es": "^4.17.
|
|
40
|
+
"lodash-es": "^4.17.23",
|
|
41
41
|
"md5": "^2.3.0",
|
|
42
42
|
"mermaid": "^11.10.0",
|
|
43
43
|
"monaco-editor": "^0.49.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-markdown": "^10.1.0",
|
|
52
52
|
"react-pluggable": "^0.4.3",
|
|
53
53
|
"react-resize-detector": "^9.1.1",
|
|
54
|
-
"react-router": "^
|
|
54
|
+
"react-router": "^7.12.0",
|
|
55
55
|
"react-router-dom": "^6.30.1",
|
|
56
56
|
"react-syntax-highlighter": "^15.6.1",
|
|
57
57
|
"rehype-raw": "^7.0.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"internal-slot": "1.0.7"
|
|
97
97
|
},
|
|
98
98
|
"type": "module",
|
|
99
|
-
"version": "2.16.0-dev.
|
|
99
|
+
"version": "2.16.0-dev.390",
|
|
100
100
|
"exports": {
|
|
101
101
|
"./i18n": "./i18n.js",
|
|
102
102
|
"./index.css": "./index.css",
|
|
@@ -111,5 +111,6 @@ declare abstract class HowlerPlugin implements IPlugin {
|
|
|
111
111
|
help(): React.ReactNode;
|
|
112
112
|
settings(_section: 'admin' | 'local' | 'profile' | 'security'): React.ReactNode;
|
|
113
113
|
integrations(): [string, () => React.ReactNode][];
|
|
114
|
+
documentation(md: string): string;
|
|
114
115
|
}
|
|
115
116
|
export default HowlerPlugin;
|
package/plugins/HowlerPlugin.js
CHANGED
package/utils/utils.d.ts
CHANGED
package/utils/utils.js
CHANGED
|
@@ -178,3 +178,9 @@ export const flattenDeep = (data) => {
|
|
|
178
178
|
});
|
|
179
179
|
return final;
|
|
180
180
|
};
|
|
181
|
+
export const modifyDocumentation = (original, howlerPluginStore, pluginStore) => {
|
|
182
|
+
for (const plugin of howlerPluginStore.plugins) {
|
|
183
|
+
original = pluginStore.executeFunction(`${plugin}.documentation`, original);
|
|
184
|
+
}
|
|
185
|
+
return original;
|
|
186
|
+
};
|