diff --git a/public/components/QueryResults/async_query_body.tsx b/public/components/QueryResults/async_query_body.tsx index af481a1c..cc97c026 100644 --- a/public/components/QueryResults/async_query_body.tsx +++ b/public/components/QueryResults/async_query_body.tsx @@ -3,9 +3,20 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { EuiFlexGroup, EuiText, EuiLoadingSpinner, EuiButton, EuiIcon } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiText, + EuiLoadingSpinner, + EuiButton, + EuiIcon, + EuiModal, + EuiModalBody, + EuiModalFooter, + EuiModalHeader, + EuiModalHeaderTitle, +} from '@elastic/eui'; import { AsyncQueryLoadingStatus } from '../../../common/types'; -import React from 'react'; +import React, { useState } from 'react'; interface AsyncQueryBodyProps { asyncLoadingStatus: AsyncQueryLoadingStatus; @@ -15,9 +26,28 @@ interface AsyncQueryBodyProps { export function AsyncQueryBody(props: AsyncQueryBodyProps) { const { asyncLoadingStatus, cancelAsyncQuery, asyncQueryError } = props; + const [isModalVisible, setIsModalVisible] = useState(false); - // TODO: implement query failure display - // TODO: implement query cancellation + const closeModal = () => setIsModalVisible(false); + const showModal = () => setIsModalVisible(true); + + let modal; + if (isModalVisible) { + modal = ( + + + Error + + {asyncQueryError} + + + + Close + + + + ); + } return ( @@ -27,7 +57,9 @@ export function AsyncQueryBody(props: AsyncQueryBodyProps) {

Query failed

- error: {asyncQueryError} + The query failed to execute and the operation could not be complete. + showModal()}>View error details + {modal} ) : ( <> @@ -35,7 +67,7 @@ export function AsyncQueryBody(props: AsyncQueryBodyProps) {

Query running

- status: {asyncLoadingStatus} + Status: {asyncLoadingStatus} Cancel )}