[TSVB] [Annotations] Update label for Time field (#142452)

* [TSVB] [Annotations] Update label for Time field

Closes: #142226

* Update src/plugins/vis_types/timeseries/public/application/components/aggs/field_select/field_select.tsx

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Alexey Antonov 2022-10-03 16:19:06 +03:00 committed by GitHub
parent f4184540be
commit a8d54b3e3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 7 deletions

View file

@ -47,10 +47,15 @@ interface FieldSelectProps {
fullWidth?: boolean;
}
const getPreselectedFields = (
const getPlaceholderValue = (
placeholder?: string,
options?: Array<EuiComboBoxOptionOption<string>>
) => placeholder && findInGroupedOptions(options, placeholder)?.label;
) => {
if (!placeholder) {
return;
}
return findInGroupedOptions(options, placeholder)?.label || placeholder;
};
export function FieldSelect({
label,
@ -138,7 +143,7 @@ export function FieldSelect({
onNewItemAdd={onNewItemAdd.bind(undefined, props.index)}
onDeleteItem={onDeleteItem.bind(undefined, props.index)}
onChange={onFieldSelectItemChange.bind(undefined, props.index)}
placeholder={getPreselectedFields(placeholder, groupedOptions)}
placeholder={getPlaceholderValue(placeholder, groupedOptions)}
disableAdd={!allowMultiSelect || selectedIds?.length >= MAX_MULTI_FIELDS_ITEMS}
disableDelete={!allowMultiSelect || selectedIds?.length <= 1}
/>

View file

@ -154,7 +154,7 @@ export const AnnotationRow = ({
label={
<FormattedMessage
id="visTypeTimeseries.annotationsEditor.timeFieldLabel"
defaultMessage="Time field (required)"
defaultMessage="Time field"
/>
}
restrict={RESTRICT_FIELDS}
@ -165,6 +165,10 @@ export const AnnotationRow = ({
})
}
indexPattern={model.index_pattern}
placeholder={
fetchedIndex?.indexPattern?.timeFieldName ??
fetchedIndex?.defaultIndex?.timeFieldName
}
fields={fields}
/>
</EuiFlexItem>

View file

@ -5487,7 +5487,6 @@
"visTypeTimeseries.annotationsEditor.ignorePanelFiltersLabel": "Ignorer les filtres de panneau ?",
"visTypeTimeseries.annotationsEditor.queryStringLabel": "Chaîne de requête",
"visTypeTimeseries.annotationsEditor.rowTemplateLabel": "Modèle de ligne (requis)",
"visTypeTimeseries.annotationsEditor.timeFieldLabel": "Champ temporel (requis)",
"visTypeTimeseries.calculateLabel.bucketScriptsLabel": "Script de compartiment",
"visTypeTimeseries.calculateLabel.countLabel": "Décompte",
"visTypeTimeseries.calculateLabel.filterRatioLabel": "Rapport de filtre",

View file

@ -5481,7 +5481,6 @@
"visTypeTimeseries.annotationsEditor.ignorePanelFiltersLabel": "パネルフィルターを無視しますか?",
"visTypeTimeseries.annotationsEditor.queryStringLabel": "クエリ文字列",
"visTypeTimeseries.annotationsEditor.rowTemplateLabel": "行テンプレート(必須)",
"visTypeTimeseries.annotationsEditor.timeFieldLabel": "時間フィールド(必須)",
"visTypeTimeseries.calculateLabel.bucketScriptsLabel": "バケットスクリプト",
"visTypeTimeseries.calculateLabel.countLabel": "カウント",
"visTypeTimeseries.calculateLabel.filterRatioLabel": "フィルターレート",

View file

@ -5488,7 +5488,6 @@
"visTypeTimeseries.annotationsEditor.ignorePanelFiltersLabel": "忽略面板筛选?",
"visTypeTimeseries.annotationsEditor.queryStringLabel": "查询字符串",
"visTypeTimeseries.annotationsEditor.rowTemplateLabel": "行模板(必需)",
"visTypeTimeseries.annotationsEditor.timeFieldLabel": "时间字段(必需)",
"visTypeTimeseries.calculateLabel.bucketScriptsLabel": "存储桶脚本",
"visTypeTimeseries.calculateLabel.countLabel": "计数",
"visTypeTimeseries.calculateLabel.filterRatioLabel": "筛选比",