@cccsaurora/howler-ui 2.14.0-dev.193 → 2.14.0-dev.199

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.
@@ -2,7 +2,10 @@ import Handlebars from 'handlebars';
2
2
  import { type ReactElement } from 'react';
3
3
  export interface HowlerHelper {
4
4
  keyword: string;
5
- documentation?: string;
5
+ documentation?: {
6
+ en: string;
7
+ fr: string;
8
+ };
6
9
  callback?: Handlebars.HelperDelegate;
7
10
  componentCallback?: (...args: any[]) => ReactElement | Promise<ReactElement>;
8
11
  }
@@ -18,43 +18,74 @@ export const useHelpers = () => {
18
18
  const allHelpers = useMemo(() => [
19
19
  {
20
20
  keyword: 'equals',
21
- documentation: 'Checks the equality of the string representation of the two arguments.',
21
+ documentation: {
22
+ en: 'Checks the equality of the string representation of the two arguments.',
23
+ fr: "Vérifie l'égalité de la représentation en chaîne de caractères des deux arguments."
24
+ },
22
25
  callback: (arg1, arg2) => arg1?.toString() === arg2.toString()
23
26
  },
24
27
  {
25
28
  keyword: 'and',
26
- documentation: 'Runs the comparison `arg1 && arg2`, and returns the result.',
29
+ documentation: {
30
+ en: 'Runs the comparison `arg1 && arg2`, and returns the result.',
31
+ fr: 'Exécute la comparaison `arg1 && arg2`, et retourne le résultat.'
32
+ },
27
33
  callback: (arg1, arg2) => arg1 && arg2
28
34
  },
29
35
  {
30
36
  keyword: 'or',
31
- documentation: 'Runs the comparison `arg1 || arg2`, and returns the result.',
37
+ documentation: {
38
+ en: 'Runs the comparison `arg1 || arg2`, and returns the result.',
39
+ fr: 'Exécute la comparaison `arg1 || arg2`, et retourne le résultat.'
40
+ },
32
41
  callback: (arg1, arg2) => arg1 || arg2
33
42
  },
34
- { keyword: 'not', documentation: 'Runs the comparison `!arg`, and returns the result.', callback: arg => !arg },
43
+ {
44
+ keyword: 'not',
45
+ documentation: {
46
+ en: 'Runs the comparison `!arg`, and returns the result.',
47
+ fr: 'Exécute la comparaison `!arg`, et retourne le résultat.'
48
+ },
49
+ callback: arg => !arg
50
+ },
35
51
  {
36
52
  keyword: 'curly',
37
- documentation: 'Wraps the given argument in curly braces.',
53
+ documentation: {
54
+ en: 'Wraps the given argument in curly braces.',
55
+ fr: "Entoure l'argument donné d'accolades."
56
+ },
38
57
  callback: arg1 => new Handlebars.SafeString(`{{${arg1}}}`)
39
58
  },
40
59
  {
41
60
  keyword: 'join',
42
- documentation: 'Joins two string arguments with a given string `sep`, or the empty string as a default.',
61
+ documentation: {
62
+ en: 'Joins two string arguments with a given string `sep`, or the empty string as a default.',
63
+ fr: 'Joint deux arguments de chaîne avec une chaîne donnée `sep`, ou la chaîne vide par défaut.'
64
+ },
43
65
  callback: (arg1, arg2, context) => [arg1?.toString() ?? '', arg2?.toString() ?? ''].join(context.hash?.sep ?? '')
44
66
  },
45
67
  {
46
68
  keyword: 'upper',
47
- documentation: 'Returns the uppercase representation of a string argment.',
69
+ documentation: {
70
+ en: 'Returns the uppercase representation of a string argument.',
71
+ fr: "Retourne la représentation en majuscules d'un argument de chaîne."
72
+ },
48
73
  callback: (val) => val.toLocaleUpperCase()
49
74
  },
50
75
  {
51
76
  keyword: 'lower',
52
- documentation: 'Returns the lowercase representation of a string argment.',
77
+ documentation: {
78
+ en: 'Returns the lowercase representation of a string argument.',
79
+ fr: "Retourne la représentation en minuscules d'un argument de chaîne."
80
+ },
53
81
  callback: (val) => val.toLocaleLowerCase()
54
82
  },
55
83
  {
56
84
  keyword: 'fetch',
57
- documentation: 'Fetches the url provided and returns the given (flattened) key from the returned JSON object. Note that the result must be JSON!',
85
+ documentation: {
86
+ en: 'Fetches the url provided and returns the given (flattened) key from the returned JSON object. Note that the result must be JSON!',
87
+ fr: "Récupère l'URL fournie et retourne la clé donnée (aplatie) de l'objet JSON retourné. Notez que le résultat doit être du JSON !"
88
+ },
58
89
  callback: async (url, key) => {
59
90
  try {
60
91
  if (!FETCH_RESULTS[url]) {
@@ -70,7 +101,10 @@ export const useHelpers = () => {
70
101
  },
71
102
  {
72
103
  keyword: 'howler',
73
- documentation: 'Given a howler hit ID, this helper renders a hit card for that ID.',
104
+ documentation: {
105
+ en: 'Given a howler hit ID, this helper renders a hit card for that ID.',
106
+ fr: 'Étant donné un ID de résultat howler, cet assistant affiche une carte de résultat pour cet ID.'
107
+ },
74
108
  componentCallback: id => {
75
109
  if (!id) {
76
110
  return _jsx(AppListEmpty, {});
@@ -80,7 +114,10 @@ export const useHelpers = () => {
80
114
  },
81
115
  {
82
116
  keyword: 'entries',
83
- documentation: 'Given a dict, return an array of {key, value} objects.',
117
+ documentation: {
118
+ en: 'Given a dict, return an array of {key, value} objects.',
119
+ fr: "Étant donné un dictionnaire, retourne un tableau d'objets {key, value}."
120
+ },
84
121
  callback: obj => {
85
122
  if (!isObject(obj)) {
86
123
  return new Handlebars.SafeString('Invalid Object.');
@@ -90,7 +127,10 @@ export const useHelpers = () => {
90
127
  },
91
128
  {
92
129
  keyword: 'render_json',
93
- documentation: 'Given a howler hit ID, this helper renders a hit card for that ID.',
130
+ documentation: {
131
+ en: 'Given JSON data, this helper renders a JSON viewer component.',
132
+ fr: 'Étant donné des données JSON, cet assistant affiche un composant de visualisation JSON.'
133
+ },
94
134
  componentCallback: data => {
95
135
  if (!data) {
96
136
  return _jsx(AppListEmpty, {});
@@ -100,21 +140,30 @@ export const useHelpers = () => {
100
140
  },
101
141
  {
102
142
  keyword: 'to_json',
103
- documentation: 'Convert any object into a JSON string.',
143
+ documentation: {
144
+ en: 'Convert any object into a JSON string.',
145
+ fr: "Convertit n'importe quel objet en chaîne JSON."
146
+ },
104
147
  callback: obj => {
105
148
  return new Handlebars.SafeString(JSON.stringify(obj));
106
149
  }
107
150
  },
108
151
  {
109
152
  keyword: 'parse_json',
110
- documentation: 'Convert JSON string into and object.',
153
+ documentation: {
154
+ en: 'Convert a JSON string into an object.',
155
+ fr: 'Convertit une chaîne JSON en objet.'
156
+ },
111
157
  callback: str => {
112
158
  return JSON.parse(str);
113
159
  }
114
160
  },
115
161
  {
116
162
  keyword: 'get',
117
- documentation: 'Returns the given (flattened) key from the provided object.',
163
+ documentation: {
164
+ en: 'Returns the given (flattened) key from the provided object.',
165
+ fr: "Retourne la clé donnée (aplatie) de l'objet fourni."
166
+ },
118
167
  callback: async (data, key) => {
119
168
  try {
120
169
  return get(data, key);
@@ -126,14 +175,20 @@ export const useHelpers = () => {
126
175
  },
127
176
  {
128
177
  keyword: 'includes',
129
- documentation: 'Checks if field is in string',
178
+ documentation: {
179
+ en: 'Checks if field is in string',
180
+ fr: 'Vérifie si le champ est dans la chaîne'
181
+ },
130
182
  callback: (arg1, arg2) => {
131
183
  return !!arg2 && !!arg1?.includes(arg2);
132
184
  }
133
185
  },
134
186
  {
135
187
  keyword: 'table',
136
- documentation: 'Render a table in markdown given an array of cells',
188
+ documentation: {
189
+ en: 'Render a table in markdown given an array of cells',
190
+ fr: "Affiche un tableau en markdown à partir d'un tableau de cellules"
191
+ },
137
192
  componentCallback: (cells) => {
138
193
  const columns = Object.keys(groupBy(cells, 'column'));
139
194
  const rows = groupBy(cells, 'row');
@@ -150,7 +205,10 @@ export const useHelpers = () => {
150
205
  },
151
206
  {
152
207
  keyword: 'action',
153
- documentation: 'Execute a howler action given a specific action ID (from the URL when viewing the action, i.e. yaIKVqiKhWpyCsWdqsE4D)',
208
+ documentation: {
209
+ en: 'Execute a howler action given a specific action ID (from the URL when viewing the action, i.e. yaIKVqiKhWpyCsWdqsE4D)',
210
+ fr: "Exécute une action howler à partir d'un ID d'action spécifique (de l'URL lors de la visualisation de l'action, par ex. yaIKVqiKhWpyCsWdqsE4D)"
211
+ },
154
212
  componentCallback: (actionId, hitId, context) => {
155
213
  if (!actionId || !hitId) {
156
214
  console.warn('Missing parameters for the action button.');
@@ -1,183 +1,27 @@
1
1
  import { useHelpers } from '@cccsaurora/howler-ui/components/elements/display/handlebars/helpers';
2
2
  import { useMemo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import TEMPLATE_EN from './template/en.md';
5
+ import TEMPLATE_FR from './template/fr.md';
6
+ const TEMPLATES = {
7
+ en: TEMPLATE_EN,
8
+ fr: TEMPLATE_FR
9
+ };
3
10
  export const useStartingTemplate = () => {
4
11
  const helpers = useHelpers();
12
+ const { i18n } = useTranslation();
5
13
  const helperText = useMemo(() => helpers
6
14
  .map(helper => `
7
15
  ### \`${helper.keyword}\`
8
16
 
9
- ${helper.documentation}
17
+ ${helper.documentation[i18n.language]}
10
18
 
11
19
  ---
12
20
  `.trim())
13
- .join('\n'), [helpers]);
21
+ .join('\n'), [helpers, i18n.language]);
14
22
  return useMemo(() => `
15
- # Creating an Overview
16
-
17
- Overviews can be used to modify the way data is presented on alerts that match the overview's settings. Overviews are, by design, easy to create and quite flexible.
18
-
19
- ## Getting Started
20
-
21
- The basic building blocks of overviews are:
22
-
23
- 1. Markdown
24
- 2. Handlebars
25
-
26
- We will quickly explain these.
27
-
28
- ### Markdown
29
-
30
- Quoting from the excellent [markdownguide.org](https://www.markdownguide.org/getting-started/):
31
-
32
- > Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. Created by [John Gruber](https://daringfireball.net/projects/markdown/) in 2004, Markdown is now one of the world's most popular markup languages.
33
- >
34
- > Using Markdown is different than using a [WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG) editor. In an application like Microsoft Word, you click buttons to format words and phrases, and the changes are visible immediately. Markdown isn't like that. When you create a Markdown-formatted file, you add Markdown syntax to the text to indicate which words and phrases should look different.
35
- >
36
- > For example, to denote a heading, you add a number sign before it (e.g., \`# Heading One\`). Or to make a phrase bold, you add two asterisks before and after it (e.g., \`**this text is bold**\`). It may take a while to get used to seeing Markdown syntax in your text, especially if you're accustomed to WYSIWYG applications.
37
-
38
- ---
39
-
40
- ### Handlebars
41
-
42
- Quoting from [handlebarsjs.com](https://handlebarsjs.com/guide/):
43
-
44
- > Handlebars is a simple templating language.
45
- >
46
- > It uses a template and an input object to generate HTML or other text formats. Handlebars templates look like regular text with embedded Handlebars expressions.
47
- >
48
- >\`\`\`html
49
- > <p>{{curly "firstname"}} {{curly "lastname"}}</p>
50
- >\`\`\`
51
- >
52
- > A handlebars expression is a double curly bracket, some contents, followed by a set of closing double curly brackets. When the template is executed, these expressions are replaced with values from an input object.
53
-
54
- ---
55
-
56
- For our cases, we use handlebars to replace specific parts of markdown with the values included in a given howler hit. For example:
57
-
58
- \`\`\`markdown
59
- This analytic is **{{curly "howler.analytic"}}**
60
- \`\`\`
61
-
62
- becomes:
63
-
64
- > This analytic is **{{howler.analytic}}**.
65
-
66
- For more information on handlebars, check out:
67
-
68
- - [What is Handlebars?](https://handlebarsjs.com/guide/#what-is-handlebars)
69
- - [Handlebars Expressions](https://handlebarsjs.com/guide/expressions.html)
70
-
71
- ## Combining Markdown the Handlebars
72
-
73
- You can use handlebars for template replacement throughout your markdown. Below is an example table using handlebars and markdown:
74
-
75
- \`\`\`markdown
76
- | Source IP | Destination IP |
77
- | --- | --- |
78
- | {{curly "source.ip"}} |{{curly "destination.ip"}} |
79
- \`\`\`
80
-
81
- renders as:
82
-
83
- | Source IP | Destination IP |
84
- | --- | --- |
85
- | {{source.ip}} |{{destination.ip}} |
86
-
87
- ## Advanced Handlebars
88
-
89
- Howler integrates a number of helper functions for you to work with.
90
-
91
- ### Control Expressions
92
-
93
- For use as subexpressions, we expose a number of conditional checks:
94
-
95
- **Equality:**
96
-
97
- Given \`howler.status\` is {{howler.status}}:
98
-
99
- \`\`\`markdown
100
- {{curly '#if (equals howler.status "open")'}}
101
- Hit is open!
102
- {{curly "/if"}}
103
- {{curly '#if (equals howler.status "resolved")'}}
104
- Hit is resolved!
105
- {{curly "/if"}}
106
- \`\`\`
107
-
108
- {{#if (equals howler.status "open")}}
109
- Hit is open!
110
- {{/if}}
111
- {{#if (equals howler.status "resolved")}}
112
- Hit is resolved!
113
- {{/if}}
114
-
115
- **AND/OR/NOT:**
116
-
117
- Given \`howler.status\` is {{howler.status}}, and \`howler.escalation\` is {{howler.escalation}}:
118
-
119
- \`\`\`markdown
120
- {{curly '#if (and (equals howler.status "open") (equals howler.escalation "alert"))'}}
121
- This is correct!
122
- {{curly "/if"}}
123
- {{curly '#if (and (equals howler.status "resolved") (equals howler.escalation "hit"))'}}
124
- This is wrong!
125
- {{curly "/if"}}
126
- \`\`\`
127
-
128
- {{#if (and (equals howler.status "open") (equals howler.escalation "alert"))}}
129
- This is correct!
130
- {{/if}}
131
- {{#if (and (equals howler.status "resolved") (equals howler.escalation "hit"))}}
132
- This is wrong!
133
- {{/if}}
134
-
135
- \`\`\`markdown
136
- {{curly '#if (or howler.is_bundle (not howler.is_bundle))'}}
137
- Always shows!
138
- {{curly "/if"}}
139
- \`\`\`
140
-
141
- {{#if (or howler.is_bundle (not howler.is_bundle))}}
142
- Always shows!
143
- {{/if}}
144
-
145
- ---
146
-
147
- ### String Operations
148
-
149
- **String Concatenation:**
150
- \`\`\`markdown
151
- {{curly 'join "string one " "string two"'}}
152
- \`\`\`
153
-
154
- {{join "string one " "string two"}}
155
-
156
- **Uppercase/Lowercase:**
157
-
158
- \`\`\`markdown
159
- {{curly 'upper "make this uppercase"'}}
160
- {{curly 'lower "MAKE THIS LOWERCASE"'}}
161
- \`\`\`
162
-
163
- {{upper "make this uppercase"}}
164
-
165
- {{lower "MAKE THIS LOWERCASE"}}
166
-
167
- ---
168
-
169
- ### Fetching Data
170
-
171
- You can also make basic fetch requests for, and parse, JSON data from external sources:
172
-
173
- \`\`\`markdown
174
- {{curly 'fetch "/api/v1/configs" "api_response.c12nDef.UNRESTRICTED"'}}
175
- \`\`\`
176
-
177
- {{fetch "/api/v1/configs" "api_response.c12nDef.UNRESTRICTED"}}
178
-
179
- ## Full Helper List
23
+ ${TEMPLATES[i18n.language] ?? TEMPLATES.en}
180
24
 
181
25
  ${helperText}
182
- `, [helperText]);
26
+ `, [helperText, i18n.language]);
183
27
  };
@@ -0,0 +1 @@
1
+ export default "# Creating an Overview\n\nOverviews can be used to modify the way data is presented on alerts that match the overview's settings. Overviews are, by design, easy to create and quite flexible.\n\n## Getting Started\n\nThe basic building blocks of overviews are:\n\n1. Markdown\n2. Handlebars\n\nWe will quickly explain these.\n\n### Markdown\n\nQuoting from the excellent [markdownguide.org](https://www.markdownguide.org/getting-started/):\n\n> Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. Created by [John Gruber](https://daringfireball.net/projects/markdown/) in 2004, Markdown is now one of the world's most popular markup languages.\n>\n> Using Markdown is different than using a [WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG) editor. In an application like Microsoft Word, you click buttons to format words and phrases, and the changes are visible immediately. Markdown isn't like that. When you create a Markdown-formatted file, you add Markdown syntax to the text to indicate which words and phrases should look different.\n>\n> For example, to denote a heading, you add a number sign before it (e.g., `# Heading One`). Or to make a phrase bold, you add two asterisks before and after it (e.g., `**this text is bold**`). It may take a while to get used to seeing Markdown syntax in your text, especially if you're accustomed to WYSIWYG applications.\n\n---\n\n### Handlebars\n\nQuoting from [handlebarsjs.com](https://handlebarsjs.com/guide/):\n\n> Handlebars is a simple templating language.\n>\n> It uses a template and an input object to generate HTML or other text formats. Handlebars templates look like regular text with embedded Handlebars expressions.\n>\n>```html\n> <p>{{curly \"firstname\"}} {{curly \"lastname\"}}</p>\n>```\n>\n> A handlebars expression is a double curly bracket, some contents, followed by a set of closing double curly brackets. When the template is executed, these expressions are replaced with values from an input object.\n\n---\n\nFor our cases, we use handlebars to replace specific parts of markdown with the values included in a given howler hit. For example:\n\n```markdown\nThis analytic is **{{curly \"howler.analytic\"}}**\n```\n\nbecomes:\n\n> This analytic is **{{howler.analytic}}**.\n\nFor more information on handlebars, check out:\n\n- [What is Handlebars?](https://handlebarsjs.com/guide/#what-is-handlebars)\n- [Handlebars Expressions](https://handlebarsjs.com/guide/expressions.html)\n\n## Combining Markdown and Handlebars\n\nYou can use handlebars for template replacement throughout your markdown. Below is an example table using handlebars and markdown:\n\n```markdown\n\n| Source IP | Destination IP |\n| --- | --- |\n| {{curly \"source.ip\"}} |{{curly \"destination.ip\"}} |\n```\n\nrenders as:\n\n| Source IP | Destination IP |\n| --- | --- |\n| {{source.ip}} |{{destination.ip}} |\n\n## Advanced Handlebars\n\nHowler integrates a number of helper functions for you to work with.\n\n### Control Expressions\n\nFor use as subexpressions, we expose a number of conditional checks:\n\n**Equality:**\n\nGiven `howler.status` is {{howler.status}}:\n\n```markdown\n{{curly '#if (equals howler.status \"open\")'}}\nHit is open!\n{{curly \"/if\"}}\n{{curly '#if (equals howler.status \"resolved\")'}}\nHit is resolved!\n{{curly \"/if\"}}\n```\n\n{{#if (equals howler.status \"open\")}}\nHit is open!\n{{/if}}\n{{#if (equals howler.status \"resolved\")}}\nHit is resolved!\n{{/if}}\n\n**AND/OR/NOT:**\n\nGiven `howler.status` is {{howler.status}}, and `howler.escalation` is {{howler.escalation}}:\n\n```markdown\n{{curly '#if (and (equals howler.status \"open\") (equals howler.escalation \"alert\"))'}}\nThis is correct!\n{{curly \"/if\"}}\n{{curly '#if (and (equals howler.status \"resolved\") (equals howler.escalation \"hit\"))'}}\nThis is wrong!\n{{curly \"/if\"}}\n```\n\n{{#if (and (equals howler.status \"open\") (equals howler.escalation \"alert\"))}}\nThis is correct!\n{{/if}}\n{{#if (and (equals howler.status \"resolved\") (equals howler.escalation \"hit\"))}}\nThis is wrong!\n{{/if}}\n\n```markdown\n{{curly '#if (or howler.is_bundle (not howler.is_bundle))'}}\nAlways shows!\n{{curly \"/if\"}}\n```\n\n{{#if (or howler.is_bundle (not howler.is_bundle))}}\nAlways shows!\n{{/if}}\n\n---\n\n### String Operations\n\n**String Concatenation:**\n\n```markdown\n{{curly 'join \"string one \" \"string two\"'}}\n```\n\n{{join \"string one \" \"string two\"}}\n\n**Uppercase/Lowercase:**\n\n```markdown\n{{curly 'upper \"make this uppercase\"'}}\n{{curly 'lower \"MAKE THIS LOWERCASE\"'}}\n```\n\n{{upper \"make this uppercase\"}}\n\n{{lower \"MAKE THIS LOWERCASE\"}}\n\n---\n\n### Fetching Data\n\nYou can also make basic fetch requests for, and parse, JSON data from external sources:\n\n```markdown\n{{curly 'fetch \"/api/v1/configs\" \"api_response.c12nDef.UNRESTRICTED\"'}}\n```\n\n{{fetch \"/api/v1/configs\" \"api_response.c12nDef.UNRESTRICTED\"}}\n\n## Full Helper List\n"
@@ -0,0 +1 @@
1
+ export default "# Cr\u00e9er un aper\u00e7u\n\nLes aper\u00e7us peuvent \u00eatre utilis\u00e9s pour modifier la fa\u00e7on dont les donn\u00e9es sont pr\u00e9sent\u00e9es sur les alertes qui correspondent aux param\u00e8tres de l'aper\u00e7u. Les aper\u00e7us sont, par conception, faciles \u00e0 cr\u00e9er et assez flexibles.\n\n## Premiers pas\n\nLes \u00e9l\u00e9ments de base des aper\u00e7us sont :\n\n1. Markdown\n2. Handlebars\n\nNous allons rapidement expliquer ces \u00e9l\u00e9ments.\n\n### Markdown\n\nCitation de l'excellent [markdownguide.org](https://www.markdownguide.org/getting-started/) :\n\n> Markdown est un langage de balisage l\u00e9ger que vous pouvez utiliser pour ajouter des \u00e9l\u00e9ments de formatage aux documents texte en texte brut. Cr\u00e9\u00e9 par [John Gruber](https://daringfireball.net/projects/markdown/) en 2004, Markdown est maintenant l'un des langages de balisage les plus populaires au monde.\n>\n> L'utilisation de Markdown est diff\u00e9rente de l'utilisation d'un \u00e9diteur [WYSIWYG](https://en.wikipedia.org/wiki/WYSIWYG). Dans une application comme Microsoft Word, vous cliquez sur des boutons pour formater les mots et les phrases, et les changements sont visibles imm\u00e9diatement. Markdown n'est pas comme cela. Lorsque vous cr\u00e9ez un fichier format\u00e9 en Markdown, vous ajoutez une syntaxe Markdown au texte pour indiquer quels mots et phrases doivent appara\u00eetre diff\u00e9remment.\n>\n> Par exemple, pour d\u00e9signer un titre, vous ajoutez un signe di\u00e8se avant celui-ci (par ex., `# Titre Un`). Ou pour mettre une phrase en gras, vous ajoutez deux ast\u00e9risques avant et apr\u00e8s (par ex., `**ce texte est en gras**`). Il peut falloir un certain temps pour s'habituer \u00e0 voir la syntaxe Markdown dans votre texte, surtout si vous \u00eates habitu\u00e9 aux applications WYSIWYG.\n\n---\n\n### Handlebars\n\nCitation de [handlebarsjs.com](https://handlebarsjs.com/guide/) :\n\n> Handlebars est un langage de template simple.\n>\n> Il utilise un template et un objet d'entr\u00e9e pour g\u00e9n\u00e9rer du HTML ou d'autres formats de texte. Les templates Handlebars ressemblent \u00e0 du texte normal avec des expressions Handlebars int\u00e9gr\u00e9es.\n>\n>```html\n> <p>{{curly \"firstname\"}} {{curly \"lastname\"}}</p>\n>```\n>\n> Une expression handlebars est une double accolade, du contenu, suivi d'un ensemble d'accolades fermantes doubles. Lorsque le template est ex\u00e9cut\u00e9, ces expressions sont remplac\u00e9es par des valeurs d'un objet d'entr\u00e9e.\n\n---\n\nDans nos cas, nous utilisons handlebars pour remplacer des parties sp\u00e9cifiques du markdown par les valeurs incluses dans un r\u00e9sultat howler donn\u00e9. Par exemple :\n\n```markdown\nCette analytique est **{{curly \"howler.analytic\"}}**\n```\n\ndevient :\n\n> Cette analytique est **{{howler.analytic}}**.\n\nPour plus d'informations sur handlebars, consultez :\n\n- [Qu'est-ce que Handlebars ?](https://handlebarsjs.com/guide/#what-is-handlebars)\n- [Expressions Handlebars](https://handlebarsjs.com/guide/expressions.html)\n\n## Combiner Markdown et Handlebars\n\nVous pouvez utiliser handlebars pour le remplacement de template dans tout votre markdown. Voici un exemple de tableau utilisant handlebars et markdown :\n\n```markdown\n\n| IP Source | IP Destination |\n| --- | --- |\n| {{curly \"source.ip\"}} |{{curly \"destination.ip\"}} |\n```\n\ns'affiche comme :\n\n| IP Source | IP Destination |\n| --- | --- |\n| {{source.ip}} |{{destination.ip}} |\n\n## Handlebars avanc\u00e9s\n\nHowler int\u00e8gre un certain nombre de fonctions d'aide avec lesquelles vous pouvez travailler.\n\n### Expressions de contr\u00f4le\n\nPour utilisation comme sous-expressions, nous exposons un certain nombre de v\u00e9rifications conditionnelles :\n\n**\u00c9galit\u00e9 :**\n\n\u00c9tant donn\u00e9 que `howler.status` est {{howler.status}} :\n\n```markdown\n{{curly '#if (equals howler.status \"open\")'}}\nLe r\u00e9sultat est ouvert !\n{{curly \"/if\"}}\n{{curly '#if (equals howler.status \"resolved\")'}}\nLe r\u00e9sultat est r\u00e9solu !\n{{curly \"/if\"}}\n```\n\n{{#if (equals howler.status \"open\")}}\nLe r\u00e9sultat est ouvert !\n{{/if}}\n{{#if (equals howler.status \"resolved\")}}\nLe r\u00e9sultat est r\u00e9solu !\n{{/if}}\n\n**ET/OU/NON :**\n\n\u00c9tant donn\u00e9 que `howler.status` est {{howler.status}}, et `howler.escalation` est {{howler.escalation}} :\n\n```markdown\n{{curly '#if (and (equals howler.status \"open\") (equals howler.escalation \"alert\"))'}}\nC'est correct !\n{{curly \"/if\"}}\n{{curly '#if (and (equals howler.status \"resolved\") (equals howler.escalation \"hit\"))'}}\nC'est incorrect !\n{{curly \"/if\"}}\n```\n\n{{#if (and (equals howler.status \"open\") (equals howler.escalation \"alert\"))}}\nC'est correct !\n{{/if}}\n{{#if (and (equals howler.status \"resolved\") (equals howler.escalation \"hit\"))}}\nC'est incorrect !\n{{/if}}\n\n```markdown\n{{curly '#if (or howler.is_bundle (not howler.is_bundle))'}}\nS'affiche toujours !\n{{curly \"/if\"}}\n```\n\n{{#if (or howler.is_bundle (not howler.is_bundle))}}\nS'affiche toujours !\n{{/if}}\n\n---\n\n### Op\u00e9rations sur les cha\u00eenes\n\n**Concat\u00e9nation de cha\u00eenes :**\n\n```markdown\n{{curly 'join \"cha\u00eene une \" \"cha\u00eene deux\"'}}\n```\n\n{{join \"cha\u00eene une \" \"cha\u00eene deux\"}}\n\n**Majuscules/Minuscules :**\n\n```markdown\n{{curly 'upper \"mettre ceci en majuscules\"'}}\n{{curly 'lower \"METTRE CECI EN MINUSCULES\"'}}\n```\n\n{{upper \"mettre ceci en majuscules\"}}\n\n{{lower \"METTRE CECI EN MINUSCULES\"}}\n\n---\n\n### R\u00e9cup\u00e9ration de donn\u00e9es\n\nVous pouvez \u00e9galement faire des requ\u00eates fetch de base pour r\u00e9cup\u00e9rer et analyser des donn\u00e9es JSON de sources externes :\n\n```markdown\n{{curly 'fetch \"/api/v1/configs\" \"api_response.c12nDef.UNRESTRICTED\"'}}\n```\n\n{{fetch \"/api/v1/configs\" \"api_response.c12nDef.UNRESTRICTED\"}}\n\n## Liste compl\u00e8te des assistants\n"
package/package.json CHANGED
@@ -96,7 +96,7 @@
96
96
  "internal-slot": "1.0.7"
97
97
  },
98
98
  "type": "module",
99
- "version": "2.14.0-dev.193",
99
+ "version": "2.14.0-dev.199",
100
100
  "exports": {
101
101
  "./i18n": "./i18n.js",
102
102
  "./index.css": "./index.css",
@@ -244,6 +244,7 @@
244
244
  "./components/routes/hits/view/*": "./components/routes/hits/view/*.js",
245
245
  "./components/routes/hits/search/shared/*": "./components/routes/hits/search/shared/*.js",
246
246
  "./components/routes/hits/search/grid/*": "./components/routes/hits/search/grid/*.js",
247
+ "./components/routes/overviews/template/*": "./components/routes/overviews/template/*.js",
247
248
  "./components/routes/analytics/widgets/*": "./components/routes/analytics/widgets/*.js",
248
249
  "./components/routes/help/markdown/*.md": "./components/routes/help/markdown/*.md.js",
249
250
  "./components/routes/help/components/*": "./components/routes/help/components/*.js",
@@ -1,6 +1,3 @@
1
- declare const HELPERS: {
2
- keyword: string;
3
- documentation: string;
4
- componentCallback: (...args: any[]) => import("react/jsx-runtime").JSX.Element;
5
- }[];
1
+ import type { HowlerHelper } from '@cccsaurora/howler-ui/components/elements/display/handlebars/helpers';
2
+ declare const HELPERS: HowlerHelper[];
6
3
  export default HELPERS;
@@ -45,7 +45,10 @@ const BorealisCheckbox = ({ value }) => {
45
45
  const HELPERS = [
46
46
  {
47
47
  keyword: 'borealis',
48
- documentation: 'Given a selector, this helper enriches the selector through 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
+ },
49
52
  componentCallback: (type, value) => {
50
53
  if (typeof type !== 'string' || typeof value !== 'string') {
51
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,7 +58,10 @@ const HELPERS = [
55
58
  },
56
59
  {
57
60
  keyword: 'fetcher',
58
- documentation: 'Given a selector, this helper fetches data for the selector through borealis.',
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
+ },
59
65
  componentCallback: (...args) => {
60
66
  const options = args.pop();
61
67
  const props = options?.hash ?? {};
@@ -69,7 +75,10 @@ const HELPERS = [
69
75
  },
70
76
  {
71
77
  keyword: 'borealis_group',
72
- documentation: 'Initializes a borealis group',
78
+ documentation: {
79
+ en: 'Initializes a borealis group',
80
+ fr: 'Initialise un groupe borealis'
81
+ },
73
82
  componentCallback: (values, ...args) => {
74
83
  const options = args.pop();
75
84
  const props = options?.hash ?? {};
@@ -88,7 +97,8 @@ const HELPERS = [
88
97
  },
89
98
  {
90
99
  keyword: 'borealis_table',
91
- documentation: `Render a table with optional Borealis enrichments and actions.
100
+ documentation: {
101
+ en: `Render a table with optional Borealis enrichments and actions.
92
102
 
93
103
  Borealis enrichments are performed for cells with a borealis_type.
94
104
 
@@ -109,6 +119,28 @@ where borealis_table_cells is an array with properties:
109
119
  action_value (optional): string;
110
120
  \`\`\`
111
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
+ },
112
144
  componentCallback: (cells, ...args) => {
113
145
  const options = args.pop();
114
146
  const props = options?.hash ?? {};