Skip to content

[ui-importer] destination setting component and hook #4157

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 2 commits into
base: master
Choose a base branch
from

Conversation

ramprasadagarwal
Copy link
Collaborator

@ramprasadagarwal ramprasadagarwal commented Jun 3, 2025

What changes were proposed in this pull request?

  • Added hook for DataCatalog
  • Sued the hook to populate the engine, database and compute

How was this patch tested?

  • Adding more test cases shortly

Please review Hue Contributing Guide before opening a pull request.

Copy link

github-actions bot commented Jun 3, 2025

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

Copy link

@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 introduces a new DataCatalog hook and a DestinationSettings component while updating the importer file preview logic to utilize these new components for configuring destination settings. Key changes include:

  • The addition of a useDataCatalog hook to manage engine, database, and compute selections.
  • Integration of the DestinationSettings component in the file preview along with modifications to the finish import logic.
  • Minor style adjustments and type updates related to importer file types and destination configuration.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
desktop/core/src/desktop/js/utils/hooks/useDataCatalog/useDataCatalog.tsx Introduces a new hook for fetching and managing DataCatalog data.
desktop/core/src/desktop/js/apps/newimporter/types.ts Updates importer types by converting a const enum to an enum and adding DestinationConfig.
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/ImporterFilePreview.tsx Updates finish import logic to utilize destinationConfig and integrates DestinationSettings.
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/ImporterFilePreview.scss Removes a fixed height setting from metadata styling.
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/DestinationSettings/DestinationSettings.tsx Adds a new component for destination configuration and integrates useDataCatalog usage.
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/DestinationSettings/DestinationSettings.scss Provides styling for the new DestinationSettings component.

};
const destination = {
outputFormat: 'table',
nonDefaultLocation: fileMetaData.path,
name: `${database}.${defaultTableName}`,
sourceType: dialect,
name: `${destinationConfig.database}.${destinationConfig.tableName}`,
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

Ensure that both destinationConfig.database and destinationConfig.tableName are defined before constructing the destination name to avoid generating an invalid table identifier. Consider adding validation or default values if these fields are undefined.

Copilot uses AI. Check for mistakes.

}: DestinationSettingsProps): JSX.Element => {
const { t } = i18nReact.useTranslation();
const [tableName, setTableName] = React.useState<string | undefined>(defaultValues?.tableName);

Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider synchronizing the local 'tableName' state with any changes to defaultValues.tableName by using an effect hook, ensuring the component stays in sync with prop updates.

Suggested change
React.useEffect(() => {
setTableName(defaultValues?.tableName);
}, [defaultValues?.tableName]);

Copilot uses AI. Check for mistakes.

connector: Connector
): Promise<void> => {
try {
setLoading(true);
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

The loading state is managed separately in multiple async functions (loadDatabases, loadTables, loadNamespaces) which could lead to race conditions or a flickering indicator if these functions overlap. Consider refactoring or consolidating the loading state management to ensure consistent feedback to the user.

Suggested change
setLoading(true);
setLoadingCount(prev => prev + 1);

Copilot uses AI. Check for mistakes.

Copy link

github-actions bot commented Jun 3, 2025

UI Coverage Report

Lines Statements Branches Functions
Coverage: 32%
39.15% (30527/77959) 31.01% (14247/45936) 23.89% (2130/8915)

Copy link

github-actions bot commented Jun 3, 2025

Python Code Coverage

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

Pytest Report

Tests Skipped Failures Errors Time
1186 106 💤 0 ❌ 0 🔥 5m 57s ⏱️

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.

1 participant