diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index dcb17191c336e..c8aeea9e39379 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -367,6 +367,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D upgradeAssistant: { overview: `${KIBANA_DOCS}upgrade-assistant.html`, batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`, + indexBlocks: `${ELASTICSEARCH_DOCS}index-modules-blocks.html#index-block-settings`, remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`, unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`, reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`, diff --git a/src/platform/packages/shared/kbn-doc-links/src/types.ts b/src/platform/packages/shared/kbn-doc-links/src/types.ts index 42f1527725196..5d532c58b3a4c 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/types.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/types.ts @@ -324,6 +324,7 @@ export interface DocLinks { readonly upgradeAssistant: { readonly overview: string; readonly batchReindex: string; + readonly indexBlocks: string; readonly remoteReindex: string; readonly unfreezeApi: string; readonly reindexWithPipeline: string; diff --git a/x-pack/platform/plugins/private/translations/translations/fr-FR.json b/x-pack/platform/plugins/private/translations/translations/fr-FR.json index 29e78ec2bccc3..3f450568aae60 100644 --- a/x-pack/platform/plugins/private/translations/translations/fr-FR.json +++ b/x-pack/platform/plugins/private/translations/translations/fr-FR.json @@ -48232,51 +48232,6 @@ "xpack.upgradeAssistant.breadcrumb.esDeprecationsLabel": "Problèmes de déclassement Elasticsearch", "xpack.upgradeAssistant.breadcrumb.kibanaDeprecationsLabel": "Problèmes de déclassement Kibana", "xpack.upgradeAssistant.breadcrumb.overviewLabel": "Assistant de mise à niveau", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "Retour", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel": "Fermer", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "Continuer la réindexation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.fetchFailedCalloutTitle": "Statut de réindexation non disponible", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.insufficientPrivilegeCallout.calloutTitle": "Vous ne disposez pas de privilèges suffisants pour réindexer cet index", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceCalloutDescription": "L'utilisation du disque a dépassé le niveau inférieur, ce qui peut empêcher la réindexation. Les nœuds suivants sont affectés :", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceCalloutTitle": "Nœuds avec espace disque faible", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceUsedText": "{nodeName} ({available} disponible)", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail": "La réindexation s'effectue en arrière-plan. Vous pouvez revenir à l'assistant de mise à niveau pour visualiser la progression ou reprendre la réindexation après redémarrage de Kibana.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.reindexingLabel": "Réindexation…", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.restartLabel": "Redémarrer la réindexation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.resumeLabel": "Reprendre la réindexation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel": "Démarrer la réindexation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.tryAgainLabel": "Réessayer", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexDescription": "L'index sera en lecture seule pendant la réindexation. Vous ne pourrez pas ajouter, mettre à jour ni supprimer des documents avant la fin de la réindexation. Si vous avez besoin d'effectuer une réindexation dans un nouveau cluster, utilisez l'API de réindexation. {docsLink}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.aliasCreatedStepTitle": "Créez l'alias {indexName} pour l'index {reindexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.aliasesUpdatedStepTitle": "Mettez à jour les alias {existingAliases} afin qu'ils pointent vers l'index {reindexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancelLabel": "Annuler", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancelledLabel": "Annulé", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancellingLabel": "Annulation…", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.errorLabel": "Annulation impossible", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelledTitle": "Réindexation annulée.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.createIndexStepTitle": "Créez l'index {reindexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.aliasCreatedStepTitle": "Création de l'alias {indexName} pour l'index {reindexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.aliasesUpdatedStepTitle": "Mise à jour des alias {existingAliases} afin qu'ils pointent vers l'index {reindexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.createIndexStepTitle": "Création de l'index {reindexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.originalIndexDeletedStepTitle": "Suppression de l'index d'origine {indexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.readonlyStepTitle": "Définition de l'index {indexName} sur lecture seule.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.reindexingDocumentsStepTitle": "Réindexation des documents.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.originalIndexDeletedStepTitle": "Supprimez l'index d'origine {indexName}.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.readonlyStepTitle": "Définissez l'index {indexName} sur lecture seule.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.reindexingDocumentsStepTitle": "Réindexez les documents.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "Processus de réindexation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingFailedCalloutTitle": "Erreur de réindexation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingInProgressTitle": "Réindexation en cours… {percents}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.flyoutHeader": "Réindexer {index}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel": "En savoir plus", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.acceptChangesTitle": "Accepter les modifications", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningDetail": "Les paramètres d'index déclassés ont été détectés :", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningTitle": "Retirer les paramètres d'index déclassés", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutDetail": "Sauvegardez l'index avant de continuer. Pour poursuivre avec la réindexation, acceptez chaque modification.", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutTitle": "Cet index requiert des modifications destructives qui ne pourront pas être annulées", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.documentationLinkLabel": "Documentation", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.replaceIndexWithAliasWarningDetail": "Vous pourrez effectuer des recherches dans {indexName} comme avant. Pour supprimer les données, vous devrez supprimer {reindexName}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.replaceIndexWithAliasWarningTitle": "Remplacer l'index {indexName} par l'index {reindexName} et créer l'alias d'index {indexName}", "xpack.upgradeAssistant.deprecationBadge.criticalBadgeLabel": "Critique", "xpack.upgradeAssistant.deprecationBadge.resolvedBadgeLabel": "Résolu", "xpack.upgradeAssistant.deprecationBadge.warningBadgeLabel": "Avertissement", @@ -48302,6 +48257,7 @@ "xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionText": "Retirer les paramètres", "xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionTooltipLabel": "Corrigez ce problème en retirant les paramètres de ce cluster. La correction peut s'effectuer automatiquement.", "xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellLabel": "Manuel", + "xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel": "Ce problème doit être corrigé manuellement.", "xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel": "Fermer", "xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription": "Index : {indexName}", "xpack.upgradeAssistant.esDeprecations.healthIndicatorFlyout.closeButtonLabel": "Fermer", @@ -48315,6 +48271,60 @@ "xpack.upgradeAssistant.esDeprecations.indexSettings.deletingButtonLabel": "Retrait des paramètres en cours…", "xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionText": "Retirer les paramètres", "xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionTooltipLabel": "Corrigez ce problème en retirant les paramètres de cet index. La correction peut s'effectuer automatiquement.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.backButtonLabel": "Retour", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.closeButtonLabel": "Fermer", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.flyoutHeader": "Réindexer {index}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.learnMoreLinkLabel": "En savoir plus", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.fetchFailedCalloutTitle": "Statut de réindexation non disponible", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.insufficientPrivilegeCallout.calloutTitle": "Vous ne disposez pas de privilèges suffisants pour réindexer cet index", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceCalloutDescription": "L'utilisation du disque a dépassé le niveau inférieur, ce qui peut empêcher la réindexation. Les nœuds suivants sont affectés :", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceCalloutTitle": "Nœuds avec espace disque faible", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceUsedText": "{nodeName} ({available} disponible)", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.readonlyCallout.backgroundResumeDetail": "La réindexation s'effectue en arrière-plan. Vous pouvez revenir à l'assistant de mise à niveau pour visualiser la progression ou reprendre la réindexation après redémarrage de Kibana.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.reindexingLabel": "Réindexation…", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.restartLabel": "Redémarrer la réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.resumeLabel": "Reprendre la réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.runReindexLabel": "Démarrer la réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.tryAgainLabel": "Réessayer", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexDescription": "L'index sera en lecture seule pendant la réindexation. Vous ne pourrez pas ajouter, mettre à jour ni supprimer des documents avant la fin de la réindexation. Si vous avez besoin d'effectuer une réindexation dans un nouveau cluster, utilisez l'API de réindexation. {docsLink}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.aliasCreatedStepTitle": "Créez l'alias {indexName} pour l'index {reindexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.aliasesUpdatedStepTitle": "Mettez à jour les alias {existingAliases} afin qu'ils pointent vers l'index {reindexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancelLabel": "Annuler", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancelledLabel": "Annulé", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancellingLabel": "Annulation…", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.errorLabel": "Annulation impossible", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelledTitle": "Réindexation annulée.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.createIndexStepTitle": "Créez l'index {reindexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.aliasCreatedStepTitle": "Création de l'alias {indexName} pour l'index {reindexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.aliasesUpdatedStepTitle": "Mise à jour des alias {existingAliases} afin qu'ils pointent vers l'index {reindexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.createIndexStepTitle": "Création de l'index {reindexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.originalIndexDeletedStepTitle": "Suppression de l'index d'origine {indexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.readonlyStepTitle": "Définition de l'index {indexName} sur lecture seule.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.reindexingDocumentsStepTitle": "Réindexation des documents.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.originalIndexDeletedStepTitle": "Supprimez l'index d'origine {indexName}.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.readonlyStepTitle": "Définissez l'index {indexName} sur lecture seule.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.reindexingDocumentsStepTitle": "Réindexez les documents.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklistTitle": "Processus de réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingFailedCalloutTitle": "Erreur de réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingInProgressTitle": "Réindexation en cours… {percents}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.acceptChangesTitle": "Accepter les modifications", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.deprecatedIndexSettingsWarningDetail": "Les paramètres d'index déclassés ont été détectés :", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.deprecatedIndexSettingsWarningTitle": "Retirer les paramètres d'index déclassés", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.documentationLinkLabel": "Documentation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.calloutDetail": "Sauvegardez l'index avant de continuer. Pour poursuivre avec la réindexation, acceptez chaque modification.", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.calloutTitle": "Cet index requiert des modifications destructives qui ne pourront pas être annulées", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.continueButtonLabel": "Continuer la réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.replaceIndexWithAliasWarningDetail": "Vous pourrez effectuer des recherches dans {indexName} comme avant. Pour supprimer les données, vous devrez supprimer {reindexName}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.replaceIndexWithAliasWarningTitle": "Remplacer l'index {indexName} par l'index {reindexName} et créer l'alias d'index {indexName}", + "xpack.upgradeAssistant.esDeprecations.indices.reindexCanceledText": "Réindexation annulée", + "xpack.upgradeAssistant.esDeprecations.indices.reindexCompleteText": "Réindexation terminée", + "xpack.upgradeAssistant.esDeprecations.indices.reindexFailedText": "Échec de la réindexation", + "xpack.upgradeAssistant.esDeprecations.indices.reindexFetchFailedText": "Statut de réindexation non disponible", + "xpack.upgradeAssistant.esDeprecations.indices.reindexInProgressText": "Réindexation en cours…", + "xpack.upgradeAssistant.esDeprecations.indices.reindexLabel": "Réindexer", + "xpack.upgradeAssistant.esDeprecations.indices.reindexLoadingStatusText": "Chargement du statut…", + "xpack.upgradeAssistant.esDeprecations.indices.reindexPausedText": "Réindexation suspendue", + "xpack.upgradeAssistant.esDeprecations.indices.reindexTooltipLabel": "Corrigez ce problème en réindexant cet index. La correction peut s'effectuer automatiquement.", "xpack.upgradeAssistant.esDeprecations.loadingText": "Chargement des problèmes de déclassement…", "xpack.upgradeAssistant.esDeprecations.mlDeprecationTypeLabel": "Machine Learning", "xpack.upgradeAssistant.esDeprecations.mlSnapshots.deleteCompleteText": "Suppression terminée", @@ -48341,16 +48351,6 @@ "xpack.upgradeAssistant.esDeprecations.nodeDeprecationTypeLabel": "Nœud", "xpack.upgradeAssistant.esDeprecations.pageDescription": "Corrigez tout problème critique avant d'effectuer la mise à niveau. Avant d'effectuer des modifications, assurez-vous de disposer d'un snapshot actuel de votre cluster.", "xpack.upgradeAssistant.esDeprecations.pageTitle": "Problèmes de déclassement Elasticsearch", - "xpack.upgradeAssistant.esDeprecations.reindex.manualCellTooltipLabel": "Ce problème doit être corrigé manuellement.", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexCanceledText": "Réindexation annulée", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexCompleteText": "Réindexation terminée", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexFailedText": "Échec de la réindexation", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexFetchFailedText": "Statut de réindexation non disponible", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexInProgressText": "Réindexation en cours…", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexLoadingStatusText": "Chargement du statut…", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexPausedText": "Réindexation suspendue", - "xpack.upgradeAssistant.esDeprecations.reindex.resolutionLabel": "Réindexer", - "xpack.upgradeAssistant.esDeprecations.reindex.resolutionTooltipLabel": "Corrigez ce problème en réindexant cet index. La correction peut s'effectuer automatiquement.", "xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedDescription": "Vous avez {remoteClustersCount} {remoteClustersCount, plural, one {cluster distant configuré} other {clusters distants configurés}}. Si vous utilisez la recherche inter-clusters, notez que la version 8.x peut uniquement effectuer les recherches dans les clusters distants exécutant la version mineure précédente ou ultérieure. Si vous utilisez la réplication inter-clusters, un cluster contenant des index suiveurs doit exécuter la même version, ou une version plus récente, que le cluster distant.", "xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedTitle": "Compatibilité des clusters distants", "xpack.upgradeAssistant.esDeprecations.remoteClustersLinkText": "Affichez les clusters distants.", @@ -48467,8 +48467,8 @@ "xpack.upgradeAssistant.overview.pageDescription": "Préparez-vous pour la prochaine version de la Suite Elastic !", "xpack.upgradeAssistant.overview.pageTitle": "Assistant de mise à niveau", "xpack.upgradeAssistant.overview.snapshotRestoreLink": "Créer un snapshot", - "xpack.upgradeAssistant.overview.systemIndices.body": "Préparez les index système qui stockent des informations internes pour la mise à niveau. Cette préparation est requise uniquement lors des mises à jour des versions majeures. Tous les {hiddenIndicesLink} devant être réindexés seront affichés à l'étape suivante.", "xpack.upgradeAssistant.overview.systemIndices.body.hiddenIndicesLink": "index masqués", + "xpack.upgradeAssistant.overview.systemIndices.body": "Préparez les index système qui stockent des informations internes pour la mise à niveau. Cette préparation est requise uniquement lors des mises à jour des versions majeures. Tous les {hiddenIndicesLink} devant être réindexés seront affichés à l'étape suivante.", "xpack.upgradeAssistant.overview.systemIndices.errorLabel": "Échec de la migration", "xpack.upgradeAssistant.overview.systemIndices.featureNameTableColumn": "Fonctionnalité", "xpack.upgradeAssistant.overview.systemIndices.flyoutCloseButtonLabel": "Fermer", diff --git a/x-pack/platform/plugins/private/translations/translations/ja-JP.json b/x-pack/platform/plugins/private/translations/translations/ja-JP.json index e7f204ad08037..b332d95c063a3 100644 --- a/x-pack/platform/plugins/private/translations/translations/ja-JP.json +++ b/x-pack/platform/plugins/private/translations/translations/ja-JP.json @@ -48078,51 +48078,6 @@ "xpack.upgradeAssistant.breadcrumb.esDeprecationsLabel": "Elasticsearchの廃止予定の問題", "xpack.upgradeAssistant.breadcrumb.kibanaDeprecationsLabel": "Kibanaの廃止予定の問題", "xpack.upgradeAssistant.breadcrumb.overviewLabel": "アップグレードアシスタント", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "戻る", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel": "閉じる", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "再インデックスを続行", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.fetchFailedCalloutTitle": "再インデックスステータスがありません", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.insufficientPrivilegeCallout.calloutTitle": "このインデックスを再インデックスするための権限がありません", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceCalloutDescription": "ディスク使用量が低レベルを超えました。再インデックスが防止される場合があります。次のノードが影響を受けます。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceCalloutTitle": "ディスク容量が低下しているノード", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceUsedText": "{nodeName}({available}空き)", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail": "再インデックスはバックグラウンドで実行されます。アップグレードアシスタントに戻って進捗状況を表示するか、Kibanaの再起動後に再インデックスを再開できます。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.reindexingLabel": "再インデックス中…", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.restartLabel": "再インデックスの再起動", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.resumeLabel": "再インデックスの再開", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel": "再インデックスの開始", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.tryAgainLabel": "再試行", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexDescription": "再インデックス中はインデックスが読み取り専用です。再インデックスが完了するまでは、ドキュメントの追加、更新、削除ができません。新しいクラスターを再インデックスする必要がある場合は、再インデックスAPIを使用します。{docsLink}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.aliasCreatedStepTitle": "{reindexName}インデックスの{indexName}エイリアスを作成します。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.aliasesUpdatedStepTitle": "{reindexName}インデックスを参照する{existingAliases}エイリアスを更新します。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancelLabel": "キャンセル", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancelledLabel": "キャンセル済み", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancellingLabel": "キャンセル中…", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.errorLabel": "キャンセルできませんでした", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelledTitle": "再インデックスはキャンセルされました。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.createIndexStepTitle": "{reindexName}インデックスを作成します。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.aliasCreatedStepTitle": "{reindexName}インデックスの{indexName}エイリアスを作成しています。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.aliasesUpdatedStepTitle": "{reindexName}インデックスを参照する{existingAliases}エイリアスを更新しています。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.createIndexStepTitle": "{reindexName}インデックスを作成しています。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.originalIndexDeletedStepTitle": "元の{indexName}インデックスを削除しています。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.readonlyStepTitle": "{indexName}インデックスを読み取り専用に設定しています。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.reindexingDocumentsStepTitle": "ドキュメントを再インデックスしています。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.originalIndexDeletedStepTitle": "元の{indexName}インデックスを削除します。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.readonlyStepTitle": "{indexName}インデックスを読み取り専用に設定します。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.reindexingDocumentsStepTitle": "ドキュメントのインデックスを作成します。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "プロセスを再インデックス中", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingFailedCalloutTitle": "再インデックスエラー", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingInProgressTitle": "再インデックス中です...{percents}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.flyoutHeader": "再インデックス{index}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel": "詳細", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.acceptChangesTitle": "変更を承諾", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningDetail": "次の廃止予定のインデックス設定が検出されました。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningTitle": "廃止予定のインデックス設定を削除", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutDetail": "続行する前に、インデックスをバックアップしてください。再インデックスを続行するには、各変更を承諾してください。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutTitle": "このインデックスには元に戻すことのできない破壊的な変更が含まれています", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.documentationLinkLabel": "ドキュメント", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.replaceIndexWithAliasWarningDetail": "以前のように{indexName}を検索できます。データを削除するには、{reindexName}を削除する必要があります", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.replaceIndexWithAliasWarningTitle": "{indexName}インデックスを{reindexName}で置換し、{indexName}インデックスを作成", "xpack.upgradeAssistant.deprecationBadge.criticalBadgeLabel": "重大", "xpack.upgradeAssistant.deprecationBadge.resolvedBadgeLabel": "解決済み", "xpack.upgradeAssistant.deprecationBadge.warningBadgeLabel": "警告", @@ -48148,6 +48103,7 @@ "xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionText": "設定の削除", "xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionTooltipLabel": "このクラスターから設定を削除して、この問題を解決します。この問題は自動的に解決できます。", "xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellLabel": "手動", + "xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel": "この問題は自動的に解決する必要があります。", "xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel": "閉じる", "xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription": "インデックス:{indexName}", "xpack.upgradeAssistant.esDeprecations.healthIndicatorFlyout.closeButtonLabel": "閉じる", @@ -48161,6 +48117,60 @@ "xpack.upgradeAssistant.esDeprecations.indexSettings.deletingButtonLabel": "設定を削除中…", "xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionText": "設定の削除", "xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionTooltipLabel": "このインデックスから設定を削除して、この問題を解決します。この問題は自動的に解決できます。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.backButtonLabel": "戻る", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.closeButtonLabel": "閉じる", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.flyoutHeader": "再インデックス{index}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.learnMoreLinkLabel": "詳細", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.fetchFailedCalloutTitle": "再インデックスステータスがありません", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.insufficientPrivilegeCallout.calloutTitle": "このインデックスを再インデックスするための権限がありません", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceCalloutDescription": "ディスク使用量が低レベルを超えました。再インデックスが防止される場合があります。次のノードが影響を受けます。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceCalloutTitle": "ディスク容量が低下しているノード", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceUsedText": "{nodeName}({available}空き)", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.readonlyCallout.backgroundResumeDetail": "再インデックスはバックグラウンドで実行されます。アップグレードアシスタントに戻って進捗状況を表示するか、Kibanaの再起動後に再インデックスを再開できます。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.reindexingLabel": "再インデックス中…", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.restartLabel": "再インデックスの再起動", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.resumeLabel": "再インデックスの再開", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.runReindexLabel": "再インデックスの開始", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.tryAgainLabel": "再試行", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexDescription": "再インデックス中はインデックスが読み取り専用です。再インデックスが完了するまでは、ドキュメントの追加、更新、削除ができません。新しいクラスターを再インデックスする必要がある場合は、再インデックスAPIを使用します。{docsLink}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.aliasCreatedStepTitle": "{reindexName}インデックスの{indexName}エイリアスを作成します。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.aliasesUpdatedStepTitle": "{reindexName}インデックスを参照する{existingAliases}エイリアスを更新します。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancelLabel": "キャンセル", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancelledLabel": "キャンセル済み", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancellingLabel": "キャンセル中…", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.errorLabel": "キャンセルできませんでした", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelledTitle": "再インデックスはキャンセルされました。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.createIndexStepTitle": "{reindexName}インデックスを作成します。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.aliasCreatedStepTitle": "{reindexName}インデックスの{indexName}エイリアスを作成しています。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.aliasesUpdatedStepTitle": "{reindexName}インデックスを参照する{existingAliases}エイリアスを更新しています。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.createIndexStepTitle": "{reindexName}インデックスを作成しています。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.originalIndexDeletedStepTitle": "元の{indexName}インデックスを削除しています。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.readonlyStepTitle": "{indexName}インデックスを読み取り専用に設定しています。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.reindexingDocumentsStepTitle": "ドキュメントを再インデックスしています。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.originalIndexDeletedStepTitle": "元の{indexName}インデックスを削除します。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.readonlyStepTitle": "{indexName}インデックスを読み取り専用に設定します。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.reindexingDocumentsStepTitle": "ドキュメントのインデックスを作成します。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklistTitle": "プロセスを再インデックス中", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingFailedCalloutTitle": "再インデックスエラー", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingInProgressTitle": "再インデックス中です...{percents}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.acceptChangesTitle": "変更を承諾", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.deprecatedIndexSettingsWarningDetail": "次の廃止予定のインデックス設定が検出されました。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.deprecatedIndexSettingsWarningTitle": "廃止予定のインデックス設定を削除", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.documentationLinkLabel": "ドキュメント", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.calloutDetail": "続行する前に、インデックスをバックアップしてください。再インデックスを続行するには、各変更を承諾してください。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.calloutTitle": "このインデックスには元に戻すことのできない破壊的な変更が含まれています", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.continueButtonLabel": "再インデックスを続行", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.replaceIndexWithAliasWarningDetail": "以前のように{indexName}を検索できます。データを削除するには、{reindexName}を削除する必要があります", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.replaceIndexWithAliasWarningTitle": "{indexName}インデックスを{reindexName}で置換し、{indexName}インデックスを作成", + "xpack.upgradeAssistant.esDeprecations.indices.reindexCanceledText": "再インデックスはキャンセルされました", + "xpack.upgradeAssistant.esDeprecations.indices.reindexCompleteText": "再インデックス完了", + "xpack.upgradeAssistant.esDeprecations.indices.reindexFailedText": "再インデックス失敗", + "xpack.upgradeAssistant.esDeprecations.indices.reindexFetchFailedText": "再インデックスステータスがありません", + "xpack.upgradeAssistant.esDeprecations.indices.reindexInProgressText": "再インデックス中...", + "xpack.upgradeAssistant.esDeprecations.indices.reindexLabel": "再インデックス", + "xpack.upgradeAssistant.esDeprecations.indices.reindexLoadingStatusText": "ステータスを読み込んでいます...", + "xpack.upgradeAssistant.esDeprecations.indices.reindexPausedText": "再インデックスは一時停止されました", + "xpack.upgradeAssistant.esDeprecations.indices.reindexTooltipLabel": "このインデックスを再インデックスして、この問題を解決します。この問題は自動的に解決できます。", "xpack.upgradeAssistant.esDeprecations.loadingText": "廃止予定の問題を読み込んでいます...", "xpack.upgradeAssistant.esDeprecations.mlDeprecationTypeLabel": "機械学習", "xpack.upgradeAssistant.esDeprecations.mlSnapshots.deleteCompleteText": "削除完了", @@ -48187,16 +48197,6 @@ "xpack.upgradeAssistant.esDeprecations.nodeDeprecationTypeLabel": "ノード", "xpack.upgradeAssistant.esDeprecations.pageDescription": "アップグレード前に重要な問題をすべて解決してください。変更を行う前に、クラスターの現在のスナップショットがあることを確認してください。", "xpack.upgradeAssistant.esDeprecations.pageTitle": "Elasticsearchの廃止予定の問題", - "xpack.upgradeAssistant.esDeprecations.reindex.manualCellTooltipLabel": "この問題は自動的に解決する必要があります。", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexCanceledText": "再インデックスはキャンセルされました", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexCompleteText": "再インデックス完了", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexFailedText": "再インデックス失敗", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexFetchFailedText": "再インデックスステータスがありません", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexInProgressText": "再インデックス中...", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexLoadingStatusText": "ステータスを読み込んでいます...", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexPausedText": "再インデックスは一時停止されました", - "xpack.upgradeAssistant.esDeprecations.reindex.resolutionLabel": "再インデックス", - "xpack.upgradeAssistant.esDeprecations.reindex.resolutionTooltipLabel": "このインデックスを再インデックスして、この問題を解決します。この問題は自動的に解決できます。", "xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedDescription": "{remoteClustersCount} {remoteClustersCount, plural, other {個のリモートクラスター}}が構成されています。クラスター横断検索を使用する場合、8.xは前のマイナーバージョン以降を実行しているリモートクラスターのみを検索できます。クラスター横断レプリケーションを使用する場合、フォロワーインデックスを含むクラスターは、リモートクラスターと同じかそれ以上のバージョンを実行する必要があります。", "xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedTitle": "リモートクラスターの互換性", "xpack.upgradeAssistant.esDeprecations.remoteClustersLinkText": "リモートクラスターを表示します。", @@ -48313,8 +48313,8 @@ "xpack.upgradeAssistant.overview.pageDescription": "次のバージョンのElastic Stackをお待ちください。", "xpack.upgradeAssistant.overview.pageTitle": "アップグレードアシスタント", "xpack.upgradeAssistant.overview.snapshotRestoreLink": "スナップショットの作成", - "xpack.upgradeAssistant.overview.systemIndices.body": "アップグレードの内部情報を格納するシステムインデックスを準備します。これはメジャーバージョンアップグレード中にのみ必要です。インデックスを再作成する必要があるすべての{hiddenIndicesLink}は次のステップで表示されます。", "xpack.upgradeAssistant.overview.systemIndices.body.hiddenIndicesLink": "非表示のインデックス", + "xpack.upgradeAssistant.overview.systemIndices.body": "アップグレードの内部情報を格納するシステムインデックスを準備します。これはメジャーバージョンアップグレード中にのみ必要です。インデックスを再作成する必要があるすべての{hiddenIndicesLink}は次のステップで表示されます。", "xpack.upgradeAssistant.overview.systemIndices.errorLabel": "移行失敗", "xpack.upgradeAssistant.overview.systemIndices.featureNameTableColumn": "機能", "xpack.upgradeAssistant.overview.systemIndices.flyoutCloseButtonLabel": "閉じる", diff --git a/x-pack/platform/plugins/private/translations/translations/zh-CN.json b/x-pack/platform/plugins/private/translations/translations/zh-CN.json index 891f5e3bf6b77..18544be6ec15c 100644 --- a/x-pack/platform/plugins/private/translations/translations/zh-CN.json +++ b/x-pack/platform/plugins/private/translations/translations/zh-CN.json @@ -48185,51 +48185,6 @@ "xpack.upgradeAssistant.breadcrumb.esDeprecationsLabel": "Elasticsearch 弃用问题", "xpack.upgradeAssistant.breadcrumb.kibanaDeprecationsLabel": "Kibana 弃用问题", "xpack.upgradeAssistant.breadcrumb.overviewLabel": "升级助手", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.cancelButtonLabel": "返回", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel": "关闭", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "继续重新索引", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.fetchFailedCalloutTitle": "重新索引状态不可用", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.insufficientPrivilegeCallout.calloutTitle": "您没有足够的权限来重新索引此索引", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceCalloutDescription": "磁盘使用已超出低水位线,这可能会阻止重新索引。以下节点会受到影响:", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceCalloutTitle": "磁盘空间不足的节点", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.lowDiskSpaceUsedText": "{nodeName}({available} 可用)", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail": "将在后台执行重新索引。可以返回到升级助手,查看在 Kibana 重新启动之后恢复重新索引的进度。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.reindexingLabel": "正在重新索引……", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.restartLabel": "重新启动重新索引", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.resumeLabel": "恢复重新索引", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel": "启动重新索引", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.tryAgainLabel": "重试", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexDescription": "重新索引期间,索引将处于只读状态。在重新索引完成之前,您无法添加、更新或删除文档。如果需要重新索引到新集群,请使用重新索引 API。{docsLink}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.aliasCreatedStepTitle": "创建 {reindexName} 索引的 {indexName} 别名。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.aliasesUpdatedStepTitle": "更新 {existingAliases} 别名以指向 {reindexName} 索引。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancelLabel": "取消", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancelledLabel": "已取消", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.cancellingLabel": "正在取消……", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelButton.errorLabel": "无法取消", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.cancelledTitle": "重新索引已取消。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.createIndexStepTitle": "创建 {reindexName} 索引。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.aliasCreatedStepTitle": "正在创建 {reindexName} 索引的 {indexName} 别名。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.aliasesUpdatedStepTitle": "正在更新 {existingAliases} 别名以指向 {reindexName} 索引。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.createIndexStepTitle": "正在创建 {reindexName} 索引。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.originalIndexDeletedStepTitle": "正在删除原始 {indexName} 索引。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.readonlyStepTitle": "正在将 {indexName} 索引设置为只读。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.inProgress.reindexingDocumentsStepTitle": "正在重新索引文档。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.originalIndexDeletedStepTitle": "删除原始 {indexName} 索引。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.readonlyStepTitle": "将 {indexName} 索引设置为只读。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.reindexingDocumentsStepTitle": "索引文档。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "重新索引过程", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingFailedCalloutTitle": "重新索引错误", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingInProgressTitle": "重新索引正在进行中……{percents}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.flyoutHeader": "重新索引 {index}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel": "了解详情", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.acceptChangesTitle": "接受更改", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningDetail": "检测到以下弃用的索引设置:", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningTitle": "移除弃用的索引设置", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutDetail": "继续前备份索引。要继续重新索引,请接受每个更改。", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.destructiveCallout.calloutTitle": "此索引需要无法恢复的破坏性更改", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.documentationLinkLabel": "文档", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.replaceIndexWithAliasWarningDetail": "您可以像以前一样搜索 {indexName}。要删除数据,必须删除 {reindexName}", - "xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.replaceIndexWithAliasWarningTitle": "将 {indexName} 索引替换为 {reindexName} 索引,然后创建 {indexName} 索引别名", "xpack.upgradeAssistant.deprecationBadge.criticalBadgeLabel": "紧急", "xpack.upgradeAssistant.deprecationBadge.resolvedBadgeLabel": "已解决", "xpack.upgradeAssistant.deprecationBadge.warningBadgeLabel": "警告", @@ -48255,6 +48210,7 @@ "xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionText": "移除设置", "xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionTooltipLabel": "通过从此集群中移除设置来解决该问题。此问题会自动解决。", "xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellLabel": "手动", + "xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel": "此问题需要手动解决。", "xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel": "关闭", "xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription": "索引:{indexName}", "xpack.upgradeAssistant.esDeprecations.healthIndicatorFlyout.closeButtonLabel": "关闭", @@ -48268,6 +48224,60 @@ "xpack.upgradeAssistant.esDeprecations.indexSettings.deletingButtonLabel": "设置移除进行中……", "xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionText": "移除设置", "xpack.upgradeAssistant.esDeprecations.indexSettings.resolutionTooltipLabel": "通过从此索引中移除设置来解决该问题。此问题会自动解决。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.backButtonLabel": "返回", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.closeButtonLabel": "关闭", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.flyoutHeader": "重新索引 {index}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.learnMoreLinkLabel": "了解详情", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.fetchFailedCalloutTitle": "重新索引状态不可用", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.insufficientPrivilegeCallout.calloutTitle": "您没有足够的权限来重新索引此索引", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceCalloutDescription": "磁盘使用已超出低水位线,这可能会阻止重新索引。以下节点会受到影响:", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceCalloutTitle": "磁盘空间不足的节点", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.lowDiskSpaceUsedText": "{nodeName}({available} 可用)", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.readonlyCallout.backgroundResumeDetail": "将在后台执行重新索引。可以返回到升级助手,查看在 Kibana 重新启动之后恢复重新索引的进度。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.reindexingLabel": "正在重新索引……", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.restartLabel": "重新启动重新索引", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.resumeLabel": "恢复重新索引", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.runReindexLabel": "启动重新索引", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexButton.tryAgainLabel": "重试", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexDescription": "重新索引期间,索引将处于只读状态。在重新索引完成之前,您无法添加、更新或删除文档。如果需要重新索引到新集群,请使用重新索引 API。{docsLink}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.aliasCreatedStepTitle": "创建 {reindexName} 索引的 {indexName} 别名。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.aliasesUpdatedStepTitle": "更新 {existingAliases} 别名以指向 {reindexName} 索引。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancelLabel": "取消", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancelledLabel": "已取消", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.cancellingLabel": "正在取消……", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelButton.errorLabel": "无法取消", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.cancelledTitle": "重新索引已取消。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.createIndexStepTitle": "创建 {reindexName} 索引。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.aliasCreatedStepTitle": "正在创建 {reindexName} 索引的 {indexName} 别名。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.aliasesUpdatedStepTitle": "正在更新 {existingAliases} 别名以指向 {reindexName} 索引。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.createIndexStepTitle": "正在创建 {reindexName} 索引。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.originalIndexDeletedStepTitle": "正在删除原始 {indexName} 索引。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.readonlyStepTitle": "正在将 {indexName} 索引设置为只读。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.inProgress.reindexingDocumentsStepTitle": "正在重新索引文档。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.originalIndexDeletedStepTitle": "删除原始 {indexName} 索引。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.readonlyStepTitle": "将 {indexName} 索引设置为只读。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklist.reindexingDocumentsStepTitle": "索引文档。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingChecklistTitle": "重新索引过程", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingFailedCalloutTitle": "重新索引错误", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.reindexStep.reindexingInProgressTitle": "重新索引正在进行中……{percents}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.acceptChangesTitle": "接受更改", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.deprecatedIndexSettingsWarningDetail": "检测到以下弃用的索引设置:", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.deprecatedIndexSettingsWarningTitle": "移除弃用的索引设置", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.documentationLinkLabel": "文档", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.calloutDetail": "继续前备份索引。要继续重新索引,请接受每个更改。", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.calloutTitle": "此索引需要无法恢复的破坏性更改", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.reindex.continueButtonLabel": "继续重新索引", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.replaceIndexWithAliasWarningDetail": "您可以像以前一样搜索 {indexName}。要删除数据,必须删除 {reindexName}", + "xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.warningsStep.replaceIndexWithAliasWarningTitle": "将 {indexName} 索引替换为 {reindexName} 索引,然后创建 {indexName} 索引别名", + "xpack.upgradeAssistant.esDeprecations.indices.reindexCanceledText": "已取消重新索引", + "xpack.upgradeAssistant.esDeprecations.indices.reindexCompleteText": "重新索引完成", + "xpack.upgradeAssistant.esDeprecations.indices.reindexFailedText": "重新索引失败", + "xpack.upgradeAssistant.esDeprecations.indices.reindexFetchFailedText": "重新索引状态不可用", + "xpack.upgradeAssistant.esDeprecations.indices.reindexInProgressText": "重新索引正在进行中……", + "xpack.upgradeAssistant.esDeprecations.indices.reindexLabel": "重新索引", + "xpack.upgradeAssistant.esDeprecations.indices.reindexLoadingStatusText": "正在加载状态……", + "xpack.upgradeAssistant.esDeprecations.indices.reindexPausedText": "重新索引已暂停", + "xpack.upgradeAssistant.esDeprecations.indices.reindexTooltipLabel": "通过重新索引此索引来解决此问题。此问题会自动解决。", "xpack.upgradeAssistant.esDeprecations.loadingText": "正在加载弃用问题……", "xpack.upgradeAssistant.esDeprecations.mlDeprecationTypeLabel": "Machine Learning", "xpack.upgradeAssistant.esDeprecations.mlSnapshots.deleteCompleteText": "删除完成", @@ -48294,16 +48304,6 @@ "xpack.upgradeAssistant.esDeprecations.nodeDeprecationTypeLabel": "节点", "xpack.upgradeAssistant.esDeprecations.pageDescription": "请在升级之前解决所有紧急问题。做出更改之前,请确保具有集群的当前快照。", "xpack.upgradeAssistant.esDeprecations.pageTitle": "Elasticsearch 弃用问题", - "xpack.upgradeAssistant.esDeprecations.reindex.manualCellTooltipLabel": "此问题需要手动解决。", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexCanceledText": "已取消重新索引", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexCompleteText": "重新索引完成", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexFailedText": "重新索引失败", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexFetchFailedText": "重新索引状态不可用", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexInProgressText": "重新索引正在进行中……", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexLoadingStatusText": "正在加载状态……", - "xpack.upgradeAssistant.esDeprecations.reindex.reindexPausedText": "重新索引已暂停", - "xpack.upgradeAssistant.esDeprecations.reindex.resolutionLabel": "重新索引", - "xpack.upgradeAssistant.esDeprecations.reindex.resolutionTooltipLabel": "通过重新索引此索引来解决此问题。此问题会自动解决。", "xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedDescription": "您配置了 {remoteClustersCount} 个{remoteClustersCount, plural, other {远程集群}}。如果使用跨集群搜索,请注意,8.x 只能搜索运行之前的次要版本或更高版本的远程集群。如果使用跨集群复制,则包含 Follower 索引的集群必须运行与远程集群相同或更新的版本。", "xpack.upgradeAssistant.esDeprecations.remoteClustersDetectedTitle": "远程集群兼容性", "xpack.upgradeAssistant.esDeprecations.remoteClustersLinkText": "查看远程集群。", @@ -48420,8 +48420,8 @@ "xpack.upgradeAssistant.overview.pageDescription": "准备使用下一版 Elastic Stack!", "xpack.upgradeAssistant.overview.pageTitle": "升级助手", "xpack.upgradeAssistant.overview.snapshotRestoreLink": "创建快照", - "xpack.upgradeAssistant.overview.systemIndices.body": "为升级准备存储内部信息的系统索引。仅在主要版本升级期间需要此项。将在下一步中显示任何需要重新索引的{hiddenIndicesLink}。", "xpack.upgradeAssistant.overview.systemIndices.body.hiddenIndicesLink": "隐藏的索引", + "xpack.upgradeAssistant.overview.systemIndices.body": "为升级准备存储内部信息的系统索引。仅在主要版本升级期间需要此项。将在下一步中显示任何需要重新索引的{hiddenIndicesLink}。", "xpack.upgradeAssistant.overview.systemIndices.errorLabel": "迁移失败", "xpack.upgradeAssistant.overview.systemIndices.featureNameTableColumn": "功能", "xpack.upgradeAssistant.overview.systemIndices.flyoutCloseButtonLabel": "关闭", diff --git a/x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts b/x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts index ad5d5d74f8059..7c0686cee48fd 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/reindex_deprecation_flyout.test.ts @@ -21,6 +21,8 @@ const defaultReindexStatusMeta: ReindexStatusResponse['meta'] = { indexName: 'foo', reindexName: 'reindexed-foo', aliases: [], + isFrozen: false, + isReadonly: false, }; describe('Reindex deprecation flyout', () => { @@ -75,28 +77,22 @@ describe('Reindex deprecation flyout', () => { expect(exists('reindexDetails')).toBe(true); expect(find('reindexDetails.flyoutTitle').text()).toContain( - `Reindex ${reindexDeprecation.index}` + `Update ${reindexDeprecation.index}` ); }); it('renders error callout when reindex fails', async () => { - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - - testBed.component.update(); - - const { actions, exists } = testBed; - - await actions.table.clickDeprecationRowAt('reindex', 0); - httpRequestsMockHelpers.setStartReindexingResponse(MOCK_REINDEX_DEPRECATION.index!, undefined, { statusCode: 404, message: 'no such index [test]', }); - await actions.reindexDeprecationFlyout.clickReindexButton(); + const { actions, exists } = testBed; + await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step + expect(exists('reindexDetails')).toBe(true); expect(exists('reindexDetails.reindexingFailedCallout')).toBe(true); }); @@ -106,28 +102,16 @@ describe('Reindex deprecation flyout', () => { message: 'no such index [test]', }); - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - - testBed.component.update(); - const { actions, exists } = testBed; await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step expect(exists('reindexDetails.fetchFailedCallout')).toBe(true); }); describe('reindexing progress', () => { - it('has not started yet', async () => { - const { actions, find, exists } = testBed; - - await actions.table.clickDeprecationRowAt('reindex', 0); - expect(find('reindexChecklistTitle').text()).toEqual('Reindexing process'); - expect(exists('cancelReindexingDocumentsButton')).toBe(false); - }); - it('has started but not yet reindexing documents', async () => { httpRequestsMockHelpers.setReindexStatusResponse(MOCK_REINDEX_DEPRECATION.index!, { reindexOp: { @@ -140,14 +124,11 @@ describe('Reindex deprecation flyout', () => { meta: defaultReindexStatusMeta, }); - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - - testBed.component.update(); const { actions, find, exists } = testBed; await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step expect(find('reindexChecklistTitle').text()).toEqual('Reindexing in progress… 5%'); expect(exists('cancelReindexingDocumentsButton')).toBe(false); @@ -165,14 +146,11 @@ describe('Reindex deprecation flyout', () => { meta: defaultReindexStatusMeta, }); - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - - testBed.component.update(); const { actions, find, exists } = testBed; await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step expect(find('reindexChecklistTitle').text()).toEqual('Reindexing in progress… 30%'); expect(exists('cancelReindexingDocumentsButton')).toBe(true); @@ -190,14 +168,11 @@ describe('Reindex deprecation flyout', () => { meta: defaultReindexStatusMeta, }); - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - - testBed.component.update(); const { actions, find, exists } = testBed; await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step expect(find('reindexChecklistTitle').text()).toEqual('Reindexing in progress… 90%'); expect(exists('cancelReindexingDocumentsButton')).toBe(false); @@ -215,14 +190,11 @@ describe('Reindex deprecation flyout', () => { meta: defaultReindexStatusMeta, }); - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - const { actions, find, exists, component } = testBed; - component.update(); await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step expect(find('reindexChecklistTitle').text()).toEqual('Reindexing in progress… 95%'); expect(exists('cancelReindexingDocumentsButton')).toBe(false); @@ -250,14 +222,11 @@ describe('Reindex deprecation flyout', () => { }, ]); - await act(async () => { - testBed = await setupElasticsearchPage(httpSetup); - }); - - testBed.component.update(); const { actions, find } = testBed; await actions.table.clickDeprecationRowAt('reindex', 0); + await actions.reindexDeprecationFlyout.clickReindexButton(); // details step + await actions.reindexDeprecationFlyout.clickReindexButton(); // warning step expect(find('lowDiskSpaceCallout').text()).toContain('Nodes with low disk space'); expect(find('impactedNodeListItem').length).toEqual(1); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts b/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts index 7d614463f4977..9304e54560fd2 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/common/types.ts @@ -54,8 +54,10 @@ export interface ReindexStatusResponse { reindexName: string; // Array of aliases pointing to the index being reindexed aliases: string[]; + isReadonly: boolean; + isFrozen: boolean; }; - warnings?: ReindexWarning[]; + warnings?: IndexWarning[]; reindexOp?: ReindexOperation; hasRequiredPrivileges?: boolean; } @@ -136,10 +138,11 @@ export interface ReindexOperation { export type ReindexSavedObject = SavedObject; // 8.0 -> 9.0 warnings -export type ReindexWarningTypes = 'indexSetting' | 'replaceIndexWithAlias'; +export type IndexWarningType = 'indexSetting' | 'replaceIndexWithAlias' | 'makeIndexReadonly'; -export interface ReindexWarning { - warningType: ReindexWarningTypes; +export interface IndexWarning { + warningType: IndexWarningType; + flow: 'reindex' | 'readonly' | 'all'; /** * Optional metadata for deprecations * @@ -147,7 +150,7 @@ export interface ReindexWarning { * For "indexSetting" we want to surface the deprecated settings. */ meta?: { - [key: string]: string | string[]; + [key: string]: string | string[] | boolean; }; } @@ -202,6 +205,10 @@ export interface ReindexAction { blockerForReindexing?: 'index-closed'; // 'index-closed' can be handled automatically, but requires more resources, user should be warned } +export interface UnfreezeAction { + type: 'unfreeze'; +} + export interface MlAction { type: 'mlSnapshot'; snapshotId: string; @@ -237,11 +244,11 @@ export interface EnrichedDeprecationInfo | 'ilm_policies' | 'templates'; isCritical: boolean; - frozen?: boolean; status?: estypes.HealthReportIndicatorHealthStatus; index?: string; correctiveAction?: | ReindexAction + | UnfreezeAction | MlAction | IndexSettingAction | ClusterSettingAction diff --git a/x-pack/platform/plugins/private/upgrade_assistant/common/update_index.ts b/x-pack/platform/plugins/private/upgrade_assistant/common/update_index.ts new file mode 100644 index 0000000000000..e9421e6807d58 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/common/update_index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type UpdateIndexOperation = 'blockWrite' | 'unfreeze'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_step_progress.scss b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/_step_progress.scss similarity index 100% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/_step_progress.scss rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/_step_progress.scss diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/step_progress.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/step_progress.tsx similarity index 100% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/step_progress.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/common/step_progress.tsx diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.tsx index fcfefe897dfa8..b42fe4ab3df2c 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/checklist/progress.tsx @@ -14,10 +14,10 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment'; import { DataStreamMigrationStatus } from '../../../../../../../../../common/types'; import type { MigrationState } from '../../../use_migration_state'; -import { StepProgress, StepProgressStep } from '../../../../reindex/flyout/step_progress'; import { getDataStreamReindexProgress } from '../../../../../../../lib/utils'; import { MigrateDocumentsStepTitle } from './progress_title'; import { CancelLoadingState } from '../../../../../../types'; +import { StepProgress, type StepProgressStep } from '../../../../../common/step_progress'; interface Props { migrationState: MigrationState; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/callouts.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/callouts.tsx index d56897ca1c370..116280e179d5d 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/callouts.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/data_streams/flyout/steps/confirm/callouts.tsx @@ -14,7 +14,7 @@ export const ReindexWarningCallout: React.FunctionComponent<{}> = () => { } @@ -23,7 +23,7 @@ export const ReindexWarningCallout: React.FunctionComponent<{}> = () => { >

@@ -36,7 +36,7 @@ export const ReadonlyWarningCallout: React.FunctionComponent<{}> = () => { } @@ -45,7 +45,7 @@ export const ReadonlyWarningCallout: React.FunctionComponent<{}> = () => { >

diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx index 034610d874e7d..34a09fdc93243 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/index.tsx @@ -8,7 +8,7 @@ export { MlSnapshotsTableRow } from './ml_snapshots'; export { IndexSettingsTableRow } from './index_settings'; export { DefaultTableRow } from './default'; -export { ReindexTableRow } from './reindex'; +export { IndexTableRow } from './indices'; export { DataStreamTableRow } from './data_streams'; export { ClusterSettingsTableRow } from './cluster_settings'; export { HealthIndicatorTableRow } from './health_indicator'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/context.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/context.tsx new file mode 100644 index 0000000000000..6f81b7c07bfc0 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/context.tsx @@ -0,0 +1,71 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { createContext, useContext } from 'react'; + +import { ApiService } from '../../../../lib/api'; +import { useReindex, ReindexState } from './use_reindex'; +import { UpdateIndexState, useUpdateIndex } from './use_update_index'; +import { EnrichedDeprecationInfo } from '../../../../../../common/types'; + +export interface IndexStateContext { + deprecation: EnrichedDeprecationInfo; + reindexState: ReindexState; + startReindex: () => Promise; + cancelReindex: () => Promise; + updateIndexState: UpdateIndexState; + updateIndex: () => Promise; +} + +const IndexContext = createContext(undefined); + +export const useIndexContext = () => { + const context = useContext(IndexContext); + if (context === undefined) { + throw new Error('useIndexContext must be used within a '); + } + return context; +}; + +interface Props { + api: ApiService; + children: React.ReactNode; + deprecation: EnrichedDeprecationInfo; +} + +export const IndexStatusProvider: React.FunctionComponent = ({ + api, + deprecation, + children, +}) => { + const indexName = deprecation.index!; + const { reindexState, startReindex, cancelReindex } = useReindex({ + indexName, + api, + }); + + const { updateIndexState, updateIndex } = useUpdateIndex({ + indexName, + api, + correctiveAction: deprecation.correctiveAction, + }); + + return ( + + {children} + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/container.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/container.tsx new file mode 100644 index 0000000000000..cda76c81b6e2c --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/container.tsx @@ -0,0 +1,251 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiFlyoutHeader, EuiSpacer, EuiTitle } from '@elastic/eui'; +import { METRIC_TYPE } from '@kbn/analytics'; + +import { EnrichedDeprecationInfo, ReindexStatus } from '../../../../../../../common/types'; + +import type { IndexStateContext } from '../context'; +import { DeprecationBadge } from '../../../../shared'; +import { + UIM_REINDEX_READONLY_CLICK, + UIM_REINDEX_READONLY_RETRY_CLICK, + UIM_REINDEX_START_CLICK, + UIM_REINDEX_STOP_CLICK, + UIM_REINDEX_UNFREEZE_CLICK, + UIM_REINDEX_UNFREEZE_RETRY_CLICK, + uiMetricService, +} from '../../../../../lib/ui_metric'; +import { + ReindexDetailsFlyoutStep, + UnfreezeDetailsFlyoutStep, + UpdateIndexFlyoutStep, + ReindexFlyoutStep, + WarningFlyoutStep, + type FlyoutStep, +} from './steps'; + +export interface IndexFlyoutProps extends IndexStateContext { + deprecation: EnrichedDeprecationInfo; + closeFlyout: () => void; +} + +export const IndexFlyout: React.FunctionComponent = ({ + reindexState, + startReindex, + cancelReindex, + updateIndexState, + updateIndex, + closeFlyout, + deprecation, +}) => { + const { status: reindexStatus, reindexWarnings } = reindexState; + const { status: updateIndexStatus } = updateIndexState; + const { index, correctiveAction } = deprecation; + + const [flyoutStep, setFlyoutStep] = useState('details'); + + useEffect(() => { + switch (reindexStatus) { + case ReindexStatus.failed: + case ReindexStatus.fetchFailed: + case ReindexStatus.cancelled: + case ReindexStatus.inProgress: + case ReindexStatus.completed: { + setFlyoutStep('reindexing'); + break; + } + default: { + switch (updateIndexStatus) { + case 'inProgress': + case 'complete': + case 'failed': { + setFlyoutStep(correctiveAction?.type === 'unfreeze' ? 'unfreeze' : 'makeReadonly'); + break; + } + default: { + setFlyoutStep('details'); + break; + } + } + } + } + }, [correctiveAction?.type, reindexStatus, updateIndexStatus]); + + const onStartReindex = useCallback(() => { + uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_START_CLICK); + startReindex(); + }, [startReindex]); + + const onMakeReadonly = useCallback(async () => { + uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_READONLY_CLICK); + await updateIndex(); + }, [updateIndex]); + + const onMakeReadonlyRetry = useCallback(async () => { + uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_READONLY_RETRY_CLICK); + await updateIndex(); + }, [updateIndex]); + + const onUnfreeze = useCallback(async () => { + uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_UNFREEZE_CLICK); + await updateIndex(); + }, [updateIndex]); + + const onUnfreezeRetry = useCallback(async () => { + uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_UNFREEZE_RETRY_CLICK); + await updateIndex(); + }, [updateIndex]); + + const onStopReindex = useCallback(() => { + uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_STOP_CLICK); + cancelReindex(); + }, [cancelReindex]); + + const startReindexWithWarnings = useCallback(() => { + if ( + reindexWarnings && + reindexWarnings.length > 0 && + reindexStatus !== ReindexStatus.inProgress && + reindexStatus !== ReindexStatus.completed + ) { + setFlyoutStep('confirmReindex'); + } else { + onStartReindex(); + } + }, [reindexWarnings, reindexStatus, onStartReindex]); + + const flyoutContents = useMemo(() => { + switch (flyoutStep) { + case 'details': + return correctiveAction?.type === 'unfreeze' ? ( + // we will show specific unfreeze details/flow for: + // A) 7.x indices that are frozen AND read-only (should be an edge case) + { + setFlyoutStep('confirmReindex'); + }} + unfreeze={() => { + setFlyoutStep('unfreeze'); + onUnfreeze(); + }} + updateIndexState={updateIndexState} + reindexState={reindexState} + /> + ) : ( + // we will show specific reindex details/flow for: + // B) 7.x indices that are frozen AND NOT read-only (should be the most common scenario) + // C) 7.x indices that are not frozen + // C.1) if they are read-only => this will be a WARNING deprecation + // C.2) if they are NOT read-only => this will be a CRITICAL deprecation + { + setFlyoutStep('confirmReindex'); + }} + startReadonly={() => { + setFlyoutStep('confirmReadonly'); + }} + updateIndexState={updateIndexState} + reindexState={reindexState} + /> + ); + case 'confirmReadonly': + case 'confirmReindex': + const flow = flyoutStep === 'confirmReadonly' ? 'readonly' : 'reindex'; + return ( + warningFlow === 'all' || warningFlow === flow + ) ?? [] + } + meta={reindexState.meta} + flow={flow} + back={() => setFlyoutStep('details')} + confirm={() => { + if (flyoutStep === 'confirmReadonly') { + setFlyoutStep('makeReadonly'); + onMakeReadonly(); + } else { + onStartReindex(); + } + }} + /> + ); + case 'reindexing': + return ( + + ); + case 'unfreeze': + return ( + + ); + case 'makeReadonly': + return ( + + ); + } + }, [ + flyoutStep, + correctiveAction?.type, + closeFlyout, + updateIndexState, + reindexState, + startReindexWithWarnings, + onStopReindex, + onUnfreezeRetry, + onMakeReadonlyRetry, + onUnfreeze, + onMakeReadonly, + onStartReindex, + ]); + + return ( + <> + + + + +

+ +

+
+
+ + {flyoutContents} + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/index.tsx similarity index 71% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/index.tsx index dad239ddb81b3..87ae80e7f0708 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/index.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/index.tsx @@ -5,5 +5,5 @@ * 2.0. */ -export type { ReindexFlyoutProps } from './container'; -export { ReindexFlyout } from './container'; +export type { IndexFlyoutProps } from './container'; +export { IndexFlyout } from './container'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/index.ts b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/index.ts new file mode 100644 index 0000000000000..c5880db9832f7 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { ReindexDetailsFlyoutStep } from './reindex_details_step'; +export { UnfreezeDetailsFlyoutStep } from './unfreeze_details_step'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/messages.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/messages.tsx new file mode 100644 index 0000000000000..cb3d6626c2ed3 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/messages.tsx @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { ReindexStatus } from '../../../../../../../../../common/types'; + +export const getReindexButtonLabel = (status?: ReindexStatus) => { + switch (status) { + case ReindexStatus.fetchFailed: + case ReindexStatus.failed: + return ( + + ); + case ReindexStatus.inProgress: + return ( + + ); + case ReindexStatus.cancelled: + return ( + + ); + default: + return ( + + ); + } +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/reindex_details_step.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/reindex_details_step.test.tsx new file mode 100644 index 0000000000000..7861ccd9e482f --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/reindex_details_step.test.tsx @@ -0,0 +1,290 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { shallow } from 'enzyme'; +import React from 'react'; +import { ReindexDetailsFlyoutStep } from './reindex_details_step'; +import type { ReindexState } from '../../../use_reindex'; +import type { UpdateIndexState } from '../../../use_update_index'; +import { LoadingState } from '../../../../../../types'; +import { cloneDeep } from 'lodash'; + +jest.mock('../../../../../../../app_context', () => { + const { docLinksServiceMock } = jest.requireActual('@kbn/core-doc-links-browser-mocks'); + + return { + useAppContext: () => { + return { + services: { + api: { + useLoadNodeDiskSpace: () => [], + }, + core: { + docLinks: docLinksServiceMock.createStartContract(), + http: { + basePath: { + prepend: jest.fn(), + }, + }, + }, + }, + }; + }, + }; +}); + +describe('ReindexDetailsFlyoutStep', () => { + const defaultReindexState: ReindexState = { + loadingState: LoadingState.Success, + meta: { + indexName: 'some_index', + aliases: [], + isFrozen: false, + isReadonly: false, + reindexName: 'some_index-reindexed-for-9', + }, + hasRequiredPrivileges: true, + reindexTaskPercComplete: null, + errorMessage: null, + }; + + const defaultUpdateIndexState: UpdateIndexState = { + status: 'incomplete', + failedBefore: false, + }; + + it('renders for non-readonly indices', () => { + const wrapper = shallow( + + ); + + expect(wrapper).toMatchInlineSnapshot(` + + + +

+ +

+ + +
, + "title": "Option 1: Reindex data", + }, + Object { + "description": + + Learn more + , + } + } + /> + , + "title": "Option 2: Mark as read-only", + }, + Object { + "description": + + + , + } + } + /> + , + "title": "Option 3: Delete index", + }, + ] + } + rowGutterSize="m" + /> + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ `); + }); + + it('renders for readonly indices (warning deprecation)', () => { + const props = cloneDeep(defaultReindexState); + props.meta.isReadonly = true; + + const wrapper = shallow( + + ); + + expect(wrapper).toMatchInlineSnapshot(` + + + +

+ +

+

+ +

+
+ +
+ + + + + + + + + + + + + + + + + + +
+ `); + }); +}); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/reindex_details_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/reindex_details_step.tsx new file mode 100644 index 0000000000000..b246081a955e7 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/reindex_details_step.tsx @@ -0,0 +1,290 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment } from 'react'; + +import { + EuiButton, + EuiButtonEmpty, + EuiCallOut, + EuiDescriptionList, + EuiFlexGroup, + EuiFlexItem, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiLink, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; + +import { ReindexStatus } from '../../../../../../../../../common/types'; +import { LoadingState } from '../../../../../../types'; +import type { ReindexState } from '../../../use_reindex'; +import { useAppContext } from '../../../../../../../app_context'; +import { getReindexButtonLabel } from './messages'; +import { FrozenCallOut } from '../frozen_callout'; +import type { UpdateIndexState } from '../../../use_update_index'; +import { FetchFailedCallOut } from '../fetch_failed_callout'; +import { ReindexingFailedCallOut } from '../reindexing_failed_callout'; + +/** + * Displays a flyout that shows the details / corrective action for a "reindex" deprecation for a given index. + */ +export const ReindexDetailsFlyoutStep: React.FunctionComponent<{ + reindexState: ReindexState; + updateIndexState: UpdateIndexState; + startReindex: () => void; + startReadonly: () => void; + closeFlyout: () => void; +}> = ({ reindexState, updateIndexState, startReindex, startReadonly, closeFlyout }) => { + const { + services: { + api, + core: { docLinks, http }, + }, + } = useAppContext(); + + const { loadingState, status: reindexStatus, hasRequiredPrivileges, meta } = reindexState; + const { status: updateIndexStatus } = updateIndexState; + const { indexName } = meta; + const loading = loadingState === LoadingState.Loading; + const isCompleted = reindexStatus === ReindexStatus.completed || updateIndexStatus === 'complete'; + const hasFetchFailed = reindexStatus === ReindexStatus.fetchFailed; + const hasReindexingFailed = reindexStatus === ReindexStatus.failed; + + const { data: nodes } = api.useLoadNodeDiskSpace(); + + return ( + + + {hasRequiredPrivileges === false && ( + + + + } + color="danger" + iconType="warning" + /> + + )} + + {nodes && nodes.length > 0 && ( + <> + + } + > + <> + + + + +
    + {nodes.map(({ nodeName, available, nodeId }) => ( +
  • + +
  • + ))} +
+ +
+ + + )} + + {hasFetchFailed && } + + {!hasFetchFailed && hasReindexingFailed && ( + + )} + + {meta.isFrozen && } + + + {meta.isReadonly && ( + +

+ +

+

+ +

+
+ )} + {!meta.isReadonly && ( + +

+ +

+ + +
+ ), + }, + { + title: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.detailsStep.reindex.option2.title', + { + defaultMessage: 'Option 2: Mark as read-only', + } + ), + description: ( + + + {i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.learnMoreLinkLabel', + { + defaultMessage: 'Learn more', + } + )} + + ), + }} + /> + + ), + }, + { + title: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.detailsStep.reindex.option3.title', + { + defaultMessage: 'Option 3: Delete index', + } + ), + description: ( + + + + + ), + }} + /> + + ), + }, + ]} + /> +
+ )} + + + + + + + + + + + + + {!meta.isReadonly && !hasFetchFailed && !isCompleted && hasRequiredPrivileges && ( + + + + + + )} + {!hasFetchFailed && !isCompleted && hasRequiredPrivileges && ( + + + {getReindexButtonLabel(reindexStatus)} + + + )} + + + + + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/unfreeze_details_step.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/unfreeze_details_step.test.tsx new file mode 100644 index 0000000000000..3a3cfffb551d0 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/unfreeze_details_step.test.tsx @@ -0,0 +1,198 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { shallow } from 'enzyme'; +import React from 'react'; +import type { ReindexState } from '../../../use_reindex'; +import type { UpdateIndexState } from '../../../use_update_index'; +import { LoadingState } from '../../../../../../types'; +import { UnfreezeDetailsFlyoutStep } from './unfreeze_details_step'; + +jest.mock('../../../../../../../app_context', () => { + const { docLinksServiceMock } = jest.requireActual('@kbn/core-doc-links-browser-mocks'); + + return { + useAppContext: () => { + return { + services: { + api: { + useLoadNodeDiskSpace: () => [], + }, + core: { + docLinks: docLinksServiceMock.createStartContract(), + http: { + basePath: { + prepend: jest.fn(), + }, + }, + }, + }, + }; + }, + }; +}); + +describe('UnfreezeDetailsFlyoutStep', () => { + const defaultReindexState: ReindexState = { + loadingState: LoadingState.Success, + meta: { + indexName: 'some_index', + aliases: [], + isFrozen: true, + isReadonly: true, + reindexName: 'some_index-reindexed-for-9', + }, + hasRequiredPrivileges: true, + reindexTaskPercComplete: null, + errorMessage: null, + }; + + const defaultUpdateIndexState: UpdateIndexState = { + status: 'incomplete', + failedBefore: false, + }; + + it('renders', () => { + const wrapper = shallow( + + ); + + expect(wrapper).toMatchInlineSnapshot(` + + + +

+ +

+ + +
, + "title": "Option 1: Unfreeze index", + }, + Object { + "description": + + , + "title": "Option 2: Reindex data", + }, + Object { + "description": + + + , + } + } + /> + , + "title": "Option 3: Delete index", + }, + ] + } + rowGutterSize="m" + /> + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ `); + }); +}); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/unfreeze_details_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/unfreeze_details_step.tsx new file mode 100644 index 0000000000000..21d85ffada41a --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/details/unfreeze_details_step.tsx @@ -0,0 +1,253 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment } from 'react'; + +import { i18n } from '@kbn/i18n'; +import { + EuiButton, + EuiButtonEmpty, + EuiCallOut, + EuiDescriptionList, + EuiFlexGroup, + EuiFlexItem, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiLink, + EuiSpacer, + EuiText, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +import { ReindexStatus } from '../../../../../../../../../common/types'; +import { LoadingState } from '../../../../../../types'; +import type { ReindexState } from '../../../use_reindex'; +import { useAppContext } from '../../../../../../../app_context'; +import { getReindexButtonLabel } from './messages'; +import type { UpdateIndexState } from '../../../use_update_index'; +import { FetchFailedCallOut } from '../fetch_failed_callout'; +import { ReindexingFailedCallOut } from '../reindexing_failed_callout'; + +/** + * Displays a flyout that shows the details / corrective action for a "reindex" deprecation for a given index. + */ +export const UnfreezeDetailsFlyoutStep: React.FunctionComponent<{ + closeFlyout: () => void; + reindexState: ReindexState; + updateIndexState: UpdateIndexState; + startReindex: () => void; + unfreeze: () => void; +}> = ({ closeFlyout, reindexState, updateIndexState, startReindex, unfreeze }) => { + const { + services: { + api, + core: { http }, + }, + } = useAppContext(); + + const { loadingState, status: reindexStatus, hasRequiredPrivileges, meta } = reindexState; + const { status: updateIndexStatus } = updateIndexState; + const { indexName } = meta; + const loading = loadingState === LoadingState.Loading; + const isCompleted = reindexStatus === ReindexStatus.completed || updateIndexStatus === 'complete'; + const hasFetchFailed = reindexStatus === ReindexStatus.fetchFailed; + const hasReindexingFailed = reindexStatus === ReindexStatus.failed; + + const { data: nodes } = api.useLoadNodeDiskSpace(); + + return ( + + + {hasRequiredPrivileges === false && ( + + + + } + color="danger" + iconType="warning" + /> + + )} + + {nodes && nodes.length > 0 && ( + <> + + } + > + <> + + + + +
    + {nodes.map(({ nodeName, available, nodeId }) => ( +
  • + +
  • + ))} +
+ +
+ + + )} + + {hasFetchFailed && } + + {!hasFetchFailed && hasReindexingFailed && ( + + )} + + +

+ +

+ + +
+ ), + }, + { + title: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.detailsStep.unfreeze.option2.title', + { + defaultMessage: 'Option 2: Reindex data', + } + ), + description: ( + + + + ), + }, + { + title: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.detailsStep.unfreeze.option3.title', + { + defaultMessage: 'Option 3: Delete index', + } + ), + description: ( + + + + + ), + }} + /> + + ), + }, + ]} + /> + + +
+ + + + + + + + + + {!hasFetchFailed && !isCompleted && hasRequiredPrivileges && ( + + + {getReindexButtonLabel(reindexStatus)} + + + )} + {!hasFetchFailed && !isCompleted && hasRequiredPrivileges && ( + + + + + + )} + + + + +
+ ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/fetch_failed_callout.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/fetch_failed_callout.tsx new file mode 100644 index 0000000000000..36fea18acd5b5 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/fetch_failed_callout.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment } from 'react'; +import { EuiCallOut, EuiSpacer } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +interface Props { + errorMessage: string; +} + +export const FetchFailedCallOut: React.FunctionComponent = (props) => { + const { errorMessage } = props; + return ( + + + } + > + {errorMessage} + + + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/frozen_callout.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/frozen_callout.tsx new file mode 100644 index 0000000000000..bc7b5ae96be46 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/frozen_callout.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment } from 'react'; +import { EuiCallOut, EuiLink, EuiSpacer } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; +import { useAppContext } from '../../../../../../app_context'; + +export const FrozenCallOut: React.FunctionComponent = () => { + const { + services: { + core: { docLinks }, + }, + } = useAppContext(); + + return ( + + + } + iconType="iInCircle" + > + + {i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.learnMoreLinkLabel', + { + defaultMessage: 'Learn more', + } + )} + + ), + }} + /> + + + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/index.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/index.tsx new file mode 100644 index 0000000000000..ab9e6f5ae1400 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/index.tsx @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type { FlyoutStep } from './types'; +export { ReindexDetailsFlyoutStep } from './details/reindex_details_step'; +export { UnfreezeDetailsFlyoutStep } from './details/unfreeze_details_step'; +export { WarningFlyoutStep } from './warning/warning_step'; +export { ReindexFlyoutStep } from './reindex/reindex_step'; +export { UpdateIndexFlyoutStep } from './update/update_step'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/__snapshots__/reindex_step.test.tsx.snap similarity index 71% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/__snapshots__/reindex_step.test.tsx.snap index f790b5173ce61..8aae77d5181a2 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/__snapshots__/reindex_step.test.tsx.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ChecklistFlyout renders 1`] = ` +exports[`ReindexStep renders 1`] = `

@@ -39,6 +39,8 @@ exports[`ChecklistFlyout renders 1`] = ` "meta": Object { "aliases": Array [], "indexName": "myIndex", + "isFrozen": false, + "isReadonly": false, "reindexName": "reindexed-myIndex", }, "reindexTaskPercComplete": null, @@ -62,7 +64,7 @@ exports[`ChecklistFlyout renders 1`] = ` > @@ -79,7 +81,7 @@ exports[`ChecklistFlyout renders 1`] = ` > @@ -88,14 +90,15 @@ exports[`ChecklistFlyout renders 1`] = `
`; -exports[`ChecklistFlyout renders for frozen indices 1`] = ` +exports[`ReindexStep renders for frozen indices 1`] = ` +

- - } - > - - Learn more - , - } - } - /> - -

@@ -152,6 +130,8 @@ exports[`ChecklistFlyout renders for frozen indices 1`] = ` "meta": Object { "aliases": Array [], "indexName": "myIndex", + "isFrozen": true, + "isReadonly": false, "reindexName": "reindexed-myIndex", }, "reindexTaskPercComplete": null, @@ -175,7 +155,7 @@ exports[`ChecklistFlyout renders for frozen indices 1`] = ` > @@ -192,7 +172,7 @@ exports[`ChecklistFlyout renders for frozen indices 1`] = ` > diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/progress.test.tsx similarity index 82% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.test.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/progress.test.tsx index 37137d46f2285..880f71321e3c5 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.test.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/progress.test.tsx @@ -8,9 +8,9 @@ import { shallow } from 'enzyme'; import React from 'react'; -import { ReindexStatus, ReindexStep } from '../../../../../../../common/types'; -import { LoadingState } from '../../../../types'; -import type { ReindexState } from '../use_reindex_state'; +import { ReindexStatus, ReindexStep } from '../../../../../../../../../common/types'; +import { LoadingState } from '../../../../../../types'; +import type { ReindexState } from '../../../use_reindex'; import { ReindexProgress } from './progress'; describe('ReindexProgress', () => { @@ -28,6 +28,8 @@ describe('ReindexProgress', () => { indexName: 'foo', reindexName: 'reindexed-foo', aliases: [], + isFrozen: false, + isReadonly: false, }, } as ReindexState } @@ -44,7 +46,7 @@ describe('ReindexProgress', () => {

{ "status": "inProgress", "title": @@ -74,7 +76,7 @@ describe('ReindexProgress', () => { "status": "incomplete", "title": @@ -96,6 +98,8 @@ describe('ReindexProgress', () => { "meta": Object { "aliases": Array [], "indexName": "foo", + "isFrozen": false, + "isReadonly": false, "reindexName": "reindexed-foo", }, "reindexTaskPercComplete": null, @@ -108,7 +112,7 @@ describe('ReindexProgress', () => { "status": "incomplete", "title": @@ -125,7 +129,7 @@ describe('ReindexProgress', () => { "status": "incomplete", "title": @@ -142,7 +146,7 @@ describe('ReindexProgress', () => { "status": "incomplete", "title": @@ -173,6 +177,8 @@ describe('ReindexProgress', () => { indexName: 'foo', reindexName: 'reindexed-foo', aliases: [], + isFrozen: true, + isReadonly: false, }, } as ReindexState } diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/progress.tsx similarity index 78% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/progress.tsx index 8457225c43fa6..6a72672edbcf7 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/progress.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/progress.tsx @@ -18,11 +18,11 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { ReindexStatus, ReindexStep } from '../../../../../../../common/types'; -import { CancelLoadingState } from '../../../../types'; -import type { ReindexState } from '../use_reindex_state'; -import { StepProgress, StepProgressStep } from './step_progress'; -import { getReindexProgressLabel } from '../../../../../lib/utils'; +import { ReindexStatus, ReindexStep } from '../../../../../../../../../common/types'; +import { CancelLoadingState } from '../../../../../../types'; +import type { ReindexState } from '../../../use_reindex'; +import { StepProgress, StepProgressStep } from '../../../../../common/step_progress'; +import { getReindexProgressLabel } from '../../../../../../../lib/utils'; const ErrorCallout: React.FunctionComponent<{ errorMessage: string | null }> = ({ errorMessage, @@ -49,7 +49,7 @@ const ReindexingDocumentsStepTitle: React.FunctionComponent<{ return ( <> @@ -71,7 +71,7 @@ const ReindexingDocumentsStepTitle: React.FunctionComponent<{ case CancelLoadingState.Loading: cancelText = ( ); @@ -79,7 +79,7 @@ const ReindexingDocumentsStepTitle: React.FunctionComponent<{ case CancelLoadingState.Success: cancelText = ( ); @@ -87,7 +87,7 @@ const ReindexingDocumentsStepTitle: React.FunctionComponent<{ case CancelLoadingState.Error: cancelText = ( ); @@ -95,7 +95,7 @@ const ReindexingDocumentsStepTitle: React.FunctionComponent<{ default: cancelText = ( ); @@ -106,12 +106,12 @@ const ReindexingDocumentsStepTitle: React.FunctionComponent<{ {stepInProgress ? ( ) : ( )} @@ -141,7 +141,7 @@ const getStepTitle = ( if (step === ReindexStep.readonly) { return inProgress ? ( {meta.indexName}, @@ -149,7 +149,7 @@ const getStepTitle = ( /> ) : ( {meta.indexName}, @@ -161,7 +161,7 @@ const getStepTitle = ( if (step === ReindexStep.newIndexCreated) { return inProgress ? ( {meta.reindexName}, @@ -169,7 +169,7 @@ const getStepTitle = ( /> ) : ( {meta.reindexName}, @@ -181,7 +181,7 @@ const getStepTitle = ( if (step === ReindexStep.indexSettingsRestored) { return inProgress ? ( {meta.indexName}, @@ -190,7 +190,7 @@ const getStepTitle = ( /> ) : ( {meta.indexName}, @@ -203,7 +203,7 @@ const getStepTitle = ( if (step === ReindexStep.aliasCreated) { return inProgress ? ( {meta.indexName}, @@ -212,7 +212,7 @@ const getStepTitle = ( /> ) : ( {meta.indexName}, @@ -225,7 +225,7 @@ const getStepTitle = ( if (step === ReindexStep.originalIndexDeleted) { return inProgress ? ( {meta.indexName}, @@ -233,7 +233,7 @@ const getStepTitle = ( /> ) : ( {meta.indexName}, @@ -245,7 +245,7 @@ const getStepTitle = ( if (step === ReindexStep.existingAliasesUpdated) { return inProgress ? ( {`[${meta.aliases.join(',')}]`}, @@ -254,7 +254,7 @@ const getStepTitle = ( /> ) : ( {`[${meta.aliases.join(',')}]`}, @@ -378,7 +378,7 @@ export const ReindexProgress: React.FunctionComponent = (props) => {

{status === ReindexStatus.inProgress ? ( = (props) => { /> ) : ( )} diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/reindex_step.test.tsx similarity index 67% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/reindex_step.test.tsx index a895f5fad815d..0041db4dc2f52 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.test.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/reindex_step.test.tsx @@ -9,12 +9,12 @@ import { shallow } from 'enzyme'; import { cloneDeep } from 'lodash'; import React from 'react'; -import { ReindexStatus } from '../../../../../../../common/types'; -import { LoadingState } from '../../../../types'; -import type { ReindexState } from '../use_reindex_state'; -import { ChecklistFlyoutStep } from './checklist_step'; +import { ReindexStatus } from '../../../../../../../../../common/types'; +import { LoadingState } from '../../../../../../types'; +import type { ReindexState } from '../../../use_reindex'; +import { ReindexFlyoutStep } from './reindex_step'; -jest.mock('../../../../../app_context', () => { +jest.mock('../../../../../../../app_context', () => { const { docLinksServiceMock } = jest.requireActual('@kbn/core-doc-links-browser-mocks'); return { @@ -33,10 +33,9 @@ jest.mock('../../../../../app_context', () => { }; }); -describe('ChecklistFlyout', () => { +describe('ReindexStep', () => { const defaultProps = { indexName: 'myIndex', - frozen: false, closeFlyout: jest.fn(), confirmInputValue: 'CONFIRM', onConfirmInputChange: jest.fn(), @@ -60,31 +59,33 @@ describe('ChecklistFlyout', () => { indexName: 'myIndex', reindexName: 'reindexed-myIndex', aliases: [], + isReadonly: false, + isFrozen: false, }, } as ReindexState, }; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect(shallow()).toMatchSnapshot(); }); it('renders for frozen indices', () => { const props = cloneDeep(defaultProps); - props.frozen = true; - expect(shallow()).toMatchSnapshot(); + props.reindexState.meta.isFrozen = true; + expect(shallow()).toMatchSnapshot(); }); it('disables button while reindexing', () => { const props = cloneDeep(defaultProps); props.reindexState.status = ReindexStatus.inProgress; - const wrapper = shallow(); + const wrapper = shallow(); expect((wrapper.find('EuiButton').props() as any).isLoading).toBe(true); }); it('hides button if hasRequiredPrivileges is false', () => { const props = cloneDeep(defaultProps); props.reindexState.hasRequiredPrivileges = false; - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.exists('EuiButton')).toBe(false); }); @@ -92,24 +93,30 @@ describe('ChecklistFlyout', () => { const props = cloneDeep(defaultProps); props.reindexState.status = ReindexStatus.fetchFailed; props.reindexState.errorMessage = 'Index not found'; - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper.exists('EuiButton')).toBe(false); }); - it('shows get status error callout', () => { + it('shows fetch failed error callout', () => { const props = cloneDeep(defaultProps); props.reindexState.status = ReindexStatus.fetchFailed; props.reindexState.errorMessage = 'Index not found'; - const wrapper = shallow(); - expect(wrapper.exists('[data-test-subj="fetchFailedCallout"]')).toBe(true); + const wrapper = shallow(); + expect(wrapper.find('FetchFailedCallOut').exists()).toBe(true); + expect(wrapper.find('FetchFailedCallOut').props()).toEqual({ + errorMessage: 'Index not found', + }); }); it('shows reindexing callout', () => { const props = cloneDeep(defaultProps); props.reindexState.status = ReindexStatus.failed; - props.reindexState.errorMessage = 'Index not found'; - const wrapper = shallow(); - expect(wrapper.exists('[data-test-subj="reindexingFailedCallout"]')).toBe(true); + props.reindexState.errorMessage = 'Reindex failed'; + const wrapper = shallow(); + expect(wrapper.find('ReindexingFailedCallOut').exists()).toBe(true); + expect(wrapper.find('ReindexingFailedCallOut').props()).toEqual({ + errorMessage: 'Reindex failed', + }); }); it('calls startReindex when button is clicked', () => { @@ -121,7 +128,7 @@ describe('ChecklistFlyout', () => { status: undefined, }, }; - const wrapper = shallow(); + const wrapper = shallow(); wrapper.find('EuiButton').simulate('click'); expect(props.startReindex).toHaveBeenCalled(); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/reindex_step.tsx similarity index 58% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/reindex_step.tsx index 0710d560d7d93..e0e9c44a8eea2 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/checklist_step.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindex/reindex_step.tsx @@ -22,46 +22,49 @@ import { import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { ReindexStatus } from '../../../../../../../common/types'; -import { LoadingState } from '../../../../types'; -import type { ReindexState } from '../use_reindex_state'; +import { ReindexStatus } from '../../../../../../../../../common/types'; +import { LoadingState } from '../../../../../../types'; +import type { ReindexState } from '../../../use_reindex'; import { ReindexProgress } from './progress'; -import { useAppContext } from '../../../../../app_context'; +import { useAppContext } from '../../../../../../../app_context'; +import { FrozenCallOut } from '../frozen_callout'; +import { FetchFailedCallOut } from '../fetch_failed_callout'; +import { ReindexingFailedCallOut } from '../reindexing_failed_callout'; const buttonLabel = (status?: ReindexStatus) => { switch (status) { case ReindexStatus.failed: return ( ); case ReindexStatus.inProgress: return ( ); case ReindexStatus.paused: return ( ); case ReindexStatus.cancelled: return ( ); default: return ( ); @@ -71,13 +74,12 @@ const buttonLabel = (status?: ReindexStatus) => { /** * Displays a flyout that shows the current reindexing status for a given index. */ -export const ChecklistFlyoutStep: React.FunctionComponent<{ - frozen?: boolean; +export const ReindexFlyoutStep: React.FunctionComponent<{ closeFlyout: () => void; reindexState: ReindexState; startReindex: () => void; cancelReindex: () => void; -}> = ({ frozen, closeFlyout, reindexState, startReindex, cancelReindex }) => { +}> = ({ closeFlyout, reindexState, startReindex, cancelReindex }) => { const { services: { api, @@ -96,13 +98,14 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ return ( + {reindexState.meta.isFrozen && } {hasRequiredPrivileges === false && ( } @@ -111,7 +114,6 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ /> )} - {nodes && nodes.length > 0 && ( <> } > <> @@ -137,7 +139,7 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ {nodes.map(({ nodeName, available, nodeId }) => (
  • )} - - {(hasFetchFailed || hasReindexingFailed) && ( - <> - - ) : ( - - ) - } - > - {reindexState.errorMessage} - - - + {hasFetchFailed && } + {!hasFetchFailed && hasReindexingFailed && ( + )} -

    {i18n.translate( - 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel', + 'xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.learnMoreLinkLabel', { defaultMessage: 'Learn more', } @@ -198,40 +177,9 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ }} />

    - {frozen && ( - <> - - } - iconType="iInCircle" - > - - {i18n.translate( - 'xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel', - { - defaultMessage: 'Learn more', - } - )} - - ), - }} - /> - - - - )}

    @@ -244,7 +192,7 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{ diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindexing_failed_callout.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindexing_failed_callout.tsx new file mode 100644 index 0000000000000..4b713575c1907 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/reindexing_failed_callout.tsx @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment } from 'react'; +import { EuiCallOut, EuiSpacer } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +interface Props { + errorMessage: string; +} + +export const ReindexingFailedCallOut: React.FunctionComponent = (props) => { + const { errorMessage } = props; + return ( + + + } + > + {errorMessage} + + + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/types.ts b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/types.ts new file mode 100644 index 0000000000000..43a59deda42bf --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/types.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type FlyoutStep = + | 'details' + | 'confirmReadonly' + | 'confirmReindex' + | 'reindexing' + | 'makeReadonly' + | 'unfreeze' + | 'completed'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/update/update_step.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/update/update_step.test.tsx new file mode 100644 index 0000000000000..678255afb7b02 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/update/update_step.test.tsx @@ -0,0 +1,167 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { shallow } from 'enzyme'; +import React from 'react'; +import { UpdateIndexFlyoutStep } from './update_step'; +import type { ReindexState } from '../../../use_reindex'; +import type { UpdateIndexState } from '../../../use_update_index'; + +describe('UpdateIndexFlyoutStep', () => { + const meta: ReindexState['meta'] = { + indexName: 'some_index', + aliases: [], + isFrozen: false, + isReadonly: false, + reindexName: 'some_index-reindexed-for-9', + }; + + const defaultUpdateIndexState: UpdateIndexState = { + status: 'incomplete', + failedBefore: false, + }; + + it('renders makeReadonly operation', () => { + const wrapper = shallow( + + ); + + expect(wrapper).toMatchInlineSnapshot(` + + + +

    + +

    +
    + + + some_index + , + } + } + />, + }, + ] + } + /> +
    + + + + + + + + + +
    + `); + }); + + it('renders unfreeze operation', () => { + const wrapper = shallow( + + ); + + expect(wrapper).toMatchInlineSnapshot(` + + + +

    + +

    +
    + + + some_index + , + } + } + />, + }, + ] + } + /> +
    + + + + + + + + + +
    + `); + }); +}); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/update/update_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/update/update_step.tsx new file mode 100644 index 0000000000000..4e4bcfca8a359 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/update/update_step.tsx @@ -0,0 +1,143 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { Fragment } from 'react'; +import { + EuiButton, + EuiButtonEmpty, + EuiCallOut, + EuiCode, + EuiFlexGroup, + EuiFlexItem, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiSpacer, + EuiText, + EuiTitle, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +import type { UpdateIndexState } from '../../../use_update_index'; +import { FrozenCallOut } from '../frozen_callout'; +import { StepProgress, type StepProgressStep } from '../../../../../common/step_progress'; +import type { ReindexState } from '../../../use_reindex'; + +interface UpdateIndexFlyoutStepProps { + action: 'unfreeze' | 'makeReadonly'; + closeFlyout: () => void; + meta: ReindexState['meta']; + updateIndexState: UpdateIndexState; + retry: () => void; +} + +const ErrorCallout: React.FunctionComponent<{ reason: string }> = ({ reason }) => ( + + +

    {reason}

    +
    +
    +); + +/** + * In charge of rendering the result of the make read-only calls + */ +export const UpdateIndexFlyoutStep: React.FunctionComponent = ({ + action, + closeFlyout, + meta, + updateIndexState, + retry, +}) => { + const { isFrozen, indexName } = meta; + const { status, failedBefore, reason } = updateIndexState; + const title = + action === 'makeReadonly' ? ( + {indexName}, + }} + /> + ) : ( + {indexName}, + }} + /> + ); + + const steps: StepProgressStep[] = [ + { + title, + status, + ...(reason && { children: }), + }, + ]; + + return ( + + + {isFrozen && } + +

    + {(status === 'inProgress' || status === 'incomplete') && ( + + )} + {status === 'complete' && ( + + )} + {status === 'failed' && ( + + )} +

    +
    + + +
    + + + + + + + + {status !== 'complete' && failedBefore && ( + + + + + + )} + + +
    + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/warning_step.test.tsx.snap b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/__snapshots__/warning_step.test.tsx.snap similarity index 73% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/warning_step.test.tsx.snap rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/__snapshots__/warning_step.test.tsx.snap index 8c45baf390461..3fb592c0d707d 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/__snapshots__/warning_step.test.tsx.snap +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/__snapshots__/warning_step.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`WarningsFlyoutStep renders 1`] = ` +exports[`WarningFlyoutStep renders 1`] = ` @@ -17,7 +17,7 @@ exports[`WarningsFlyoutStep renders 1`] = ` >
    @@ -26,13 +26,14 @@ exports[`WarningsFlyoutStep renders 1`] = ` > diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step.test.tsx similarity index 68% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step.test.tsx index 7c6f7d554082a..98b1612c76ed7 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step.test.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step.test.tsx @@ -10,12 +10,12 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; import SemVer from 'semver/classes/semver'; -import { ReindexWarning } from '../../../../../../../common/types'; -import { idForWarning, WarningsFlyoutStep } from './warnings_step'; +import { idForWarning, WarningFlyoutStep } from './warning_step'; +import { IndexWarning } from '../../../../../../../../../common/types'; const kibanaVersion = new SemVer('8.0.0'); -jest.mock('../../../../../app_context', () => { +jest.mock('../../../../../../../app_context', () => { const { docLinksServiceMock } = jest.requireActual('@kbn/core-doc-links-browser-mocks'); return { @@ -31,20 +31,23 @@ jest.mock('../../../../../app_context', () => { }; }); -describe('WarningsFlyoutStep', () => { +describe('WarningFlyoutStep', () => { const defaultProps = { - warnings: [] as ReindexWarning[], - hideWarningsStep: jest.fn(), - continueReindex: jest.fn(), + warnings: [] as IndexWarning[], + back: jest.fn(), + confirm: jest.fn(), + flow: 'reindex' as const, meta: { indexName: 'foo', reindexName: 'reindexed-foo', aliases: [], + isFrozen: false, + isReadonly: false, }, }; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect(shallow()).toMatchSnapshot(); }); if (kibanaVersion.major === 7) { @@ -53,28 +56,29 @@ describe('WarningsFlyoutStep', () => { ...defaultProps, warnings: [ { + flow: 'all' as const, warningType: 'indexSetting', meta: { deprecatedSettings: ['index.force_memory_term_dictionary'], }, }, - ] as ReindexWarning[], + ] as IndexWarning[], }; const wrapper = mount( - + ); const button = wrapper.find('EuiButton'); button.simulate('click'); - expect(defaultPropsWithWarnings.continueReindex).not.toHaveBeenCalled(); + expect(defaultPropsWithWarnings.confirm).not.toHaveBeenCalled(); // first warning (indexSetting) wrapper.find(`input#${idForWarning(1)}`).simulate('change'); button.simulate('click'); - expect(defaultPropsWithWarnings.continueReindex).toHaveBeenCalled(); + expect(defaultPropsWithWarnings.confirm).toHaveBeenCalled(); }); } }); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step.tsx new file mode 100644 index 0000000000000..cefb2f03df723 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step.tsx @@ -0,0 +1,213 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useState } from 'react'; + +import { + EuiButton, + EuiButtonEmpty, + EuiCallOut, + EuiFlexGroup, + EuiFlexItem, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiSpacer, + EuiTitle, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +import { + IndexWarning, + IndexWarningType, + ReindexStatusResponse, +} from '../../../../../../../../../common/types'; +import { useAppContext } from '../../../../../../../app_context'; +import { + DeprecatedSettingWarningCheckbox, + ReplaceIndexWithAliasWarningCheckbox, + MakeIndexReadonlyWarningCheckbox, + WarningCheckboxProps, +} from './warning_step_checkbox'; +import { FrozenCallOut } from '../frozen_callout'; + +interface CheckedIds { + [id: string]: boolean; +} + +const warningToComponentMap: { + [key in IndexWarningType]: React.FunctionComponent; +} = { + indexSetting: DeprecatedSettingWarningCheckbox, + replaceIndexWithAlias: ReplaceIndexWithAliasWarningCheckbox, + makeIndexReadonly: MakeIndexReadonlyWarningCheckbox, +}; + +export const idForWarning = (id: number) => `reindexWarning-${id}`; +interface WarningFlyoutStepProps { + back: () => void; + confirm: () => void; + flow: 'readonly' | 'reindex'; + meta: ReindexStatusResponse['meta']; + warnings: IndexWarning[]; +} + +/** + * Displays warning text about destructive changes required to reindex this index. The user + * must acknowledge each change before being allowed to proceed. + */ +export const WarningFlyoutStep: React.FunctionComponent = ({ + back, + confirm, + flow, + meta, + warnings, +}) => { + const { + services: { + core: { docLinks }, + }, + } = useAppContext(); + const { links } = docLinks; + + const [checkedIds, setCheckedIds] = useState( + warnings.reduce((initialCheckedIds, warning, index) => { + initialCheckedIds[idForWarning(index)] = false; + return initialCheckedIds; + }, {} as { [id: string]: boolean }) + ); + + // Do not allow to proceed until all checkboxes are checked. + const blockAdvance = Object.values(checkedIds).filter((v) => v).length < warnings.length; + + const onChange = (e: React.ChangeEvent) => { + const optionId = e.target.id; + + setCheckedIds((prev) => ({ + ...prev, + ...{ + [optionId]: !checkedIds[optionId], + }, + })); + }; + + return ( + <> + + {meta.isFrozen && } + {warnings.length > 0 && ( + <> + {flow === 'reindex' && ( + + } + color="warning" + iconType="warning" + > +

    + +

    +
    + )} + {flow === 'readonly' && ( + + } + color="warning" + iconType="warning" + > +

    + +

    +
    + )} + + + +

    + +

    +
    + + {warnings.map((warning, index) => { + const WarningCheckbox = warningToComponentMap[warning.warningType]; + return ( + + ); + })} + + )} +
    + + + + + + + + + {flow === 'reindex' && ( + + + + )} + {flow === 'readonly' && ( + + + + )} + + + + + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step_checkbox.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_checkbox.tsx similarity index 67% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step_checkbox.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_checkbox.tsx index 27bfdc6256781..8e96c9ee570c5 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warning_step_checkbox.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/flyout/steps/warning/warning_step_checkbox.tsx @@ -19,11 +19,11 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { DocLinksStart } from '@kbn/core/public'; -import { ReindexWarning, ReindexWarningTypes } from '../../../../../../../common/types'; +import { IndexWarning, IndexWarningType } from '../../../../../../../../../common/types'; -export const hasReindexWarning = ( - warnings: ReindexWarning[], - warningType: ReindexWarningTypes +export const hasIndexWarning = ( + warnings: IndexWarning[], + warningType: IndexWarningType ): boolean => { return Boolean(warnings.find((warning) => warning.warningType === warningType)); }; @@ -53,7 +53,7 @@ const WarningCheckbox: React.FunctionComponent<{ } @@ -79,7 +79,7 @@ export interface WarningCheckboxProps { onChange: (event: React.ChangeEvent) => void; docLinks: DocLinksStart['links']; id: string; - meta?: ReindexWarning['meta']; + meta?: IndexWarning['meta']; } export const DeprecatedSettingWarningCheckbox: React.FunctionComponent = ({ @@ -96,14 +96,14 @@ export const DeprecatedSettingWarningCheckbox: React.FunctionComponent } description={ <> @@ -135,7 +135,7 @@ export const ReplaceIndexWithAliasWarningCheckbox: React.FunctionComponent< warningId={id} label={ {meta?.indexName}, @@ -145,7 +145,7 @@ export const ReplaceIndexWithAliasWarningCheckbox: React.FunctionComponent< } description={ {meta?.indexName}, @@ -156,3 +156,36 @@ export const ReplaceIndexWithAliasWarningCheckbox: React.FunctionComponent< /> ); }; + +export const MakeIndexReadonlyWarningCheckbox: React.FunctionComponent = ({ + isChecked, + onChange, + id, + meta, +}) => { + return ( + {meta?.indexName}, + }} + /> + } + description={ + {meta?.indexName}, + }} + /> + } + /> + ); +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/index.tsx similarity index 84% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/index.tsx index bbb1493f15bcc..3ac6d5252a775 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/index.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/index.tsx @@ -5,4 +5,4 @@ * 2.0. */ -export { ReindexTableRow } from './table_row'; +export { IndexTableRow } from './table_row'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.tsx similarity index 57% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.tsx index 7ad71efc53d32..190a1a7023998 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/resolution_table_cell.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/resolution_table_cell.tsx @@ -19,65 +19,89 @@ import { import { ReindexStatus } from '../../../../../../common/types'; import { getReindexProgressLabel } from '../../../../lib/utils'; import { LoadingState } from '../../../types'; -import { useReindexContext } from './context'; +import { useIndexContext } from './context'; const i18nTexts = { reindexLoadingStatusText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexLoadingStatusText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexLoadingStatusText', { defaultMessage: 'Loading status…', } ), reindexInProgressText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexInProgressText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexInProgressText', { defaultMessage: 'Reindexing in progress…', } ), reindexCompleteText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexCompleteText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexCompleteText', { defaultMessage: 'Reindex complete', } ), reindexFailedText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexFailedText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexFailedText', { defaultMessage: 'Reindex failed', } ), reindexFetchFailedText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexFetchFailedText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexFetchFailedText', { defaultMessage: 'Reindex status not available', } ), reindexCanceledText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexCanceledText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexCanceledText', { defaultMessage: 'Reindex cancelled', } ), reindexPausedText: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.reindexPausedText', + 'xpack.upgradeAssistant.esDeprecations.indices.reindexPausedText', { defaultMessage: 'Reindex paused', } ), - resolutionText: i18n.translate('xpack.upgradeAssistant.esDeprecations.reindex.resolutionLabel', { + reindexText: i18n.translate('xpack.upgradeAssistant.esDeprecations.indices.reindexLabel', { defaultMessage: 'Reindex', }), - resolutionTooltipLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.resolutionTooltipLabel', + reindexTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.reindexTooltipLabel', + { + defaultMessage: 'Resolve this issue by reindexing into a new, compatible index.', + } + ), + updateText: i18n.translate('xpack.upgradeAssistant.esDeprecations.indices.updateLabel', { + defaultMessage: 'Update', + }), + updateCompleteText: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.updateCompleteText', + { + defaultMessage: 'Update complete', + } + ), + updateTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.updateTooltipLabel', { defaultMessage: - 'Resolve this issue by reindexing this index. This issue can be resolved automatically.', + 'Resolve this issue by updating this index. This issue can be resolved automatically either by marking the index as read-only (recommended for large indices) or by reindexing into a new, compatible index.', + } + ), + unfreezeText: i18n.translate('xpack.upgradeAssistant.esDeprecations.indices.unfreezeLabel', { + defaultMessage: 'Unfreeze', + }), + unfreezeTooltipLabel: i18n.translate( + 'xpack.upgradeAssistant.esDeprecations.indices.unfreezeTooltipLabel', + { + defaultMessage: 'Resolve this issue by unfreezing this index.', } ), }; export const ReindexResolutionCell: React.FunctionComponent = () => { - const { reindexState } = useReindexContext(); + const { reindexState, deprecation, updateIndexState } = useIndexContext(); const hasExistingAliases = reindexState.meta.aliases.length > 0; if (reindexState.loadingState === LoadingState.Loading) { @@ -158,14 +182,51 @@ export const ReindexResolutionCell: React.FunctionComponent = () => { ); } - return ( - + switch (updateIndexState.status) { + case 'complete': + return ( + + + + + + {i18nTexts.updateCompleteText} + + + ); + } + + // reindex status "not started" + return deprecation.correctiveAction?.type === 'unfreeze' ? ( + + + + + + + {i18nTexts.unfreezeText} + + + + ) : reindexState.meta.isReadonly ? ( + + + + + + + {i18nTexts.reindexText} + + + + ) : ( + - {i18nTexts.resolutionText} + {i18nTexts.updateText} diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/table_row.tsx similarity index 77% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/table_row.tsx index 1059720e66a59..72ac9b09f1738 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/table_row.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/table_row.tsx @@ -19,8 +19,8 @@ import { import { DeprecationTableColumns } from '../../../types'; import { EsDeprecationsTableCells } from '../../es_deprecations_table_cells'; import { ReindexResolutionCell } from './resolution_table_cell'; -import { ReindexFlyout, ReindexFlyoutProps } from './flyout'; -import { ReindexStatusProvider, useReindexContext } from './context'; +import { IndexFlyout, IndexFlyoutProps } from './flyout'; +import { IndexStatusProvider, useIndexContext } from './context'; const { useGlobalFlyout } = GlobalFlyout; @@ -29,31 +29,30 @@ interface TableRowProps { rowFieldNames: DeprecationTableColumns[]; } -const ReindexTableRowCells: React.FunctionComponent = ({ +const IndexTableRowCells: React.FunctionComponent = ({ rowFieldNames, deprecation, }) => { const [showFlyout, setShowFlyout] = useState(false); - const reindexState = useReindexContext(); + const indexContext = useIndexContext(); const { addContent: addContentToGlobalFlyout, removeContent: removeContentFromGlobalFlyout } = useGlobalFlyout(); const closeFlyout = useCallback(async () => { - removeContentFromGlobalFlyout('reindexFlyout'); + removeContentFromGlobalFlyout('indexFlyout'); setShowFlyout(false); uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_CLOSE_FLYOUT_CLICK); }, [removeContentFromGlobalFlyout]); useEffect(() => { if (showFlyout) { - addContentToGlobalFlyout({ - id: 'reindexFlyout', - Component: ReindexFlyout, + addContentToGlobalFlyout({ + id: 'indexFlyout', + Component: IndexFlyout, props: { - deprecation, closeFlyout, - ...reindexState, + ...indexContext, }, flyoutProps: { onClose: closeFlyout, @@ -63,7 +62,7 @@ const ReindexTableRowCells: React.FunctionComponent = ({ }, }); } - }, [addContentToGlobalFlyout, deprecation, showFlyout, reindexState, closeFlyout]); + }, [addContentToGlobalFlyout, deprecation, showFlyout, indexContext, closeFlyout]); useEffect(() => { if (showFlyout) { @@ -93,14 +92,14 @@ const ReindexTableRowCells: React.FunctionComponent = ({ ); }; -export const ReindexTableRow: React.FunctionComponent = (props) => { +export const IndexTableRow: React.FunctionComponent = (props) => { const { services: { api }, } = useAppContext(); return ( - - - + + + ); }; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/use_reindex.tsx similarity index 96% rename from x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx rename to x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/use_reindex.tsx index 9c1e5b932efdd..0eeadaad6d395 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/use_reindex_state.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/use_reindex.tsx @@ -11,7 +11,7 @@ import { ReindexStatusResponse, ReindexStatus, ReindexStep, - ReindexWarning, + IndexWarning, } from '../../../../../../common/types'; import { CancelLoadingState, LoadingState } from '../../../types'; import { ApiService } from '../../../../lib/api'; @@ -25,12 +25,14 @@ export interface ReindexState { status?: ReindexStatus; reindexTaskPercComplete: number | null; errorMessage: string | null; - reindexWarnings?: ReindexWarning[]; + reindexWarnings?: IndexWarning[]; hasRequiredPrivileges?: boolean; meta: { indexName: string; reindexName: string; aliases: string[]; + isFrozen: boolean; + isReadonly: boolean; }; } @@ -49,7 +51,6 @@ const getReindexState = ( meta: { ...meta, aliases }, loadingState: LoadingState.Success, }; - if (warnings) { newReindexState.reindexWarnings = warnings; } @@ -107,15 +108,18 @@ const getReindexState = ( return newReindexState; }; -export const useReindexStatus = ({ indexName, api }: { indexName: string; api: ApiService }) => { +export const useReindex = ({ indexName, api }: { indexName: string; api: ApiService }) => { const [reindexState, setReindexState] = useState({ loadingState: LoadingState.Loading, errorMessage: null, reindexTaskPercComplete: null, meta: { indexName, - reindexName: '', // will be known after fetching the reindexStatus - aliases: [], // will be known after fetching the reindexStatus + // these properties will be known after fetching the reindexStatus + reindexName: '', + aliases: [], + isFrozen: false, + isReadonly: false, }, }); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/use_update_index.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/use_update_index.tsx new file mode 100644 index 0000000000000..15d228f5098f1 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/indices/use_update_index.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useCallback, useState } from 'react'; +import type { UpdateIndexOperation } from '../../../../../../common/update_index'; +import type { EnrichedDeprecationInfo } from '../../../../../../common/types'; +import type { ApiService } from '../../../../lib/api'; + +export interface UpdateIndexState { + failedBefore: boolean; + status: 'incomplete' | 'inProgress' | 'complete' | 'failed'; + reason?: string; +} + +export interface UseUpdateIndexParams { + indexName: string; + api: ApiService; + correctiveAction: EnrichedDeprecationInfo['correctiveAction']; +} + +export const useUpdateIndex = ({ indexName, api, correctiveAction }: UseUpdateIndexParams) => { + const [failedState, setFailedState] = useState(false); + const [updateIndexState, setUpdateIndexState] = useState({ + failedBefore: false, + status: 'incomplete', + }); + + const updateIndex = useCallback(async () => { + const operations: UpdateIndexOperation[] = + correctiveAction?.type === 'unfreeze' ? ['unfreeze'] : ['blockWrite', 'unfreeze']; + + setUpdateIndexState({ status: 'inProgress', failedBefore: failedState }); + const res = await api.updateIndex(indexName, operations); + const status = res.error ? 'failed' : 'complete'; + const failedBefore = failedState || status === 'failed'; + setFailedState(failedBefore); + setUpdateIndexState({ + status, + failedBefore, + ...(res.error && { reason: res.error.message.toString() }), + }); + }, [api, correctiveAction, failedState, indexName]); + + return { + updateIndexState, + updateIndex, + }; +}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx deleted file mode 100644 index 3d4459e7380b7..0000000000000 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/context.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { createContext, useContext } from 'react'; - -import { ApiService } from '../../../../lib/api'; -import { useReindexStatus, ReindexState } from './use_reindex_state'; - -export interface ReindexStateContext { - reindexState: ReindexState; - startReindex: () => Promise; - cancelReindex: () => Promise; -} - -const ReindexContext = createContext(undefined); - -export const useReindexContext = () => { - const context = useContext(ReindexContext); - if (context === undefined) { - throw new Error('useReindexContext must be used within a '); - } - return context; -}; - -interface Props { - api: ApiService; - children: React.ReactNode; - indexName: string; -} - -export const ReindexStatusProvider: React.FunctionComponent = ({ - api, - indexName, - children, -}) => { - const { reindexState, startReindex, cancelReindex } = useReindexStatus({ - indexName, - api, - }); - - return ( - - {children} - - ); -}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx deleted file mode 100644 index b353e18f0b51a..0000000000000 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/container.tsx +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useCallback, useState } from 'react'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { EuiFlyoutHeader, EuiSpacer, EuiTitle } from '@elastic/eui'; -import { METRIC_TYPE } from '@kbn/analytics'; - -import { EnrichedDeprecationInfo, ReindexStatus } from '../../../../../../../common/types'; - -import type { ReindexStateContext } from '../context'; -import { ChecklistFlyoutStep } from './checklist_step'; -import { WarningsFlyoutStep } from './warnings_step'; -import { DeprecationBadge } from '../../../../shared'; -import { - UIM_REINDEX_START_CLICK, - UIM_REINDEX_STOP_CLICK, - uiMetricService, -} from '../../../../../lib/ui_metric'; - -export interface ReindexFlyoutProps extends ReindexStateContext { - deprecation: EnrichedDeprecationInfo; - closeFlyout: () => void; -} - -export const ReindexFlyout: React.FunctionComponent = ({ - reindexState, - startReindex, - cancelReindex, - closeFlyout, - deprecation, -}) => { - const { status, reindexWarnings } = reindexState; - const { index } = deprecation; - - const [showWarningsStep, setShowWarningsStep] = useState(false); - - const onStartReindex = useCallback(() => { - uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_START_CLICK); - startReindex(); - }, [startReindex]); - - const onStopReindex = useCallback(() => { - uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_STOP_CLICK); - cancelReindex(); - }, [cancelReindex]); - - const startReindexWithWarnings = () => { - if ( - reindexWarnings && - reindexWarnings.length > 0 && - status !== ReindexStatus.inProgress && - status !== ReindexStatus.completed - ) { - setShowWarningsStep(true); - } else { - onStartReindex(); - } - }; - const flyoutContents = showWarningsStep ? ( - setShowWarningsStep(false)} - continueReindex={() => { - setShowWarningsStep(false); - onStartReindex(); - }} - /> - ) : ( - - ); - - return ( - <> - - - - -

    - -

    -
    -
    - - {flyoutContents} - - ); -}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warnings_step.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warnings_step.tsx deleted file mode 100644 index d3ed1d0c16387..0000000000000 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/deprecation_types/reindex/flyout/warnings_step.tsx +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { useState } from 'react'; - -import { - EuiButton, - EuiButtonEmpty, - EuiCallOut, - EuiFlexGroup, - EuiFlexItem, - EuiFlyoutBody, - EuiFlyoutFooter, - EuiSpacer, - EuiTitle, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n-react'; - -import { - ReindexWarning, - ReindexWarningTypes, - ReindexStatusResponse, -} from '../../../../../../../common/types'; -import { useAppContext } from '../../../../../app_context'; -import { - DeprecatedSettingWarningCheckbox, - ReplaceIndexWithAliasWarningCheckbox, - WarningCheckboxProps, -} from './warning_step_checkbox'; - -interface CheckedIds { - [id: string]: boolean; -} - -const warningToComponentMap: { - [key in ReindexWarningTypes]: React.FunctionComponent; -} = { - indexSetting: DeprecatedSettingWarningCheckbox, - replaceIndexWithAlias: ReplaceIndexWithAliasWarningCheckbox, -}; - -export const idForWarning = (id: number) => `reindexWarning-${id}`; -interface WarningsConfirmationFlyoutProps { - hideWarningsStep: () => void; - continueReindex: () => void; - warnings: ReindexWarning[]; - meta: ReindexStatusResponse['meta']; -} - -/** - * Displays warning text about destructive changes required to reindex this index. The user - * must acknowledge each change before being allowed to proceed. - */ -export const WarningsFlyoutStep: React.FunctionComponent = ({ - warnings, - hideWarningsStep, - continueReindex, - meta, -}) => { - const { - services: { - core: { docLinks }, - }, - } = useAppContext(); - const { links } = docLinks; - - const [checkedIds, setCheckedIds] = useState( - warnings.reduce((initialCheckedIds, warning, index) => { - initialCheckedIds[idForWarning(index)] = false; - return initialCheckedIds; - }, {} as { [id: string]: boolean }) - ); - - // Do not allow to proceed until all checkboxes are checked. - const blockAdvance = Object.values(checkedIds).filter((v) => v).length < warnings.length; - - const onChange = (e: React.ChangeEvent) => { - const optionId = e.target.id; - - setCheckedIds((prev) => ({ - ...prev, - ...{ - [optionId]: !checkedIds[optionId], - }, - })); - }; - - return ( - <> - - {warnings.length > 0 && ( - <> - - } - color="warning" - iconType="warning" - > -

    - -

    -
    - - -

    - -

    -
    - - {warnings.map((warning, index) => { - const WarningCheckbox = warningToComponentMap[warning.warningType]; - return ( - - ); - })} - - )} -
    - - - - - - - - - - - - - - - - ); -}; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx index f3f9716dc823b..6c48e8b817183 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table.tsx @@ -31,7 +31,7 @@ import { MlSnapshotsTableRow, DefaultTableRow, IndexSettingsTableRow, - ReindexTableRow, + IndexTableRow, ClusterSettingsTableRow, HealthIndicatorTableRow, DataStreamTableRow, @@ -126,7 +126,8 @@ const renderTableRowCells = ( return ; case 'reindex': - return ; + case 'unfreeze': + return ; case 'healthIndicator': return ; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx index 472ecccb4f02f..3d92ea07af01a 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/components/es_deprecations/es_deprecations_table_cells.tsx @@ -28,7 +28,7 @@ const i18nTexts = { } ), manualCellTooltipLabel: i18n.translate( - 'xpack.upgradeAssistant.esDeprecations.reindex.manualCellTooltipLabel', + 'xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel', { defaultMessage: 'This issue needs to be resolved manually.', } diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/api.ts b/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/api.ts index 8a85032e54999..80e6a88eec6f4 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/api.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/api.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { HttpSetup } from '@kbn/core/public'; +import type { HttpSetup } from '@kbn/core/public'; -import { +import type { UpdateIndexOperation } from '../../../common/update_index'; +import type { ESUpgradeStatus, CloudBackupStatus, ClusterUpgradeState, @@ -24,9 +25,9 @@ import { CLOUD_BACKUP_STATUS_POLL_INTERVAL_MS, } from '../../../common/constants'; import { - UseRequestConfig, - SendRequestConfig, - SendRequestResponse, + type UseRequestConfig, + type SendRequestConfig, + type SendRequestResponse, sendRequest as _sendRequest, useRequest as _useRequest, } from '../../shared_imports'; @@ -277,6 +278,14 @@ export class ApiService { }); } + public async updateIndex(indexName: string, operations: UpdateIndexOperation[]) { + return await this.sendRequest({ + path: `${API_BASE_PATH}/update_index/${indexName}`, + method: 'post', + body: { operations }, + }); + } + public useLoadUpgradeStatus() { return this.useRequest<{ readyForUpgrade: boolean; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/ui_metric.ts b/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/ui_metric.ts index d45dec0dd5348..e2e83a5b91861 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/ui_metric.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/public/application/lib/ui_metric.ts @@ -19,6 +19,11 @@ export const UIM_REINDEX_OPEN_FLYOUT_CLICK = 'reindex_open_flyout_click'; export const UIM_REINDEX_CLOSE_FLYOUT_CLICK = 'reindex_close_flyout_click'; export const UIM_REINDEX_START_CLICK = 'reindex_start_click'; export const UIM_REINDEX_STOP_CLICK = 'reindex_stop_click'; +export const UIM_REINDEX_READONLY_CLICK = 'reindex_readonly_click'; +export const UIM_REINDEX_UNFREEZE_CLICK = 'reindex_unfreeze_click'; +export const UIM_REINDEX_READONLY_RETRY_CLICK = 'reindex_readonly_retry_click'; +export const UIM_REINDEX_UNFREEZE_RETRY_CLICK = 'reindex_unfreeze_retry_click'; + // Data Streams Reindexing export const UIM_DATA_STREAM_REINDEX_OPEN_FLYOUT_CLICK = 'data_stream_reindex_open_flyout_click'; export const UIM_DATA_STREAM_REINDEX_CLOSE_FLYOUT_CLICK = 'data_stream_reindex_close_flyout_click'; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/__snapshots__/index.test.ts.snap b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/__snapshots__/index.test.ts.snap index 97a71f7189886..1b0fc3a393219 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/__snapshots__/index.test.ts.snap +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/__snapshots__/index.test.ts.snap @@ -97,7 +97,6 @@ Object { "type": "reindex", }, "details": "This index has version: 7.17.28-8.0.0", - "frozen": true, "index": "frozen_index", "isCritical": true, "message": "Old index with a compatibility version < 8.0", diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/get_corrective_actions.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/get_corrective_actions.ts index 0635150243542..1743a681a808a 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/get_corrective_actions.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/get_corrective_actions.ts @@ -38,11 +38,14 @@ interface DataStreamActionMetadata { export type EsMetadata = Actions | MlActionMetadata | DataStreamActionMetadata; // TODO(jloleysens): Replace these regexes once this issue is addressed https://github.com/elastic/elasticsearch/issues/118062 -const ES_INDEX_MESSAGES_REQIURING_REINDEX = [ +const ES_INDEX_MESSAGES_REQUIRING_REINDEX = [ /Index created before/, /index with a compatibility version \ + Boolean(indexName) && message.includes(`Index [${indexName}] is a frozen index`); + export const getCorrectiveAction = ( deprecationType: EnrichedDeprecationInfo['type'], message: string, @@ -55,9 +58,10 @@ export const getCorrectiveAction = ( const clusterSettingDeprecation = metadata?.actions?.find( (action) => action.action_type === 'remove_settings' && typeof indexName === 'undefined' ); - const requiresReindexAction = ES_INDEX_MESSAGES_REQIURING_REINDEX.some((regexp) => + const requiresReindexAction = ES_INDEX_MESSAGES_REQUIRING_REINDEX.some((regexp) => regexp.test(message) ); + const requiresUnfreezeAction = isFrozenDeprecation(message, indexName); const requiresIndexSettingsAction = Boolean(indexSettingDeprecation); const requiresClusterSettingsAction = Boolean(clusterSettingDeprecation); const requiresMlAction = /[Mm]odel snapshot/.test(message); @@ -102,6 +106,12 @@ export const getCorrectiveAction = ( }; } + if (requiresUnfreezeAction) { + return { + type: 'unfreeze', + }; + } + if (requiresIndexSettingsAction) { return { type: 'indexSetting', diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts index ab9338a4874c9..d2bb41f9c8e20 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/es_deprecations_status/migrations.ts @@ -16,7 +16,11 @@ import { convertFeaturesToIndicesArray, getESSystemIndicesMigrationStatus, } from '../es_system_indices_migration'; -import { type EsMetadata, getCorrectiveAction } from './get_corrective_actions'; +import { + type EsMetadata, + getCorrectiveAction, + isFrozenDeprecation, +} from './get_corrective_actions'; import { esIndicesStateCheck } from '../es_indices_state_check'; /** @@ -199,21 +203,21 @@ export const getEnrichedDeprecations = async ( return enrichedDeprecation; }) .filter((deprecation) => { - if ( - deprecation.index && - deprecation.message.includes(`Index [${deprecation.index}] is a frozen index`) - ) { + if (isFrozenDeprecation(deprecation.message, deprecation.index)) { // frozen indices are created in 7.x, so they are old / incompatible as well - // reindexing + deleting is required, so no need to bubble up this deprecation in the UI - const indexDeprecations = deprecationsByIndex.get(deprecation.index)!; - const oldIndexDeprecation: EnrichedDeprecationInfo | undefined = indexDeprecations.find( + // no need to bubble up this deprecation IF THERE IS ANOTHER CRITICAL ONE FOR THE SAME INDEX + // in that case, in the critical deprecation we will propose: + // - reindexing => the new index will not be frozen + // - updating index => the operation will unfreeze the index (see routes/update_index.ts) + const indexDeprecations = deprecationsByIndex.get(deprecation.index!); + const oldIndexDeprecation: EnrichedDeprecationInfo | undefined = indexDeprecations?.find( (elem) => elem.type === 'index_settings' && elem.index === deprecation.index && - elem.correctiveAction?.type === 'reindex' + elem.correctiveAction?.type === 'reindex' && + elem.isCritical ); if (oldIndexDeprecation) { - oldIndexDeprecation.frozen = true; return false; } } diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/index_settings.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/index_settings.ts index 178df91be6096..28955ab019cf8 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/index_settings.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/index_settings.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ReindexWarning } from '../../../common/types'; +import { IndexWarning } from '../../../common/types'; import { versionService } from '../version'; import { FlatSettings } from './types'; export interface ParsedIndexName { @@ -65,7 +65,7 @@ export const generateNewIndexName = (indexName: string): string => { export const getDeprecatedSettingWarning = ( flatSettings: FlatSettings -): ReindexWarning | undefined => { +): IndexWarning | undefined => { const { settings } = flatSettings; const deprecatedSettingsInUse = Object.keys(settings || {}).filter((setting) => { @@ -88,6 +88,7 @@ export const getDeprecatedSettingWarning = ( if (deprecatedSettingsInUse.length) { return { + flow: 'all', warningType: 'indexSetting', meta: { deprecatedSettings: deprecatedSettingsInUse, @@ -100,8 +101,8 @@ export const getDeprecatedSettingWarning = ( * Returns an array of warnings that should be displayed to user before reindexing begins. * @param flatSettings */ -export const getReindexWarnings = (flatSettings: FlatSettings): ReindexWarning[] => { - const warnings = [] as ReindexWarning[]; +export const getReindexWarnings = (flatSettings: FlatSettings): IndexWarning[] => { + const warnings = [] as IndexWarning[]; if (versionService.getMajorVersion() === 8) { const deprecatedSettingWarning = getDeprecatedSettingWarning(flatSettings); diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts index 7726dceffb7d5..b1b44a6caaf2f 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts @@ -164,6 +164,11 @@ describe('reindexService', () => { const reindexWarnings = await service.detectReindexWarnings(indexName); expect(reindexWarnings).toEqual([ { + flow: 'readonly', + warningType: 'makeIndexReadonly', + }, + { + flow: 'reindex', warningType: 'replaceIndexWithAlias', }, ]); @@ -829,7 +834,7 @@ describe('reindexService', () => { ); it('moves existing aliases over to new index', async () => { - clusterClient.asCurrentUser.indices.getAlias.mockResponseOnce({ + clusterClient.asCurrentUser.indices.get.mockResponseOnce({ myIndex: { aliases: { myAlias: {}, diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.ts index 31bfe99f34c75..126af5c398a3f 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/reindexing/reindex_service.ts @@ -10,11 +10,12 @@ import { firstValueFrom } from 'rxjs'; import { LicensingPluginSetup } from '@kbn/licensing-plugin/server'; +import { IndicesAlias, IndicesIndexSettings } from '@elastic/elasticsearch/lib/api/types'; import { ReindexSavedObject, ReindexStatus, ReindexStep, - ReindexWarning, + IndexWarning, } from '../../../common/types'; import { esIndicesStateCheck } from '../es_indices_state_check'; @@ -37,7 +38,7 @@ export interface ReindexService { * Resolves to null if index does not exist. * @param indexName */ - detectReindexWarnings(indexName: string): Promise; + detectReindexWarnings(indexName: string): Promise; /** * Creates a new reindex operation for a given index. @@ -111,7 +112,13 @@ export interface ReindexService { */ cancelReindexing(indexName: string): Promise; - getIndexAliases(indexName: string): any; + /** + * Obtain metadata about the index, including aliases and settings + * @param indexName + */ + getIndexInfo( + indexName: string + ): Promise<{ aliases: Record; settings?: IndicesIndexSettings }>; } export const reindexServiceFactory = ( @@ -167,7 +174,7 @@ export const reindexServiceFactory = ( }); if (!putReadonly.acknowledged) { - throw new Error(`Index could not be set to readonly.`); + throw new Error(`Index could not be set to read-only.`); } return actions.updateReindexOp(reindexOp, { lastCompletedStep: ReindexStep.readonly }); @@ -341,12 +348,15 @@ export const reindexServiceFactory = ( return reindexOp; }; - const getIndexAliases = async (indexName: string) => { - const response = await esClient.indices.getAlias({ + const getIndexInfo = async (indexName: string) => { + const response = await esClient.indices.get({ index: indexName, + features: ['aliases', 'settings'], }); - return response[indexName]?.aliases ?? {}; + const aliases = response[indexName]?.aliases ?? {}; + const settings = response[indexName]?.settings?.index ?? {}; + return { aliases, settings }; }; const isIndexHidden = async (indexName: string) => { @@ -391,7 +401,7 @@ export const reindexServiceFactory = ( const switchAlias = async (reindexOp: ReindexSavedObject) => { const { indexName, newIndexName, reindexOptions } = reindexOp.attributes; - const existingAliases = await getIndexAliases(indexName); + const existingAliases = (await getIndexInfo(indexName)).aliases; const extraAliases = Object.keys(existingAliases).map((aliasName) => ({ add: { index: newIndexName, alias: aliasName, ...existingAliases[aliasName] }, @@ -468,9 +478,8 @@ export const reindexServiceFactory = ( return resp.has_all_requested; }, - async detectReindexWarnings(indexName: string): Promise { + async detectReindexWarnings(indexName: string): Promise { const flatSettings = await actions.getFlatSettings(indexName); - if (!flatSettings) { return undefined; } else { @@ -478,8 +487,13 @@ export const reindexServiceFactory = ( // By default all reindexing operations will replace an index with an alias (with the same name) // pointing to a newly created "reindexed" index. This is destructive as delete operations originally // done on the index itself will now need to be done to the "reindexed-{indexName}" + { + warningType: 'makeIndexReadonly', + flow: 'readonly', + }, { warningType: 'replaceIndexWithAlias', + flow: 'reindex', }, ...getReindexWarnings(flatSettings), ]; @@ -681,6 +695,6 @@ export const reindexServiceFactory = ( return reindexOp; }, - getIndexAliases, + getIndexInfo, }; }; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/lib/update_index/index.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/update_index/index.ts new file mode 100644 index 0000000000000..3bdff445bc6d8 --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/lib/update_index/index.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { ElasticsearchClient } from '@kbn/core/server'; +import type { UpdateIndexOperation } from '../../../common/update_index'; + +export interface UpdateIndexParams { + esClient: ElasticsearchClient; + index: string; + operations: UpdateIndexOperation[]; +} + +/** + * Perform some updates on a given index, to address compatibility issues. + * @param esClient Elasticsearch client, to issue http calls to ES + * @param index The index to update + * @param operations The operations to perform on the specified index + */ +export async function updateIndex({ esClient, index, operations }: UpdateIndexParams) { + for (const operation of operations) { + let res; + + switch (operation) { + case 'blockWrite': { + res = await esClient.indices.addBlock({ index, block: 'write' }); + break; + } + case 'unfreeze': { + res = await esClient.indices.unfreeze({ index }); + break; + } + } + if (!res.acknowledged) { + throw new Error(`Could not set apply ${operation} to ${index}.`); + } + } +} diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/register_routes.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/register_routes.ts index 4df2322af1588..c94a4a378a360 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/register_routes.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/register_routes.ts @@ -22,6 +22,7 @@ import { registerRemoteClustersRoute } from './remote_clusters'; import { registerNodeDiskSpaceRoute } from './node_disk_space'; import { registerClusterSettingsRoute } from './cluster_settings'; import { registerMigrateDataStreamRoutes } from './migrate_data_streams'; +import { registerUpdateIndexRoute } from './update_index'; export function registerRoutes(dependencies: RouteDependencies, getWorker: () => ReindexWorker) { registerAppRoutes(dependencies); @@ -43,4 +44,7 @@ export function registerRoutes(dependencies: RouteDependencies, getWorker: () => // Data streams reindexing registerMigrateDataStreamRoutes(dependencies); + + // Mark index as read-only and unfreeze it + registerUpdateIndexRoute(dependencies); } diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.test.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.test.ts index b02dd08f841d3..daf9daedf8b3a 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.test.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.test.ts @@ -24,6 +24,7 @@ const mockReindexService = { resumeReindexOperation: jest.fn(), cancelReindexing: jest.fn(), getIndexAliases: jest.fn().mockResolvedValue({}), + getIndexInfo: jest.fn().mockResolvedValue({ aliases: {}, settings: {} }), }; jest.mock('../../lib/es_version_precheck', () => ({ versionCheckHandlerWrapper: (a: any) => a, diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.ts index 67b3792ea044b..cca5ec876c723 100644 --- a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.ts +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/reindex_indices/reindex_indices.ts @@ -119,7 +119,8 @@ export function registerReindexIndicesRoutes( ? await reindexService.detectReindexWarnings(indexName) : []; - const indexAliases = await reindexService.getIndexAliases(indexName); + const isTruthy = (value?: string | boolean): boolean => value === true || value === 'true'; + const { aliases, settings } = await reindexService.getIndexInfo(indexName); const body: ReindexStatusResponse = { reindexOp: reindexOp ? reindexOp.attributes : undefined, @@ -128,7 +129,9 @@ export function registerReindexIndicesRoutes( meta: { indexName, reindexName: generateNewIndexName(indexName), - aliases: Object.keys(indexAliases), + aliases: Object.keys(aliases), + isFrozen: isTruthy(settings?.frozen), + isReadonly: isTruthy(settings?.verified_read_only), }, }; diff --git a/x-pack/platform/plugins/private/upgrade_assistant/server/routes/update_index.ts b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/update_index.ts new file mode 100644 index 0000000000000..46f30ead65dfb --- /dev/null +++ b/x-pack/platform/plugins/private/upgrade_assistant/server/routes/update_index.ts @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { schema } from '@kbn/config-schema'; +import { errors } from '@elastic/elasticsearch'; + +import { API_BASE_PATH } from '../../common/constants'; +import { versionCheckHandlerWrapper } from '../lib/es_version_precheck'; +import type { RouteDependencies } from '../types'; +import { updateIndex } from '../lib/update_index'; + +export function registerUpdateIndexRoute({ router, lib: { handleEsError } }: RouteDependencies) { + const BASE_PATH = `${API_BASE_PATH}/update_index`; + router.post( + { + path: `${BASE_PATH}/{index}`, + security: { + authz: { + enabled: false, + reason: 'Relies on es and saved object clients for authorization', + }, + }, + options: { + access: 'public', + summary: `Perform certain update operations on a given index. Currently supported ones are: 'blockWrite' and 'unfreeze'`, + }, + validate: { + params: schema.object({ + index: schema.string(), + }), + body: schema.object({ + operations: schema.arrayOf( + schema.oneOf([schema.literal('blockWrite'), schema.literal('unfreeze')]) + ), + }), + }, + }, + versionCheckHandlerWrapper(async ({ core }, request, response) => { + const { + elasticsearch: { client }, + } = await core; + const { index } = request.params; + const { operations } = request.body; + try { + await updateIndex({ esClient: client.asCurrentUser, index, operations }); + return response.ok(); + } catch (err) { + if (err instanceof errors.ResponseError) { + return handleEsError({ error: err, response }); + } + throw err; + } + }) + ); +} diff --git a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/reindexing.ts b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/reindexing.ts index f319e19d0be63..a2b6d51a86b34 100644 --- a/x-pack/test/upgrade_assistant_integration/upgrade_assistant/reindexing.ts +++ b/x-pack/test/upgrade_assistant_integration/upgrade_assistant/reindexing.ts @@ -14,6 +14,7 @@ import { } from '@kbn/upgrade-assistant-plugin/common/types'; import { generateNewIndexName } from '@kbn/upgrade-assistant-plugin/server/lib/reindexing/index_settings'; import { getIndexState } from '@kbn/upgrade-assistant-plugin/common/get_index_state'; +import { sortBy } from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { @@ -213,12 +214,15 @@ export default function ({ getService }: FtrProviderContext) { }); }); - it('shows no warnings', async () => { + it('shows reindex and read-only warnings', async () => { const resp = await supertest.get(`/api/upgrade_assistant/reindex/reindexed-v7-6.0-data`); // reusing the index previously migrated in v7->v8 UA tests + expect(resp.body.warnings.length).to.be(2); // By default, all reindexing operations will replace an index with an alias (with the same name) // pointing to a newly created "reindexed" index. - expect(resp.body.warnings.length).to.be(1); - expect(resp.body.warnings[0].warningType).to.be('replaceIndexWithAlias'); + expect(sortBy(resp.body.warnings, 'warningType')).to.eql([ + { warningType: 'makeIndexReadonly', flow: 'readonly' }, + { warningType: 'replaceIndexWithAlias', flow: 'reindex' }, + ]); }); it('reindexes old 7.0 index', async () => {