Skip to content

Commit babbe9b

Browse files
committed
fix(ui): center loading screen in tracker debug, import, and export modals
1 parent ee8b267 commit babbe9b

5 files changed

Lines changed: 13 additions & 42 deletions

File tree

components/secutils-webui/src/app_container/export_data_modal.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
EuiFlexItem,
1212
EuiIcon,
1313
EuiInMemoryTable,
14-
EuiLoadingSpinner,
1514
EuiModal,
1615
EuiModalBody,
1716
EuiModalFooter,
@@ -24,6 +23,7 @@ import {
2423
import type { ReactNode } from 'react';
2524
import { useCallback, useEffect, useMemo, useState } from 'react';
2625

26+
import { PageLoadingState } from '../components';
2727
import { getUserScripts, getUserSecrets } from '../model';
2828
import type { ExportParams } from '../model/user_data_export';
2929
import {
@@ -538,23 +538,19 @@ export default function ExportDataModal({ addToast, onClose }: Props) {
538538
<EuiModalHeader>
539539
<EuiModalHeaderTitle>Export data</EuiModalHeaderTitle>
540540
</EuiModalHeader>
541-
<EuiModalBody>
542-
{loading ? (
543-
<EuiFlexGroup justifyContent="center">
544-
<EuiFlexItem grow={false}>
545-
<EuiLoadingSpinner size="l" />
546-
</EuiFlexItem>
547-
</EuiFlexGroup>
548-
) : (
541+
{loading ? (
542+
<PageLoadingState />
543+
) : (
544+
<EuiModalBody>
549545
<EuiBasicTable
550546
items={visibleRows}
551547
responsiveBreakpoint={false}
552548
itemId="id"
553549
columns={outerColumns}
554550
itemIdToExpandedRowMap={expandedRows}
555551
/>
556-
)}
557-
</EuiModalBody>
552+
</EuiModalBody>
553+
)}
558554
<EuiModalFooter>
559555
<EuiButtonEmpty onClick={onClose}>Cancel</EuiButtonEmpty>
560556
<EuiButton

components/secutils-webui/src/app_container/import_data_modal.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
EuiFlexItem,
1515
EuiIcon,
1616
EuiInMemoryTable,
17-
EuiLoadingSpinner,
1817
EuiModal,
1918
EuiModalBody,
2019
EuiModalFooter,
@@ -27,6 +26,7 @@ import {
2726
import type { ReactNode } from 'react';
2827
import { useCallback, useEffect, useMemo, useState } from 'react';
2928

29+
import { PageLoadingState } from '../components';
3030
import type {
3131
ApplyDeletionSelections,
3232
ImportEntitySelection,
@@ -1020,17 +1020,7 @@ export default function ImportDataModal({ addToast, onClose, maxImportFileSize,
10201020
{step === 'upload' ? 'Import data' : step === 'preview' ? 'Review import' : 'Import results'}
10211021
</EuiModalHeaderTitle>
10221022
</EuiModalHeader>
1023-
<EuiModalBody>
1024-
{loading ? (
1025-
<EuiFlexGroup justifyContent="center">
1026-
<EuiFlexItem grow={false}>
1027-
<EuiLoadingSpinner size="l" />
1028-
</EuiFlexItem>
1029-
</EuiFlexGroup>
1030-
) : (
1031-
content
1032-
)}
1033-
</EuiModalBody>
1023+
{loading ? <PageLoadingState /> : <EuiModalBody>{content}</EuiModalBody>}
10341024
<EuiModalFooter>
10351025
{step === 'upload' && (
10361026
<>

components/secutils-webui/src/components/page_loading_state.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function PageLoadingState({ title = 'Loading…' }: PageLoadingStateProps
1111
<EuiFlexGroup
1212
direction={'column'}
1313
gutterSize={'s'}
14-
style={{ height: '100%' }}
14+
style={{ minHeight: '100%' }}
1515
alignItems="center"
1616
justifyContent="center"
1717
>

components/secutils-webui/src/pages/workspace/utils/web_scraping/tracker_debug_panel.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import {
22
EuiBadge,
33
EuiCallOut,
44
EuiCodeBlock,
5-
EuiEmptyPrompt,
65
EuiFlexGroup,
76
EuiFlexItem,
87
EuiImage,
9-
EuiLoadingLogo,
108
EuiModal,
119
EuiModalBody,
1210
EuiModalHeader,
@@ -29,7 +27,7 @@ import type {
2927
ScriptDebugInfo,
3028
} from './tracker_debug_types';
3129
import { buildPipelineStages } from './tracker_debug_types';
32-
import { Logo } from '../../../../components';
30+
import { PageLoadingState } from '../../../../components';
3331
import { type AsyncData, getApiRequestConfig, getErrorMessage, ResponseError } from '../../../../model';
3432

3533
export interface TrackerDebugPanelProps {
@@ -609,20 +607,7 @@ export function TrackerDebugPanel({ isOpen, onClose, onStatusChange, buildDebugR
609607
<EuiModalHeaderTitle>Debug</EuiModalHeaderTitle>
610608
</EuiModalHeader>
611609
{result?.status === 'pending' ? (
612-
<div
613-
css={css`
614-
flex: 1;
615-
display: flex;
616-
align-items: center;
617-
justify-content: center;
618-
`}
619-
>
620-
<EuiEmptyPrompt
621-
icon={<EuiLoadingLogo logo={() => <Logo size={40} />} size="l" />}
622-
titleSize="xs"
623-
title={<h2>Running debug pipeline…</h2>}
624-
/>
625-
</div>
610+
<PageLoadingState title="Running debug pipeline…" />
626611
) : (
627612
<EuiModalBody style={{ minHeight: 0 }}>
628613
{result?.status === 'failed' ? (

0 commit comments

Comments
 (0)