Skip to content

Commit

Permalink
Add some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaStoeva committed Dec 16, 2024
1 parent 277838a commit f95bbd7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,17 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
isBulkEdit,
}) => {
const lifecycle = dataStreams[0]?.lifecycle;
const isSingleDataStream = dataStreams.length === 1;

const {
history,
plugins: { cloud },
} = useAppContext();
const dataStreamNames = dataStreams.map(({ name }: DataStream) => name as string);
const globalMaxRetention = deserializeGlobalMaxRetention(lifecycle?.globalMaxRetention);
const { size, unit } = isBulkEdit
? { size: undefined, unit: undefined }
: splitSizeAndUnits(lifecycle?.data_retention as string);
const { size, unit } = isSingleDataStream
? splitSizeAndUnits(lifecycle?.data_retention as string)
: { size: undefined, unit: undefined };

const {
services: { notificationService },
Expand All @@ -79,11 +80,12 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
defaultValue: {
dataRetention: size,
timeUnit: unit || 'd',
dataRetentionEnabled: isBulkEdit ? true : lifecycle?.enabled,
dataRetentionEnabled: isSingleDataStream ? lifecycle?.enabled : true,
// When data retention is not set and lifecycle is enabled, is the only scenario in
// which data retention will be infinite. If lifecycle isnt set or is not enabled, we
// dont have inifinite data retention.
infiniteRetentionPeriod: !isBulkEdit && lifecycle?.enabled && !lifecycle?.data_retention,
infiniteRetentionPeriod:
isSingleDataStream && lifecycle?.enabled && !lifecycle?.data_retention,
},
schema: editDataRetentionFormSchema,
id: 'editDataRetentionForm',
Expand Down Expand Up @@ -179,11 +181,14 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
(ds: DataStream) =>
formData.dataRetention &&
formData.timeUnit &&
((typeof ds.lifecycle?.data_retention === 'string' &&
isRetentionBiggerThan(
ds.lifecycle.data_retention,
`${formData.dataRetention}${formData.timeUnit}`
)) ||
((ds.lifecycle?.enabled &&
!ds.lifecycle?.data_retention &&
!ds.lifecycle?.effective_retention) ||
(typeof ds.lifecycle?.data_retention === 'string' &&
isRetentionBiggerThan(
ds.lifecycle.data_retention,
`${formData.dataRetention}${formData.timeUnit}`
)) ||
(ds.lifecycle?.effective_retention &&
isRetentionBiggerThan(
ds.lifecycle.effective_retention,
Expand All @@ -203,7 +208,7 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
<EuiModalHeaderTitle>
<FormattedMessage
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.modalTitleText"
defaultMessage="Edit data retention {dataStreamCount, plural, one {} other {for {dataStreamCount} data streams}}"
defaultMessage="Edit data retention for {dataStreamCount} {dataStreamCount, plural, one {data stream} other {data streams}}"
values={{ dataStreamCount: dataStreams?.length }}
/>
</EuiModalHeaderTitle>
Expand Down Expand Up @@ -265,7 +270,7 @@ export const EditDataRetentionModal: React.FunctionComponent<Props> = ({
}
helpText={
isBulkEdit &&
globalMaxRetention && (
lifecycle?.globalMaxRetention && (
<FormattedMessage
id="xpack.idxMgmt.dataStreams.editDataRetentionModal.learnMoreLinkText"
defaultMessage="Maximum data retention period for this project is {maxRetention} {unitText}. {manageSettingsLink}"
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -22420,6 +22420,7 @@
"xpack.idxMgmt.dataStreamList.table.actionDeleteText": "Supprimer",
"xpack.idxMgmt.dataStreamList.table.dataRetentionColumnTitle": "Conservation des données",
"xpack.idxMgmt.dataStreamList.table.dataRetentionColumnTooltip": "Les données sont conservées au moins pour cette durée avant leur suppression automatique. La valeur de rétention de données s'applique uniquement aux données gérées directement par le flux de données. {canDisableDataRetention, plural, one {Si certaines données sont sujettes à une politique de gestion du cycle de vie de l'index, alors la valeur de conservation des données réglée pour le flux de données ne s'applique par à ces données.} other {}}",
"xpack.idxMgmt.dataStreamList.table.deleteDataStreamsButtonLabel": "Supprimer {count, plural, one {le flux de données} other {les flux de données} }",
"xpack.idxMgmt.dataStreamList.table.healthColumnTitle": "Intégrité",
"xpack.idxMgmt.dataStreamList.table.hiddenDataStreamBadge": "Masqué",
"xpack.idxMgmt.dataStreamList.table.indicesColumnTitle": "Index",
Expand All @@ -22435,16 +22436,22 @@
"xpack.idxMgmt.dataStreamListControls.includeStatsSwitchLabel": "Statistiques incluses",
"xpack.idxMgmt.dataStreamListControls.includeStatsSwitchToolTip": "L'inclusion de statistiques peut augmenter le temps de rechargement",
"xpack.idxMgmt.dataStreamListDescription.learnMoreLinkText": "En savoir plus.",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.cancelButtonLabel": "Annuler",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionEnabledField": "Activer la conservation des données",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionField": "Conservation des données",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionFieldNonNegativeError": "Une valeur positive est requise.",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionFieldRequiredError": "Une valeur de conservation des données est requise.",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.errorDataRetentionNotification": "Erreur lors de la mise à niveau de la conservation des données : \"{error}\"",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMButtonLabel": "Stratégie ILM",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMDescription": "Afin de modifier la conservation des données pour ce flux de données, vous devez modifier le {link} associé.",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMTitle": "Ce flux de données et les index associés sont gérés par la stratégie ILM",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.learnMoreLinkText": "Comment ça fonctionne ?",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.saveButtonLabel": "Enregistrer",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.someManagedByILMBody": "Un index ou plus sont gérés par une politique ILM ({viewAllIndicesLink}). La mise à niveau de la conservation des données pour ce flux de données n'aura pas d'incidence sur ces index. À la place, vous devrez mettre à niveau la politique {ilmPolicyLink}.",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.someManagedByILMTitle": "Certains index sont gérés par la stratégie ILM",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.successDataRetentionNotification": "Conservation des données {disabledDataRetention, plural, one { désactivée } other { mise à niveau } }",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.timeUnitField": "Unité de temps",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.unitsAriaLabel": "Unité de temps",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.viewAllIndices": "afficher les index",
"xpack.idxMgmt.dataStreamsDetailsPanel.manageButtonLabel": "Gérer",
"xpack.idxMgmt.dataStreamsDetailsPanel.stepLogistics.dataRetentionFieldDecimalError": "La valeur doit être un nombre entier.",
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -22391,6 +22391,7 @@
"xpack.idxMgmt.dataStreamList.table.actionDeleteText": "削除",
"xpack.idxMgmt.dataStreamList.table.dataRetentionColumnTitle": "データ保持",
"xpack.idxMgmt.dataStreamList.table.dataRetentionColumnTooltip": "データは少なくともこの期間保存された後、自動的に削除されます。データ保持値は、データストリームによって直接管理されたデータにのみ適用されます。{canDisableDataRetention, plural, one {一部のデータにインデックスライフサイクル管理ポリシーが適用される場合、データストリームに設定されたデータ保持値はそのデータに適用されません。} other {}}",
"xpack.idxMgmt.dataStreamList.table.deleteDataStreamsButtonLabel": "{count, plural, other {個のデータストリーム}}を削除",
"xpack.idxMgmt.dataStreamList.table.healthColumnTitle": "ヘルス",
"xpack.idxMgmt.dataStreamList.table.hiddenDataStreamBadge": "非表示",
"xpack.idxMgmt.dataStreamList.table.indicesColumnTitle": "インデックス",
Expand All @@ -22406,16 +22407,22 @@
"xpack.idxMgmt.dataStreamListControls.includeStatsSwitchLabel": "統計情報を含める",
"xpack.idxMgmt.dataStreamListControls.includeStatsSwitchToolTip": "統計情報を含めると、再読み込み時間が長くなることがあります",
"xpack.idxMgmt.dataStreamListDescription.learnMoreLinkText": "詳細情報",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.cancelButtonLabel": "キャンセル",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionEnabledField": "データ保持を有効化",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionField": "データ保持",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionFieldNonNegativeError": "正の値が必要です。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionFieldRequiredError": "データ保持値が必要です。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.errorDataRetentionNotification": "データ保持の更新エラー:''{error}''",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMButtonLabel": "ILMポリシー",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMDescription": "このデータストリームのデータ保持を編集するには、関連する{link}を編集する必要があります。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMTitle": "このデータストリームと関連するインデックスはILMによって管理されます。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.learnMoreLinkText": "仕組み",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.saveButtonLabel": "保存",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.someManagedByILMBody": "ILMポリシー({viewAllIndicesLink})によって1つ以上のインデックスが管理されます。このデータストリームのデータ保持を更新しても、これらのインデックスには影響しません。代わりに、{ilmPolicyLink}ポリシーを更新する必要があります。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.someManagedByILMTitle": "一部のインデックスはILMによって管理されます。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.successDataRetentionNotification": "データ保持が{disabledDataRetention, plural, one {無効化されました} other {更新されました} }",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.timeUnitField": "時間単位",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.unitsAriaLabel": "時間単位",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.viewAllIndices": "インデックスを表示",
"xpack.idxMgmt.dataStreamsDetailsPanel.manageButtonLabel": "管理",
"xpack.idxMgmt.dataStreamsDetailsPanel.stepLogistics.dataRetentionFieldDecimalError": "値は整数でなければなりません。",
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -22009,6 +22009,7 @@
"xpack.idxMgmt.dataStreamList.table.actionDeleteText": "删除",
"xpack.idxMgmt.dataStreamList.table.dataRetentionColumnTitle": "数据保留",
"xpack.idxMgmt.dataStreamList.table.dataRetentionColumnTooltip": "会至少在这个时长内保留数据,然后自动将其删除。数据保留值仅适用于由数据流直接管理的数据。{canDisableDataRetention, plural, one {如果某些数据受索引生命周期管理策略约束,则为数据流设置的数据保留值不适用于该数据。} other {}}",
"xpack.idxMgmt.dataStreamList.table.deleteDataStreamsButtonLabel": "删除{count, plural, other {数据流} }",
"xpack.idxMgmt.dataStreamList.table.healthColumnTitle": "运行状况",
"xpack.idxMgmt.dataStreamList.table.hiddenDataStreamBadge": "隐藏",
"xpack.idxMgmt.dataStreamList.table.indicesColumnTitle": "索引",
Expand All @@ -22024,16 +22025,21 @@
"xpack.idxMgmt.dataStreamListControls.includeStatsSwitchLabel": "包含统计信息",
"xpack.idxMgmt.dataStreamListControls.includeStatsSwitchToolTip": "包含统计信息可能会延长重新加载时间",
"xpack.idxMgmt.dataStreamListDescription.learnMoreLinkText": "了解详情。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.cancelButtonLabel": "取消",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionEnabledField": "启用数据保留",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionField": "数据保留",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionFieldNonNegativeError": "需要提供正值。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.dataRetentionFieldRequiredError": "数据保留值必填。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMButtonLabel": "ILM 策略",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMDescription": "要编辑此数据流的数据保留,必须编辑其关联 {link}。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMTitle": "此数据流及其关联索引由 ILM 管理",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.learnMoreLinkText": "工作原理?",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.saveButtonLabel": "保存",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.someManagedByILMBody": "一个或多个索引由 ILM 策略管理 ({viewAllIndicesLink})。更新此数据流的数据保留不会影响到这些索引。相反,您必须更新 {ilmPolicyLink} 策略。",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.someManagedByILMTitle": "某些索引由 ILM 管理",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.successDataRetentionNotification": "数据保留{disabledDataRetention, plural, one {已禁用} other {已更新} }",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.timeUnitField": "时间单位",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.unitsAriaLabel": "时间单位",
"xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.viewAllIndices": "查看索引",
"xpack.idxMgmt.dataStreamsDetailsPanel.manageButtonLabel": "管理",
"xpack.idxMgmt.dataStreamsDetailsPanel.stepLogistics.dataRetentionFieldDecimalError": "此值应为整数。",
Expand Down

0 comments on commit f95bbd7

Please sign in to comment.