Skip to content

Commit 5865061

Browse files
stratoulaflorent-leborgne
authored andcommitted
[ES|QL] Improves the time named params docs (#235029)
## Summary Improves the editor docs when the user is looking at the `_tstart` and `_tend` options <img width="513" height="320" alt="image" src="https://github.com/user-attachments/assets/e8b3b689-fcb4-43d8-88db-5bc858db3608" /> <img width="906" height="347" alt="image" src="https://github.com/user-attachments/assets/60ac3cb3-7d8a-4ea2-a85a-ee320612ab16" /> --------- Co-authored-by: florent-leborgne <[email protected]>
1 parent a6a7380 commit 5865061

File tree

1 file changed

+9
-3
lines changed
  • src/platform/packages/shared/kbn-esql-ast/src/definitions/utils

1 file changed

+9
-3
lines changed

src/platform/packages/shared/kbn-esql-ast/src/definitions/utils/literals.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export const buildConstantsDefinitions = (
2424
/**
2525
* Whether or not to advance the cursor and open the suggestions dialog after inserting the constant.
2626
*/
27-
options?: { advanceCursorAndOpenSuggestions?: boolean; addComma?: boolean }
27+
options?: { advanceCursorAndOpenSuggestions?: boolean; addComma?: boolean },
28+
documentationValue?: string
2829
): ISuggestionItem[] =>
2930
userConstants.map((label) => ({
3031
label,
@@ -38,6 +39,7 @@ export const buildConstantsDefinitions = (
3839
i18n.translate('kbn-esql-ast.esql.autocomplete.constantDefinition', {
3940
defaultMessage: `Constant`,
4041
}),
42+
...(documentationValue ? { documentation: { value: documentationValue } } : {}),
4143
sortText: sortText ?? 'A',
4244
command: options?.advanceCursorAndOpenSuggestions ? TRIGGER_SUGGESTION_COMMAND : undefined,
4345
}));
@@ -50,10 +52,14 @@ export function getDateLiterals(options?: {
5052
...buildConstantsDefinitions(
5153
TIME_SYSTEM_PARAMS,
5254
i18n.translate('kbn-esql-ast.esql.autocomplete.namedParamDefinition', {
53-
defaultMessage: 'Named parameter',
55+
defaultMessage: 'Bind to time filter',
5456
}),
5557
'1A',
56-
options
58+
options,
59+
// appears when the user opens the second level popover
60+
i18n.translate('kbn-esql-ast.esql.autocomplete.timeNamedParamDoc', {
61+
defaultMessage: `Use the \`?_tstart\` and \`?_tend\` parameters to bind a custom timestamp field to Kibana's time filter.`,
62+
})
5763
),
5864
{
5965
label: i18n.translate('kbn-esql-ast.esql.autocomplete.chooseFromTimePickerLabel', {

0 commit comments

Comments
 (0)