Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d793ec4
[File upload] Lookup join file upload redesign
jgowdyelastic Nov 27, 2025
bb525ba
adding fancy mapping editor
jgowdyelastic Nov 28, 2025
42855c9
compressed inputs
jgowdyelastic Nov 28, 2025
1321b72
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 2, 2025
ee230ab
Merge branch 'look-up-join-file-upload-redesign' of github.com:jgowdy…
jgowdyelastic Dec 2, 2025
a06d1b4
mapping validation
jgowdyelastic Dec 2, 2025
02e0725
adding mapping validation
jgowdyelastic Dec 2, 2025
8fad72d
fixing bug with multiple files
jgowdyelastic Dec 2, 2025
610dca2
improving error reporting
jgowdyelastic Dec 2, 2025
e0f6a38
adding mapping edit reset
jgowdyelastic Dec 3, 2025
2ac0417
updating tests
jgowdyelastic Dec 3, 2025
c74238c
text changes
jgowdyelastic Dec 3, 2025
2c75c68
minor text change
jgowdyelastic Dec 3, 2025
16a6475
Changes from node scripts/lint_ts_projects --fix
kibanamachine Dec 3, 2025
ac0bf7d
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Dec 3, 2025
0877e0d
improving final step status
jgowdyelastic Dec 3, 2025
2fd1c28
code clean up
jgowdyelastic Dec 3, 2025
81c9ffd
Merge branch 'look-up-join-file-upload-redesign' of github.com:jgowdy…
jgowdyelastic Dec 3, 2025
8f6a6e2
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 3, 2025
9c49b0b
fixing test
jgowdyelastic Dec 3, 2025
0367c83
improving saving spinner
jgowdyelastic Dec 3, 2025
6c56141
fixing jest test
jgowdyelastic Dec 3, 2025
f2fffb8
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 4, 2025
05a7be4
Merge branch 'look-up-join-file-upload-redesign' of github.com:jgowdy…
jgowdyelastic Dec 4, 2025
d516b3a
fixing ftr tests
jgowdyelastic Dec 4, 2025
819e776
refactoring pipeline changes
jgowdyelastic Dec 4, 2025
6f0e1e0
updating test
jgowdyelastic Dec 4, 2025
dcd8942
fixing issue with renaming time field
jgowdyelastic Dec 4, 2025
e2d9b4a
adding tests
jgowdyelastic Dec 4, 2025
fb80062
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 4, 2025
c764767
fixing issue when deleting all files
jgowdyelastic Dec 4, 2025
dcce11c
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 5, 2025
50ae25f
code clean up
jgowdyelastic Dec 5, 2025
9e32da2
adding comments for all pubic methods
jgowdyelastic Dec 5, 2025
1126a02
adding comments for all pubic methods
jgowdyelastic Dec 5, 2025
fe836b9
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 5, 2025
7d53c5f
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 5, 2025
01ac048
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 8, 2025
a65439a
adding better final message
jgowdyelastic Dec 8, 2025
62999b3
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 8, 2025
6e73884
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 9, 2025
397c823
small text update
jgowdyelastic Dec 9, 2025
9b700f4
Merge branch 'look-up-join-file-upload-redesign' of github.com:jgowdy…
jgowdyelastic Dec 9, 2025
edca806
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 9, 2025
8e60030
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 9, 2025
bb992ab
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 9, 2025
9a783f6
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 10, 2025
c7e6f91
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 10, 2025
8ab0e64
changes based on review
jgowdyelastic Dec 10, 2025
d836641
reverting part of the previous commit
jgowdyelastic Dec 10, 2025
f35a02d
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 10, 2025
3e1388e
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 10, 2025
41d6f55
Merge branch 'main' into look-up-join-file-upload-redesign
jgowdyelastic Dec 11, 2025
436216d
changing imports to fix odd jest test errors
jgowdyelastic Dec 11, 2025
a186760
Merge branch 'look-up-join-file-upload-redesign' of github.com:jgowdy…
jgowdyelastic Dec 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/platform/packages/private/kbn-index-editor/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ dependsOn:
- '@kbn/restorable-state'
- '@kbn/esql-ast'
- '@kbn/es-types'
- '@kbn/file-upload-common'
- '@kbn/esql-utils'
- '@kbn/test-jest-helpers'
- '@kbn/esql-types'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('createFlyout', () => {
share: {} as any,
fileUpload: {} as any,
storage: {} as any,
fileManager: {} as any,
existingIndexName: undefined,
};

beforeEach(() => {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import { IndexEditorErrors } from '../types';
jest.mock('./empty_prompt', () => ({
EmptyPrompt: () => <div>EmptyPrompt</div>,
}));
jest.mock('./file_preview', () => ({
FilesPreview: () => <div>FilesPreview</div>,
}));

// Mock hooks and modules
jest.mock('@kbn/file-upload');
Expand Down Expand Up @@ -113,26 +110,6 @@ describe('FileDropzone', () => {
expect(getByText('EmptyPrompt')).toBeInTheDocument();
});

it('shows analyzing indicator', () => {
fileUploadContext.uploadStatus.analysisStatus = STATUS.STARTED;
const { getByText } = renderWithI18n(<TestComponent />);
expect(getByText('Analyzing...')).toBeInTheDocument();
});

it('shows uploading indicator', () => {
fileUploadContext.uploadStatus.overallImportStatus = STATUS.STARTED;
const { getByText } = renderWithI18n(<TestComponent />);
expect(getByText('Uploading...')).toBeInTheDocument();
});

it('shows FilesPreview when a file is successfully analyzed', () => {
fileUploadContext.filesStatus = [
{ analysisStatus: STATUS.COMPLETED, importStatus: STATUS.NOT_STARTED },
];
const { getByText } = renderWithI18n(<TestComponent />);
expect(getByText('FilesPreview')).toBeInTheDocument();
});

it('calls setError when a file is too large', () => {
fileUploadContext.filesStatus = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,19 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import {
EuiFlexGroup,
EuiFlexItem,
EuiLoadingSpinner,
EuiProgress,
transparentize,
useEuiTheme,
} from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, transparentize, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import { STATUS, useFileUploadContext } from '@kbn/file-upload';
import { FormattedMessage } from '@kbn/i18n-react';
import type { PropsWithChildren } from 'react';
import React, { type FC, useCallback, useEffect } from 'react';
import React, { type FC, useCallback, useEffect, useState } from 'react';
import type { FileRejection } from 'react-dropzone';
import { useDropzone } from 'react-dropzone';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import useObservable from 'react-use/lib/useObservable';
import { i18n } from '@kbn/i18n';
import { FileUploadLiteLookUpView } from '@kbn/file-upload/src/file_upload_component/new/file_upload_lite_lookup_view';
import { getOverrideConfirmation } from './modals/override_warning_modal';
import { EmptyPrompt } from './empty_prompt';
import { FilesPreview } from './file_preview';
import type { KibanaContextExtra } from '../types';
import { IndexEditorErrors } from '../types';

Expand Down Expand Up @@ -55,17 +47,10 @@ export const FileDropzone: FC<PropsWithChildren<{ noResults: boolean }>> = ({
}) => {
const { services } = useKibana<KibanaContextExtra>();
const { indexUpdateService } = services;
const { fileUploadManager, filesStatus, uploadStatus, indexName } = useFileUploadContext();
const { fileUploadManager, filesStatus, uploadStatus, indexName, reset } = useFileUploadContext();
const isSaving = useObservable(indexUpdateService.isSaving$, false);

const isAnalyzing =
uploadStatus.analysisStatus === STATUS.STARTED &&
uploadStatus.overallImportStatus === STATUS.NOT_STARTED;

const isUploading =
uploadStatus.overallImportStatus === STATUS.STARTED ||
(uploadStatus.overallImportStatus === STATUS.COMPLETED && isSaving);
const overallImportProgress = uploadStatus.overallImportProgress;
const [dropzoneDisabled, setDropzoneDisabled] = useState(false);
const [fileUploadActive, setFileUploadActive] = useState(false);

useEffect(
function checkForErrors() {
Expand Down Expand Up @@ -125,7 +110,7 @@ export const FileDropzone: FC<PropsWithChildren<{ noResults: boolean }>> = ({

const onFilesSelected = useCallback(
async (files: File[]) => {
if (!files?.length) {
if (!files?.length || dropzoneDisabled) {
return;
}

Expand All @@ -138,7 +123,7 @@ export const FileDropzone: FC<PropsWithChildren<{ noResults: boolean }>> = ({

await fileUploadManager.addFiles(files);
},
[services, indexUpdateService, fileUploadManager]
[dropzoneDisabled, services, indexUpdateService, fileUploadManager]
);

const onDropRejected = useCallback(
Expand All @@ -161,6 +146,7 @@ export const FileDropzone: FC<PropsWithChildren<{ noResults: boolean }>> = ({
multiple: true,
noClick: true, // we'll trigger open manually
noKeyboard: true,
disabled: dropzoneDisabled,
});

const onFileSelectorClick = useCallback(() => {
Expand Down Expand Up @@ -192,54 +178,14 @@ export const FileDropzone: FC<PropsWithChildren<{ noResults: boolean }>> = ({
},
]);

const loadingIndicator = (
<div css={[overlayBase, { cursor: 'progress' }]}>
{overallImportProgress ? (
<EuiProgress
value={overallImportProgress}
max={100}
size="s"
color="primary"
position="absolute"
/>
) : null}
<div
css={{
position: 'absolute',
top: '50%',
left: '50%',
translate: '-50% -50%',
textAlign: 'center',
pointerEvents: 'none',
}}
>
<EuiLoadingSpinner size="xl" />
<div>
{isAnalyzing ? (
<FormattedMessage
id="indexEditor.fileUpload.analyzingIndicator"
defaultMessage={'Analyzing...'}
/>
) : null}
{isUploading ? (
<FormattedMessage
id="indexEditor.fileUpload.uploadingIndicator"
defaultMessage={'Uploading...'}
/>
) : null}
</div>
</div>
</div>
);

const successfulPreviews = filesStatus.filter(
(f) => f.analysisStatus === STATUS.COMPLETED && f.importStatus !== STATUS.COMPLETED
);
const showFilePreview = !isDragActive && successfulPreviews.length > 0;

let content: React.ReactNode = children;

if (noResults && !showFilePreview && !isSaving) {
if (noResults && !showFilePreview && !isSaving && !fileUploadActive) {
content = (
<EuiFlexGroup direction="column" gutterSize="s" css={{ height: '100%' }}>
<EuiFlexItem grow={false}>{content}</EuiFlexItem>
Expand All @@ -248,19 +194,26 @@ export const FileDropzone: FC<PropsWithChildren<{ noResults: boolean }>> = ({
</EuiFlexItem>
</EuiFlexGroup>
);
} else if (showFilePreview) {
content = <FilesPreview />;
} else if (showFilePreview || fileUploadActive) {
content = (
<FileUploadLiteLookUpView
setFileUploadActive={setFileUploadActive}
setDropzoneDisabled={setDropzoneDisabled}
onClose={async () => {
await indexUpdateService.onFileUploadFinished(indexName);
setDropzoneDisabled(false);
reset?.(indexName);
}}
/>
);
}

const showLoadingOverlay = isUploading || isAnalyzing;

if (indexName) {
return (
<FileSelectorContext.Provider value={{ onFileSelectorClick }}>
{indexUpdateService.canEditIndex ? (
<div {...getRootProps({ css: { height: '100%', cursor: 'default' } })}>
{isDragActive ? <div css={overlayDraggingFile} /> : null}
{showLoadingOverlay ? loadingIndicator : null}
<input {...getInputProps()} data-test-subj="indexEditorFileInput" />
{content}
</div>
Expand Down
Loading