Skip to content

[ui-importer] Add configured filesystems in importer #4131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

nidhibhatg
Copy link
Collaborator

@nidhibhatg nidhibhatg commented Apr 30, 2025

What changes were proposed in this pull request?

  • Adds configured filesystems in importer and displays all the filesystems
  • Modifies file chooser to support upload and create folder
  • Adds functionality to click files for importer use case
  • Style improvements
Screenshot 2025-04-30 at 3 08 47 PM Screenshot 2025-04-30 at 3 09 15 PM Screenshot 2025-04-30 at 3 09 31 PM Screenshot 2025-04-30 at 3 10 18 PM Screenshot 2025-05-27 at 12 43 41 PM Screenshot 2025-05-27 at 12 44 16 PM

How was this patch tested?

  • unit tests and manually

Please review Hue Contributing Guide before opening a pull request.

Copy link

github-actions bot commented Apr 30, 2025

✅ Test files were modified. Ensure that the tests cover all relevant changes. ✅

@nidhibhatg nidhibhatg force-pushed the nidhi_importer_filesystems branch from 465c3d9 to 42dccf4 Compare April 30, 2025 09:55
Copy link

github-actions bot commented Apr 30, 2025

Python Code Coverage

Python Coverage Report •
FileStmtsMissCoverMissing
TOTAL537342701349% 
report-only-changed-files is enabled. No files were changed during this commit :)

Pytest Report

Tests Skipped Failures Errors Time
1090 106 💤 0 ❌ 0 🔥 6m 2s ⏱️

Copy link
Collaborator

@ramprasadagarwal ramprasadagarwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.
Please check the comments below.

@bjornalm
Copy link
Collaborator

bjornalm commented May 5, 2025

Lots of good feedback from @ramprasadagarwal. I'll hold while you guys sort it out, but I did notice that the screenshot of the drag and drop looks weird where the "drop area" appears behind the action buttons of the modal.

@nidhibhatg nidhibhatg force-pushed the nidhi_importer_filesystems branch from 811ebb9 to 3700a3c Compare May 20, 2025 09:54
@nidhibhatg nidhibhatg force-pushed the nidhi_importer_filesystems branch from 3700a3c to 1e68db6 Compare June 3, 2025 07:07
Copy link

github-actions bot commented Jun 3, 2025

UI Code Coverage Report

Lines Statements Branches Functions
Coverage: 33%
39.5% (30873/78144) 31.26% (14393/46041) 24.77% (2221/8966)

Copy link

github-actions bot commented Jun 3, 2025

Coverage

Backend Code Coverage Report •
FileStmtsMissCoverMissing
TOTAL542232704250% 
report-only-changed-files is enabled. No files were changed during this commit :)

Copy link
Collaborator

@bjornalm bjornalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I reviewed the first half of the files. Will continue with the rest later, but you can start addressing the issues.

data-testid="hue-file-input"
className="hue-importer__source-selector-option-upload"
onChange={handleFileUpload}
accept=".csv, .xlsx, .xls"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we really agree that these are the only supported file formats?

@bjornalm
Copy link
Collaborator

bjornalm commented Jun 5, 2025

@nidhibhatg I'm also trying out some deep PR review AI prompting using the the copilot chat functionality. Please have a look, I think they make sense. Unfortunately I can't get them to appear as comments in the actual code.

  1. Accessibility: Table Row Interactivity
    File: FileChooserModal.tsx
    Location: Table row rendering and click handling

Comment:
For accessibility, consider adding role="button" and tabIndex={0} to clickable table rows, and handle keyboard interaction (Enter/Space) to allow keyboard users to select files or folders. This will make file/folder selection more accessible to all users.

  1. Accessibility: Error Message Announcements
    Files:

ImporterSourceSelector.tsx
FileChooserModal.tsx
LocalFileUploadOption.tsx
Comment:
To improve accessibility, error messages shown to users should be wrapped in a container with aria-live="polite" or aria-live="assertive" so that screen readers announce them as soon as they appear.

  1. Accessibility: Modal Focus Management
    File: FileChooserModal.tsx
    Location: Modal open/close logic

Comment:
Consider implementing focus management for modals: focus should be trapped within the modal while open, and returned to the triggering element when closed. This will improve keyboard navigation and accessibility for screen reader users.

  1. Error Handling: Backend Error Messages
    File: FileChooserModal.tsx
    Location: Folder creation error handling

Comment:
Currently, API errors (e.g., when creating a folder) are surfaced directly to users. Please consider mapping or sanitizing backend error messages into more user-friendly text to avoid exposing technical details or confusing messages to end users.

  1. Testing: Prefer user-event Over fireEvent
    Files:

LocalFileUploadOption.test.tsx
ImporterSourceSelector.test.tsx
BottomSlidePanel.test.tsx
Comment:
For future test maintenance, please prefer using @testing-library/user-event rather than fireEvent. user-event simulates real user interactions and helps catch more realistic issues.

  1. Minor: onPressEnter Handler Bug
    File: FileChooserModal.tsx
    Location: BottomSlidePanel for create folder

Comment:
The onPressEnter prop is currently set as onPressEnter={() => handleCreate}. This creates a new function that returns handleCreate instead of calling it. It should be onPressEnter={handleCreate} to ensure the handler is called when Enter is pressed.

@bjornalm bjornalm requested a review from Copilot June 5, 2025 14:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for configured filesystems in the importer and enhances the file chooser with upload and folder-creation capabilities.

  • Introduces a reusable BottomSlidePanel component for folder creation UI
  • Extends FileChooserModal with drag-and-drop, polling, upload button, and error/retry handling
  • Updates ImporterSourceSelector to fetch and render configured filesystems dynamically

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

File Description
reactComponents/BottomSlidePanel/BottomSlidePanel.tsx New bottom slide panel component
apps/storageBrowser/FileChooserModal/FileChooserModal.tsx File chooser extended to support upload & folder creation
apps/newimporter/ImporterSourceSelector/ImporterSourceSelector.tsx Fetch and display configured filesystems
apps/newimporter/ImporterSourceSelector/LocalFileUploadOption.tsx Local file upload option with size validation
Comments suppressed due to low confidence (4)

desktop/core/src/desktop/js/reactComponents/BottomSlidePanel/BottomSlidePanel.tsx:24

  • The onPrimaryClick prop is typed as (unknown) => void, which is ambiguous. Consider changing it to a clear signature like () => void or specify the exact argument type.
onPrimaryClick?: (unknown) => void;

desktop/core/src/desktop/js/reactComponents/BottomSlidePanel/BottomSlidePanel.tsx:66

  • The mask div has role="button" but no accessible name. Add aria-label or aria-labelledby (e.g., aria-label="Close panel") so screen readers announce its purpose.
<div className={`hue-bottom-slide-mask ${isOpen ? 'fade-in' : 'fade-out'}`}

desktop/core/src/desktop/js/reactComponents/BottomSlidePanel/BottomSlidePanel.scss:62

  • Missing semicolon after the padding: 16px 24px property in .hue-bottom-slide-panel__footer. Add a semicolon to avoid CSS parsing errors.
    padding: 16px 24px

desktop/core/src/desktop/js/apps/storageBrowser/FileChooserModal/FileChooserModal.tsx:207

  • The variable name is undefined here. You probably meant to use createFolderValue or the new folder name returned from the API.
          setDestPath(prev => `${prev}/${name}`);

@nidhibhatg nidhibhatg force-pushed the nidhi_importer_filesystems branch from 1e68db6 to 18ae023 Compare June 17, 2025 09:29
@nidhibhatg nidhibhatg force-pushed the nidhi_importer_filesystems branch from 457e002 to a1f9824 Compare July 7, 2025 09:49
{/* TODO: Refactor CreateAndUpload to reuse */}
<LoadingErrorWrapper errors={createFolderErrorConfig}>
<Input
defaultValue={createFolderValue}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just use value={createFolderValue}, we don't need to trigger onChange than?

Copy link
Collaborator

@ramprasadagarwal ramprasadagarwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work,
Please add the tests and this PR is good from my side.

loading: false,
error: null,
reloadData: mockReloadData
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileChooser Component has lot of new code, can we add those tests here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants