Skip to content

Commit c8d3412

Browse files
authored
Fix: Fixed UI errors and warnings (open-metadata#23837)
* Fix: Fixed UI errors and warnings * Fix: Removed commented code * Fix: removed the post interface * Fix: reverted few changes * Fix: Addressed PR comments * Fix: removed unnecessary types * Fix: removed unnecessary types * Fix: fixed unit test issue
1 parent be8beb5 commit c8d3412

File tree

30 files changed

+135
-117
lines changed

30 files changed

+135
-117
lines changed

openmetadata-ui/src/main/resources/ui/src/components/ActivityFeed/ActivityFeedCardNew/CommentCard.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import classNames from 'classnames';
1515
import { compare } from 'fast-json-patch';
1616
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
1717
import { Link } from 'react-router-dom';
18-
import { Thread } from '../../../generated/entity/feed/thread';
18+
import { Post, Thread } from '../../../generated/entity/feed/thread';
1919
import { useUserProfile } from '../../../hooks/user-profile/useUserProfile';
2020
import {
2121
formatDateTime,
@@ -37,7 +37,7 @@ import ActivityFeedActions from '../Shared/ActivityFeedActions';
3737

3838
interface CommentCardInterface {
3939
feed: Thread;
40-
post: any;
40+
post: Post;
4141
isLastReply: boolean;
4242
closeFeedEditor: () => void;
4343
}

openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetailPage/DomainDetailPage.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const DomainDetailPage = () => {
8787
}
8888
};
8989

90-
const handleDomainDelete = (id: string) => {
90+
const handleDomainDelete = () => {
9191
// Navigate back to domains listing page after deletion
9292
navigate(ROUTES.DOMAIN);
9393
};

openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryStatusBadge/GlossaryStatusBadge.component.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export const GlossaryStatusBadge = ({ status }: { status: EntityStatus }) => {
1919
return (
2020
<Space>
2121
<Divider className="m-x-xs h-6" type="vertical" />
22-
<StatusBadge label={status} status={StatusClass[status]} />
22+
<StatusBadge
23+
label={status}
24+
status={StatusClass[status as keyof typeof StatusClass]}
25+
/>
2326
</Space>
2427
);
2528
};

openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryTermTab/GlossaryTermTab.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ const GlossaryTermTab = ({ isGlossary, className }: GlossaryTermTabProps) => {
774774
<StatusBadge
775775
dataTestId={termFQN + '-status'}
776776
label={status}
777-
status={StatusClass[status]}
777+
status={StatusClass[status as keyof typeof StatusClass]}
778778
/>
779779
</div>
780780
</Popover>

openmetadata-ui/src/main/resources/ui/src/components/LineageTable/LineageTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ const LineageTable: FC<{ entity: SourceType }> = ({ entity }) => {
629629
? 'fromEntity'
630630
: 'toEntity',
631631
sorter: true,
632-
render: (record?: SearchSourceAlias) => (
632+
render: (record?: SearchSourceAlias & { type: EntityType }) => (
633633
<Link
634634
to={getEntityLinkFromType(
635635
record?.fullyQualifiedName ?? '',
@@ -671,7 +671,7 @@ const LineageTable: FC<{ entity: SourceType }> = ({ entity }) => {
671671
? 'fromEntity'
672672
: 'toEntity',
673673
sorter: true,
674-
render: (record?: SearchSourceAlias) => (
674+
render: (record?: SearchSourceAlias & { type?: EntityType }) => (
675675
<Link
676676
to={getEntityLinkFromType(
677677
record?.fullyQualifiedName ?? '',

openmetadata-ui/src/main/resources/ui/src/components/MyData/CustomizableComponents/CustomiseHomeModal/CustomiseHomeModal.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jest.mock('antd', () => {
4949

5050
return {
5151
...antd,
52-
Modal: ({ children, open, onCancel, ...props }: any) =>
52+
Modal: ({ children, open, ...props }: any) =>
5353
open ? (
5454
<div data-testid="modal" {...props}>
5555
{children}

openmetadata-ui/src/main/resources/ui/src/components/Settings/Applications/AppRunsHistory/AppRunsHistory.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jest.mock('../../../../utils/date-time/DateTimeUtils', () => ({
114114
getEpochMillisForPastDays: jest.fn().mockReturnValue('startDay'),
115115
getIntervalInMilliseconds: jest.fn().mockReturnValue('interval'),
116116
formatDuration: jest.fn().mockReturnValue('formatDuration'),
117-
formatDurationToHHMMSS: jest.fn().mockImplementation((_ms) => {
117+
formatDurationToHHMMSS: jest.fn().mockImplementation(() => {
118118
// Return a consistent formatted duration for all cases
119119
return '02:30:15';
120120
}),

openmetadata-ui/src/main/resources/ui/src/components/Settings/Services/Ingestion/IngestionRecentRun/IngestionRecentRun.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
render,
1919
screen,
2020
} from '@testing-library/react';
21+
import { Status } from '../../../../../generated/entity/applications/appRunRecord';
2122
import { IngestionPipeline } from '../../../../../generated/entity/services/ingestionPipelines/ingestionPipeline';
2223
import { EXECUTION_RUNS, FAILURE } from '../../../../../mocks/Ingestion.mock';
2324
import { mockDataInsightApplicationRun } from '../../../../../mocks/LogsViewerPage.mock';
@@ -438,23 +439,23 @@ describe('Test IngestionRecentRun component', () => {
438439
const unorderedAppRuns = [
439440
{
440441
runId: 'app-run-2',
441-
status: 'Success',
442+
status: Status.Success,
442443
startTime: 1667307000,
443444
timestamp: 1667307000,
444445
endTime: 1667307003,
445446
appId: 'app-2',
446447
},
447448
{
448449
runId: 'app-run-1',
449-
status: 'Failed',
450+
status: Status.Failed,
450451
startTime: 1667301000,
451452
timestamp: 1667301000,
452453
endTime: 1667301003,
453454
appId: 'app-1',
454455
},
455456
{
456457
runId: 'app-run-3',
457-
status: 'Running',
458+
status: Status.Running,
458459
startTime: 1667309000,
459460
timestamp: 1667309000,
460461
endTime: 1667309003,

openmetadata-ui/src/main/resources/ui/src/components/common/MUIAsyncTreeSelect/MUIAsyncTreeSelect.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -499,22 +499,25 @@ const MUIAsyncTreeSelect: FC<MUIAsyncTreeSelectProps> = ({
499499
);
500500

501501
// Handle input blur to restore selected value if no new selection
502-
const handleInputBlur = useCallback(
503-
(e: React.FocusEvent) => {
504-
// Restore selected value in single-select if no new selection
505-
if (!multiple && selectedOptions.length > 0) {
506-
const selectedLabel = selectedOptions[0].label;
507-
if (inputValue !== selectedLabel) {
508-
setInputValue(selectedLabel);
509-
debouncedSetSearchTerm(''); // Clear search to show all options
510-
}
502+
const handleInputBlur = useCallback(() => {
503+
// Restore selected value in single-select if no new selection
504+
if (!multiple && selectedOptions.length > 0) {
505+
const selectedLabel = selectedOptions[0].label;
506+
if (inputValue !== selectedLabel) {
507+
setInputValue(selectedLabel);
508+
debouncedSetSearchTerm(''); // Clear search to show all options
511509
}
510+
}
512511

513-
// Call existing blur handler for dropdown management
514-
handleBlur(e);
515-
},
516-
[multiple, selectedOptions, inputValue, handleBlur, debouncedSetSearchTerm]
517-
);
512+
// Call existing blur handler for dropdown management
513+
handleBlur();
514+
}, [
515+
multiple,
516+
selectedOptions,
517+
inputValue,
518+
handleBlur,
519+
debouncedSetSearchTerm,
520+
]);
518521

519522
// Calculate if has clearable value
520523
const hasClearableValue = multiple

openmetadata-ui/src/main/resources/ui/src/components/common/MUIAsyncTreeSelect/atoms/TreeContent/TreeContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export interface TreeContentProps {
2323
error: string | null;
2424
hasData: boolean;
2525
children: ReactNode;
26-
selectedItems?: string[] | null;
26+
selectedItems?: string | null;
2727
expandedItems?: string[];
2828
focusedItem?: string;
2929
apiRef?: MutableRefObject<any>;
3030
loadingMessage?: string;
3131
noDataMessage?: string;
32-
onNodeToggle?: SimpleTreeViewProps['onExpandedItemsChange'];
32+
onNodeToggle?: SimpleTreeViewProps<boolean>['onExpandedItemsChange'];
3333
onFocusedItemChange?: (event: React.SyntheticEvent, itemId: string) => void;
3434
onItemClick?: (event: React.MouseEvent, itemId: string) => void;
3535
}

0 commit comments

Comments
 (0)