-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Confirmation modal for deleting Crawler domains i…
…n Kibana Content app (#136481)
- Loading branch information
Byron Hulcher
authored
Jul 18, 2022
1 parent
7f55a1a
commit fef8e72
Showing
8 changed files
with
276 additions
and
59 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
89 changes: 89 additions & 0 deletions
89
..._search_content/components/search_index/crawler/domain_management/delete_domain_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,89 @@ | ||
/* | ||
* 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 { useActions, useValues } from 'kea'; | ||
|
||
import { | ||
EuiButton, | ||
EuiButtonEmpty, | ||
EuiModal, | ||
EuiModalBody, | ||
EuiModalFooter, | ||
EuiModalHeader, | ||
EuiModalHeaderTitle, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
|
||
import { CANCEL_BUTTON_LABEL } from '../../../../../shared/constants'; | ||
|
||
import { DeleteCrawlerDomainApiLogic } from '../../../../api/crawler/delete_crawler_domain_api_logic'; | ||
|
||
import { DeleteDomainModalLogic } from './delete_domain_modal_logic'; | ||
|
||
export const DeleteDomainModal: React.FC = () => { | ||
DeleteCrawlerDomainApiLogic.mount(); | ||
const { deleteDomain, hideModal } = useActions(DeleteDomainModalLogic); | ||
const { domain, isLoading, isHidden } = useValues(DeleteDomainModalLogic); | ||
|
||
if (isHidden) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<EuiModal | ||
onClose={hideModal} | ||
aria-label={i18n.translate('xpack.enterpriseSearch.crawler.deleteDomainModal.title', { | ||
defaultMessage: 'Delete domain', | ||
})} | ||
> | ||
<EuiModalHeader> | ||
<EuiModalHeaderTitle> | ||
{i18n.translate('xpack.enterpriseSearch.crawler.deleteDomainModal.title', { | ||
defaultMessage: 'Delete domain', | ||
})} | ||
</EuiModalHeaderTitle> | ||
</EuiModalHeader> | ||
<EuiModalBody> | ||
<EuiText> | ||
<FormattedMessage | ||
id="xpack.enterpriseSearch.crawler.deleteDomainModal.description" | ||
defaultMessage="Remove the domain {domainUrl} from your crawler. This will also delete all entry points and crawl rules you have set up. Any documents related to this domain will be removed on the next crawl. {thisCannotBeUndoneMessage}" | ||
values={{ | ||
domainUrl: <strong>{domain?.url}</strong>, | ||
thisCannotBeUndoneMessage: ( | ||
<strong> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.crawler.deleteDomainModal.thisCannotBeUndoneMessage', | ||
{ | ||
defaultMessage: 'This cannot be undone.', | ||
} | ||
)} | ||
</strong> | ||
), | ||
}} | ||
/> | ||
</EuiText> | ||
</EuiModalBody> | ||
<EuiModalFooter> | ||
<EuiButtonEmpty onClick={hideModal}>{CANCEL_BUTTON_LABEL}</EuiButtonEmpty> | ||
<EuiButton onClick={deleteDomain} isLoading={isLoading} color="danger" fill> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.crawler.deleteDomainModal.deleteDomainButtonLabel', | ||
{ | ||
defaultMessage: 'Delete domain', | ||
} | ||
)} | ||
</EuiButton> | ||
</EuiModalFooter> | ||
</EuiModal> | ||
); | ||
}; |
Oops, something went wrong.