forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Onboarding] Add delete index action to search index detail page (ela…
…stic#192428) ## Summary In this PR for Onboarding Search detail page added, * Delete index action * Page loading section while fetching index * Page error section when index not found * Api reference doc link * Added FTR tests for the new implementation ## Screenshots <img width="1462" alt="Screenshot 2024-09-09 at 11 17 05 PM" src="https://github.com/user-attachments/assets/b407d8ff-36c6-4bd6-a6af-d63d9ee6ac40"> <img width="1484" alt="Screenshot 2024-09-09 at 11 17 33 PM" src="https://github.com/user-attachments/assets/5ff8a84d-b8fd-4b43-8057-2691a3741353"> **How to test:** 1. Enable searchIndices plugin in `kibana.dev.yml` as this plugin is behind Feature flag ``` xpack.searchIndices.enabled: true ``` 2. Create a new index 3. Navigate to `/app/elasticsearch/indices/index_details/${indexName}` 4. Delete index and visit to `/app/elasticsearch/indices/index_details/${indexName}` again ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit dcbba95) # Conflicts: # x-pack/plugins/search_indices/tsconfig.json
- Loading branch information
1 parent
568f623
commit a15f60f
Showing
17 changed files
with
466 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* 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 { DocLinks } from '@kbn/doc-links'; | ||
|
||
class SearchIndicesDocLinks { | ||
public apiReference: string = ''; | ||
|
||
constructor() {} | ||
|
||
setDocLinks(newDocLinks: DocLinks) { | ||
this.apiReference = newDocLinks.apiReference; | ||
} | ||
} | ||
export const docLinks = new SearchIndicesDocLinks(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
], | ||
"requiredBundles": [ | ||
"kibanaReact", | ||
"esUiShared" | ||
] | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
x-pack/plugins/search_indices/public/components/indices/delete_index_modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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, useEffect } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiConfirmModal } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { useDeleteIndex } from '../../hooks/api/use_delete_index'; | ||
interface DeleteIndexModelProps { | ||
onCancel: () => void; | ||
indexName: string; | ||
navigateToIndexListPage: () => void; | ||
} | ||
export const DeleteIndexModal: React.FC<DeleteIndexModelProps> = ({ | ||
onCancel, | ||
indexName, | ||
navigateToIndexListPage, | ||
}) => { | ||
const { mutate, isLoading, isSuccess } = useDeleteIndex(indexName); | ||
useEffect(() => { | ||
if (isSuccess) { | ||
navigateToIndexListPage(); | ||
} | ||
}, [navigateToIndexListPage, isSuccess]); | ||
return ( | ||
<EuiConfirmModal | ||
data-test-subj="deleteIndexActionModal" | ||
title={i18n.translate( | ||
'xpack.searchIndices.indexActionsMenu.deleteIndex.confirmModal.modalTitle', | ||
{ | ||
defaultMessage: 'Delete index', | ||
} | ||
)} | ||
onCancel={onCancel} | ||
onConfirm={() => mutate()} | ||
isLoading={isLoading} | ||
buttonColor="danger" | ||
confirmButtonDisabled={false} | ||
cancelButtonText={i18n.translate( | ||
'xpack.searchIndices.indexActionsMenu.deleteIndex.confirmModal.cancelButtonText', | ||
{ | ||
defaultMessage: 'Cancel', | ||
} | ||
)} | ||
confirmButtonText={i18n.translate( | ||
'xpack.searchIndices.indexActionsMenu.deleteIndex.confirmModal.confirmButtonText', | ||
{ | ||
defaultMessage: 'Delete index', | ||
} | ||
)} | ||
> | ||
<Fragment> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.searchIndices.indexActionsMenu.deleteIndex.deleteDescription" | ||
defaultMessage="You are about to delete this index:" | ||
/> | ||
</p> | ||
<ul> | ||
<li>{indexName}</li> | ||
</ul> | ||
|
||
<p> | ||
<FormattedMessage | ||
id="xpack.searchIndices.indexActionsMenu.deleteIndex.deleteWarningDescription" | ||
defaultMessage="You can't recover a deleted index. Make sure you have appropriate backups." | ||
/> | ||
</p> | ||
</Fragment> | ||
</EuiConfirmModal> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
x-pack/plugins/search_indices/public/components/indices/details_page_loading_error.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* 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 { | ||
EuiButton, | ||
EuiButtonEmpty, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiPageTemplate, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
import React from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
interface IndexloadingErrorProps { | ||
indexName: string; | ||
navigateToIndexListPage: () => void; | ||
reloadFunction: () => void; | ||
} | ||
export const IndexloadingError = ({ | ||
indexName, | ||
navigateToIndexListPage, | ||
reloadFunction, | ||
}: IndexloadingErrorProps) => ( | ||
<EuiPageTemplate.EmptyPrompt | ||
data-test-subj="pageLoadError" | ||
color="danger" | ||
iconType="warning" | ||
title={ | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.searchIndices.pageLoaError.errorTitle" | ||
defaultMessage="Unable to load index details" | ||
/> | ||
</h2> | ||
} | ||
body={ | ||
<EuiText color="subdued"> | ||
<FormattedMessage | ||
id="xpack.searchIndices.pageLoadError.description" | ||
defaultMessage="We encountered an error loading data for index {indexName}. Make sure that the index name in the URL is correct and try again." | ||
values={{ | ||
indexName, | ||
}} | ||
/> | ||
</EuiText> | ||
} | ||
actions={ | ||
<EuiFlexGroup justifyContent="spaceAround"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty | ||
color="danger" | ||
iconType="arrowLeft" | ||
onClick={() => navigateToIndexListPage()} | ||
data-test-subj="loadingErrorBackToIndicesButton" | ||
> | ||
<FormattedMessage | ||
id="xpack.searchIndices.pageLoadError.backToIndicesButtonLabel" | ||
defaultMessage="Back to indices" | ||
/> | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton | ||
iconSide="right" | ||
onClick={reloadFunction} | ||
iconType="refresh" | ||
color="danger" | ||
data-test-subj="reloadButton" | ||
> | ||
<FormattedMessage | ||
id="xpack.searchIndices.pageLoadError.reloadButtonLabel" | ||
defaultMessage="Reload" | ||
/> | ||
</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
} | ||
/> | ||
); |
Oops, something went wrong.