This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Added Loading Modal to Details pages #221
Merged
davidcui1225
merged 1 commit into
opendistro-for-elasticsearch:dev
from
davidcui1225:details-page-modals
Nov 25, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
kibana-reports/public/components/main/loading_modal/index.ts
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,16 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
export { GenerateReportLoadingModal } from './loading_modal'; | ||
83 changes: 83 additions & 0 deletions
83
kibana-reports/public/components/main/loading_modal/loading_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,83 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import { | ||
EuiOverlayMask, | ||
EuiModal, | ||
EuiModalHeader, | ||
EuiTitle, | ||
EuiText, | ||
EuiModalBody, | ||
EuiSpacer, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiLoadingSpinner, | ||
EuiButton | ||
} from "@elastic/eui"; | ||
import React, { useState } from "react"; | ||
|
||
export function GenerateReportLoadingModal(props: { setShowLoading: any; }) { | ||
const { | ||
setShowLoading | ||
} = props; | ||
|
||
const [isModalVisible, setIsModalVisible] = useState(true); | ||
|
||
const closeModal = () => { | ||
setIsModalVisible(false); | ||
setShowLoading(false); | ||
}; | ||
const showModal = () => setIsModalVisible(true); | ||
|
||
return ( | ||
<div> | ||
<EuiOverlayMask> | ||
<EuiModal | ||
onClose={closeModal} | ||
style={{ maxWidth: 350, minWidth: 300 }} | ||
> | ||
<EuiModalHeader> | ||
<EuiTitle> | ||
<EuiText textAlign="right"> | ||
<h2>Generating report</h2> | ||
</EuiText> | ||
</EuiTitle> | ||
</EuiModalHeader> | ||
<EuiModalBody> | ||
<EuiText>Preparing your file for download.</EuiText> | ||
<EuiText> | ||
You can close this dialog while we continue in the background. | ||
</EuiText> | ||
<EuiSpacer /> | ||
<EuiFlexGroup justifyContent="center" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<EuiLoadingSpinner | ||
size="xl" | ||
style={{ minWidth: 75, minHeight: 75 }} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<EuiSpacer size="l" /> | ||
<EuiFlexGroup alignItems="flexEnd" justifyContent="flexEnd"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton onClick={closeModal}>Close</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiModalBody> | ||
</EuiModal> | ||
</EuiOverlayMask> | ||
</div> | ||
); | ||
}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need this, you already export this from
loading_modal.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when we export it in other files we don't need to write
import from '../../loading_modal/loading_modal
, eliminates need for nested importThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think loading_modal is like a util components, which may better be placed under
utils
for other components to call. Otherwise, if you write a index.ts for every small component, the project will have too many files. Just my 2 cents, may refer to some project structure standard later when we do the refactor