mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-07 22:44:08 +00:00
Fix: Fixed UI errors and warnings (#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
This commit is contained in:
parent
be8beb5159
commit
c8d3412f31
@ -15,7 +15,7 @@ import classNames from 'classnames';
|
|||||||
import { compare } from 'fast-json-patch';
|
import { compare } from 'fast-json-patch';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Thread } from '../../../generated/entity/feed/thread';
|
import { Post, Thread } from '../../../generated/entity/feed/thread';
|
||||||
import { useUserProfile } from '../../../hooks/user-profile/useUserProfile';
|
import { useUserProfile } from '../../../hooks/user-profile/useUserProfile';
|
||||||
import {
|
import {
|
||||||
formatDateTime,
|
formatDateTime,
|
||||||
@ -37,7 +37,7 @@ import ActivityFeedActions from '../Shared/ActivityFeedActions';
|
|||||||
|
|
||||||
interface CommentCardInterface {
|
interface CommentCardInterface {
|
||||||
feed: Thread;
|
feed: Thread;
|
||||||
post: any;
|
post: Post;
|
||||||
isLastReply: boolean;
|
isLastReply: boolean;
|
||||||
closeFeedEditor: () => void;
|
closeFeedEditor: () => void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ const DomainDetailPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDomainDelete = (id: string) => {
|
const handleDomainDelete = () => {
|
||||||
// Navigate back to domains listing page after deletion
|
// Navigate back to domains listing page after deletion
|
||||||
navigate(ROUTES.DOMAIN);
|
navigate(ROUTES.DOMAIN);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -19,7 +19,10 @@ export const GlossaryStatusBadge = ({ status }: { status: EntityStatus }) => {
|
|||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
<Divider className="m-x-xs h-6" type="vertical" />
|
<Divider className="m-x-xs h-6" type="vertical" />
|
||||||
<StatusBadge label={status} status={StatusClass[status]} />
|
<StatusBadge
|
||||||
|
label={status}
|
||||||
|
status={StatusClass[status as keyof typeof StatusClass]}
|
||||||
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -774,7 +774,7 @@ const GlossaryTermTab = ({ isGlossary, className }: GlossaryTermTabProps) => {
|
|||||||
<StatusBadge
|
<StatusBadge
|
||||||
dataTestId={termFQN + '-status'}
|
dataTestId={termFQN + '-status'}
|
||||||
label={status}
|
label={status}
|
||||||
status={StatusClass[status]}
|
status={StatusClass[status as keyof typeof StatusClass]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@ -629,7 +629,7 @@ const LineageTable: FC<{ entity: SourceType }> = ({ entity }) => {
|
|||||||
? 'fromEntity'
|
? 'fromEntity'
|
||||||
: 'toEntity',
|
: 'toEntity',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
render: (record?: SearchSourceAlias) => (
|
render: (record?: SearchSourceAlias & { type: EntityType }) => (
|
||||||
<Link
|
<Link
|
||||||
to={getEntityLinkFromType(
|
to={getEntityLinkFromType(
|
||||||
record?.fullyQualifiedName ?? '',
|
record?.fullyQualifiedName ?? '',
|
||||||
@ -671,7 +671,7 @@ const LineageTable: FC<{ entity: SourceType }> = ({ entity }) => {
|
|||||||
? 'fromEntity'
|
? 'fromEntity'
|
||||||
: 'toEntity',
|
: 'toEntity',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
render: (record?: SearchSourceAlias) => (
|
render: (record?: SearchSourceAlias & { type?: EntityType }) => (
|
||||||
<Link
|
<Link
|
||||||
to={getEntityLinkFromType(
|
to={getEntityLinkFromType(
|
||||||
record?.fullyQualifiedName ?? '',
|
record?.fullyQualifiedName ?? '',
|
||||||
|
|||||||
@ -49,7 +49,7 @@ jest.mock('antd', () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...antd,
|
...antd,
|
||||||
Modal: ({ children, open, onCancel, ...props }: any) =>
|
Modal: ({ children, open, ...props }: any) =>
|
||||||
open ? (
|
open ? (
|
||||||
<div data-testid="modal" {...props}>
|
<div data-testid="modal" {...props}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ jest.mock('../../../../utils/date-time/DateTimeUtils', () => ({
|
|||||||
getEpochMillisForPastDays: jest.fn().mockReturnValue('startDay'),
|
getEpochMillisForPastDays: jest.fn().mockReturnValue('startDay'),
|
||||||
getIntervalInMilliseconds: jest.fn().mockReturnValue('interval'),
|
getIntervalInMilliseconds: jest.fn().mockReturnValue('interval'),
|
||||||
formatDuration: jest.fn().mockReturnValue('formatDuration'),
|
formatDuration: jest.fn().mockReturnValue('formatDuration'),
|
||||||
formatDurationToHHMMSS: jest.fn().mockImplementation((_ms) => {
|
formatDurationToHHMMSS: jest.fn().mockImplementation(() => {
|
||||||
// Return a consistent formatted duration for all cases
|
// Return a consistent formatted duration for all cases
|
||||||
return '02:30:15';
|
return '02:30:15';
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import {
|
|||||||
render,
|
render,
|
||||||
screen,
|
screen,
|
||||||
} from '@testing-library/react';
|
} from '@testing-library/react';
|
||||||
|
import { Status } from '../../../../../generated/entity/applications/appRunRecord';
|
||||||
import { IngestionPipeline } from '../../../../../generated/entity/services/ingestionPipelines/ingestionPipeline';
|
import { IngestionPipeline } from '../../../../../generated/entity/services/ingestionPipelines/ingestionPipeline';
|
||||||
import { EXECUTION_RUNS, FAILURE } from '../../../../../mocks/Ingestion.mock';
|
import { EXECUTION_RUNS, FAILURE } from '../../../../../mocks/Ingestion.mock';
|
||||||
import { mockDataInsightApplicationRun } from '../../../../../mocks/LogsViewerPage.mock';
|
import { mockDataInsightApplicationRun } from '../../../../../mocks/LogsViewerPage.mock';
|
||||||
@ -438,7 +439,7 @@ describe('Test IngestionRecentRun component', () => {
|
|||||||
const unorderedAppRuns = [
|
const unorderedAppRuns = [
|
||||||
{
|
{
|
||||||
runId: 'app-run-2',
|
runId: 'app-run-2',
|
||||||
status: 'Success',
|
status: Status.Success,
|
||||||
startTime: 1667307000,
|
startTime: 1667307000,
|
||||||
timestamp: 1667307000,
|
timestamp: 1667307000,
|
||||||
endTime: 1667307003,
|
endTime: 1667307003,
|
||||||
@ -446,7 +447,7 @@ describe('Test IngestionRecentRun component', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
runId: 'app-run-1',
|
runId: 'app-run-1',
|
||||||
status: 'Failed',
|
status: Status.Failed,
|
||||||
startTime: 1667301000,
|
startTime: 1667301000,
|
||||||
timestamp: 1667301000,
|
timestamp: 1667301000,
|
||||||
endTime: 1667301003,
|
endTime: 1667301003,
|
||||||
@ -454,7 +455,7 @@ describe('Test IngestionRecentRun component', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
runId: 'app-run-3',
|
runId: 'app-run-3',
|
||||||
status: 'Running',
|
status: Status.Running,
|
||||||
startTime: 1667309000,
|
startTime: 1667309000,
|
||||||
timestamp: 1667309000,
|
timestamp: 1667309000,
|
||||||
endTime: 1667309003,
|
endTime: 1667309003,
|
||||||
|
|||||||
@ -499,8 +499,7 @@ const MUIAsyncTreeSelect: FC<MUIAsyncTreeSelectProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Handle input blur to restore selected value if no new selection
|
// Handle input blur to restore selected value if no new selection
|
||||||
const handleInputBlur = useCallback(
|
const handleInputBlur = useCallback(() => {
|
||||||
(e: React.FocusEvent) => {
|
|
||||||
// Restore selected value in single-select if no new selection
|
// Restore selected value in single-select if no new selection
|
||||||
if (!multiple && selectedOptions.length > 0) {
|
if (!multiple && selectedOptions.length > 0) {
|
||||||
const selectedLabel = selectedOptions[0].label;
|
const selectedLabel = selectedOptions[0].label;
|
||||||
@ -511,10 +510,14 @@ const MUIAsyncTreeSelect: FC<MUIAsyncTreeSelectProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call existing blur handler for dropdown management
|
// Call existing blur handler for dropdown management
|
||||||
handleBlur(e);
|
handleBlur();
|
||||||
},
|
}, [
|
||||||
[multiple, selectedOptions, inputValue, handleBlur, debouncedSetSearchTerm]
|
multiple,
|
||||||
);
|
selectedOptions,
|
||||||
|
inputValue,
|
||||||
|
handleBlur,
|
||||||
|
debouncedSetSearchTerm,
|
||||||
|
]);
|
||||||
|
|
||||||
// Calculate if has clearable value
|
// Calculate if has clearable value
|
||||||
const hasClearableValue = multiple
|
const hasClearableValue = multiple
|
||||||
|
|||||||
@ -23,13 +23,13 @@ export interface TreeContentProps {
|
|||||||
error: string | null;
|
error: string | null;
|
||||||
hasData: boolean;
|
hasData: boolean;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
selectedItems?: string[] | null;
|
selectedItems?: string | null;
|
||||||
expandedItems?: string[];
|
expandedItems?: string[];
|
||||||
focusedItem?: string;
|
focusedItem?: string;
|
||||||
apiRef?: MutableRefObject<any>;
|
apiRef?: MutableRefObject<any>;
|
||||||
loadingMessage?: string;
|
loadingMessage?: string;
|
||||||
noDataMessage?: string;
|
noDataMessage?: string;
|
||||||
onNodeToggle?: SimpleTreeViewProps['onExpandedItemsChange'];
|
onNodeToggle?: SimpleTreeViewProps<boolean>['onExpandedItemsChange'];
|
||||||
onFocusedItemChange?: (event: React.SyntheticEvent, itemId: string) => void;
|
onFocusedItemChange?: (event: React.SyntheticEvent, itemId: string) => void;
|
||||||
onItemClick?: (event: React.MouseEvent, itemId: string) => void;
|
onItemClick?: (event: React.MouseEvent, itemId: string) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,8 +35,7 @@ export const useTreeFocusManagement = ({
|
|||||||
}
|
}
|
||||||
}, [inputRef, disabled]);
|
}, [inputRef, disabled]);
|
||||||
|
|
||||||
const handleBlur = useCallback(
|
const handleBlur = useCallback(() => {
|
||||||
(e: React.FocusEvent) => {
|
|
||||||
// Use setTimeout to check if the new focus is still within our component
|
// Use setTimeout to check if the new focus is still within our component
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const currentActiveElement = document.activeElement;
|
const currentActiveElement = document.activeElement;
|
||||||
@ -50,9 +49,7 @@ export const useTreeFocusManagement = ({
|
|||||||
onCloseDropdown?.();
|
onCloseDropdown?.();
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
}, [onCloseDropdown, anchorRef]);
|
||||||
[onCloseDropdown, anchorRef]
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleMouseDown = useCallback((e: React.MouseEvent) => {
|
const handleMouseDown = useCallback((e: React.MouseEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@ -35,7 +35,6 @@ export const useTreeKeyboardNavigation = ({
|
|||||||
getVisibleNodes,
|
getVisibleNodes,
|
||||||
expandedNodes,
|
expandedNodes,
|
||||||
toggleNodeExpansion,
|
toggleNodeExpansion,
|
||||||
treeData,
|
|
||||||
inputRef,
|
inputRef,
|
||||||
handleNodeClick,
|
handleNodeClick,
|
||||||
onOpenDropdown,
|
onOpenDropdown,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import { debounce, isArray, isEmpty } from 'lodash';
|
|||||||
import { EntityTags } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import {
|
import {
|
||||||
FC,
|
FC,
|
||||||
|
HtmlHTMLAttributes,
|
||||||
ReactNode,
|
ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
@ -62,6 +63,26 @@ const MUITagSuggestion: FC<MUITagSuggestionProps> = ({
|
|||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const fetchOptions = async (searchText: string) => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const response = await tagClassBase.getTags(searchText, 1, true);
|
||||||
|
const fetchedOptions = response?.data || [];
|
||||||
|
const mappedOptions: TagOption[] = fetchedOptions.map(
|
||||||
|
(opt: SelectOption) => ({
|
||||||
|
label: opt.label,
|
||||||
|
value: opt.value,
|
||||||
|
data: opt.data as TagLabel,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
setOptions(mappedOptions);
|
||||||
|
} catch {
|
||||||
|
setOptions([]);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const searchDebounced = useRef(
|
const searchDebounced = useRef(
|
||||||
debounce(async (searchValue: string) => {
|
debounce(async (searchValue: string) => {
|
||||||
await fetchOptions(searchValue);
|
await fetchOptions(searchValue);
|
||||||
@ -94,26 +115,6 @@ const MUITagSuggestion: FC<MUITagSuggestionProps> = ({
|
|||||||
}
|
}
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
const fetchOptions = async (searchText: string) => {
|
|
||||||
setLoading(true);
|
|
||||||
try {
|
|
||||||
const response = await tagClassBase.getTags(searchText, 1, 20);
|
|
||||||
const fetchedOptions = response?.data || [];
|
|
||||||
const mappedOptions: TagOption[] = fetchedOptions.map(
|
|
||||||
(opt: SelectOption) => ({
|
|
||||||
label: opt.label,
|
|
||||||
value: opt.value,
|
|
||||||
data: opt.data as TagLabel,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
setOptions(mappedOptions);
|
|
||||||
} catch (error) {
|
|
||||||
setOptions([]);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleInputChange = useCallback(
|
const handleInputChange = useCallback(
|
||||||
(_event: React.SyntheticEvent, newInputValue: string) => {
|
(_event: React.SyntheticEvent, newInputValue: string) => {
|
||||||
setInputValue(newInputValue);
|
setInputValue(newInputValue);
|
||||||
@ -122,11 +123,7 @@ const MUITagSuggestion: FC<MUITagSuggestionProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleChange = useCallback(
|
const handleChange = useCallback(
|
||||||
(
|
(_event: React.SyntheticEvent, newValue: (TagOption | string)[]) => {
|
||||||
event: React.SyntheticEvent,
|
|
||||||
newValue: (TagOption | string)[],
|
|
||||||
reason: string
|
|
||||||
) => {
|
|
||||||
if (isArray(newValue)) {
|
if (isArray(newValue)) {
|
||||||
// Filter out string values from freeSolo
|
// Filter out string values from freeSolo
|
||||||
const optionValues = newValue.filter(
|
const optionValues = newValue.filter(
|
||||||
@ -176,10 +173,10 @@ const MUITagSuggestion: FC<MUITagSuggestionProps> = ({
|
|||||||
ListboxProps={
|
ListboxProps={
|
||||||
{
|
{
|
||||||
key: `listbox-${memoizedOptions.length}`,
|
key: `listbox-${memoizedOptions.length}`,
|
||||||
} as any
|
} as HtmlHTMLAttributes<HTMLUListElement>
|
||||||
}
|
}
|
||||||
autoFocus={autoFocus}
|
autoFocus={autoFocus}
|
||||||
getOptionLabel={(option: TagOption | string) =>
|
getOptionLabel={(option) =>
|
||||||
typeof option === 'string' ? option : option.label
|
typeof option === 'string' ? option : option.label
|
||||||
}
|
}
|
||||||
inputValue={inputValue}
|
inputValue={inputValue}
|
||||||
@ -213,7 +210,9 @@ const MUITagSuggestion: FC<MUITagSuggestionProps> = ({
|
|||||||
<Box display="flex" flexDirection="column">
|
<Box display="flex" flexDirection="column">
|
||||||
<Box
|
<Box
|
||||||
fontWeight="medium"
|
fontWeight="medium"
|
||||||
sx={{ color: option.data?.style?.color || undefined }}>
|
sx={{
|
||||||
|
color: option.data?.style?.color || undefined,
|
||||||
|
}}>
|
||||||
{option.label}
|
{option.label}
|
||||||
</Box>
|
</Box>
|
||||||
{(option.data?.displayName || option.data?.name) && (
|
{(option.data?.displayName || option.data?.name) && (
|
||||||
@ -224,8 +223,8 @@ const MUITagSuggestion: FC<MUITagSuggestionProps> = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
renderTags={(value: TagOption[], getTagProps) =>
|
renderTags={(value, getTagProps) =>
|
||||||
value.map((option: TagOption, index: number) => {
|
value.map((option, index: number) => {
|
||||||
const chipProps = getTagProps({ index });
|
const chipProps = getTagProps({ index });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -14,7 +14,14 @@
|
|||||||
import { Autocomplete, Box, Chip, TextField, useTheme } from '@mui/material';
|
import { Autocomplete, Box, Chip, TextField, useTheme } from '@mui/material';
|
||||||
import { XClose } from '@untitledui/icons';
|
import { XClose } from '@untitledui/icons';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
import {
|
||||||
|
FC,
|
||||||
|
SyntheticEvent,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { ReactComponent as IconTeams } from '../../../assets/svg/teams-grey.svg';
|
import { ReactComponent as IconTeams } from '../../../assets/svg/teams-grey.svg';
|
||||||
import { PAGE_SIZE_MEDIUM } from '../../../constants/constants';
|
import { PAGE_SIZE_MEDIUM } from '../../../constants/constants';
|
||||||
@ -112,7 +119,7 @@ const MUIUserTeamSelect: FC<MUIUserTeamSelectProps> = ({
|
|||||||
users.map((user) => ({
|
users.map((user) => ({
|
||||||
label: getEntityName(user),
|
label: getEntityName(user),
|
||||||
value: user.id,
|
value: user.id,
|
||||||
entity: user,
|
entity: user as unknown as EntityReference,
|
||||||
isTeam: false,
|
isTeam: false,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
@ -144,7 +151,7 @@ const MUIUserTeamSelect: FC<MUIUserTeamSelectProps> = ({
|
|||||||
teams.map((team) => ({
|
teams.map((team) => ({
|
||||||
label: getEntityName(team),
|
label: getEntityName(team),
|
||||||
value: team.id,
|
value: team.id,
|
||||||
entity: team,
|
entity: team as unknown as EntityReference,
|
||||||
isTeam: true,
|
isTeam: true,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
@ -190,7 +197,7 @@ const MUIUserTeamSelect: FC<MUIUserTeamSelectProps> = ({
|
|||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
const handleChange = (
|
const handleChange = (
|
||||||
_event: any,
|
_event: SyntheticEvent<Element, Event>,
|
||||||
newValue: string | OptionType | (string | OptionType)[] | null
|
newValue: string | OptionType | (string | OptionType)[] | null
|
||||||
) => {
|
) => {
|
||||||
if (!onChange) {
|
if (!onChange) {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import { FC, ReactElement } from 'react';
|
|||||||
export interface TagChipProps extends Omit<MuiChipProps, 'variant' | 'color'> {
|
export interface TagChipProps extends Omit<MuiChipProps, 'variant' | 'color'> {
|
||||||
label: string;
|
label: string;
|
||||||
icon?: ReactElement;
|
icon?: ReactElement;
|
||||||
onDelete?: () => void;
|
onDelete?: (e: Event) => void;
|
||||||
size?: 'small' | 'medium' | 'large';
|
size?: 'small' | 'medium' | 'large';
|
||||||
variant?: 'filled' | 'outlined' | 'blueGray';
|
variant?: 'filled' | 'outlined' | 'blueGray';
|
||||||
tagColor?: string; // For the colored bar indicator
|
tagColor?: string; // For the colored bar indicator
|
||||||
|
|||||||
@ -25,6 +25,7 @@ export interface TreeNode<T = unknown> {
|
|||||||
parent?: string;
|
parent?: string;
|
||||||
allowSelection?: boolean;
|
allowSelection?: boolean;
|
||||||
lazyLoad?: boolean;
|
lazyLoad?: boolean;
|
||||||
|
hasChildren?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TreeDataFetcherParams {
|
export interface TreeDataFetcherParams {
|
||||||
|
|||||||
@ -163,20 +163,6 @@ export const useAsyncTreeSelect = <T = unknown,>(
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Utility function to determine if a node should lazy load
|
|
||||||
const shouldNodeLazyLoad = useCallback(
|
|
||||||
(node: TreeNode<T> | null, componentLazyLoad: boolean): boolean => {
|
|
||||||
if (!node) {
|
|
||||||
return componentLazyLoad;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
node.lazyLoad !== false && (node.lazyLoad === true || componentLazyLoad)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle node expansion
|
// Handle node expansion
|
||||||
const handleNodeExpansion = useCallback(
|
const handleNodeExpansion = useCallback(
|
||||||
(nodeId: string) => {
|
(nodeId: string) => {
|
||||||
|
|||||||
@ -10,10 +10,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { TFunctionKeys } from 'i18next';
|
||||||
import { EntityTabs, EntityType } from '../enums/entity.enum';
|
import { EntityTabs, EntityType } from '../enums/entity.enum';
|
||||||
import { PageType } from '../generated/system/ui/page';
|
import { PageType } from '../generated/system/ui/page';
|
||||||
|
|
||||||
export const TAB_LABEL_MAP: Record<EntityTabs, string> = {
|
export const TAB_LABEL_MAP = {
|
||||||
[EntityTabs.OVERVIEW]: 'label.overview',
|
[EntityTabs.OVERVIEW]: 'label.overview',
|
||||||
[EntityTabs.GLOSSARY_TERMS]: 'label.glossary-term-plural',
|
[EntityTabs.GLOSSARY_TERMS]: 'label.glossary-term-plural',
|
||||||
[EntityTabs.ASSETS]: 'label.asset-plural',
|
[EntityTabs.ASSETS]: 'label.asset-plural',
|
||||||
@ -60,7 +61,7 @@ export const TAB_LABEL_MAP: Record<EntityTabs, string> = {
|
|||||||
[EntityTabs.CONTRACT]: 'label.contract',
|
[EntityTabs.CONTRACT]: 'label.contract',
|
||||||
[EntityTabs.DIRECTORIES]: 'label.directory-plural',
|
[EntityTabs.DIRECTORIES]: 'label.directory-plural',
|
||||||
[EntityTabs.WORKSHEETS]: 'label.worksheet-plural',
|
[EntityTabs.WORKSHEETS]: 'label.worksheet-plural',
|
||||||
} as const;
|
} as Record<EntityTabs, TFunctionKeys>;
|
||||||
|
|
||||||
export type CustomizeEntityType =
|
export type CustomizeEntityType =
|
||||||
| EntityType.TABLE
|
| EntityType.TABLE
|
||||||
|
|||||||
@ -33,7 +33,14 @@ import { DataInsightTabs } from '../interface/data-insight.interface';
|
|||||||
import { createIconWithStroke } from '../utils/IconUtils';
|
import { createIconWithStroke } from '../utils/IconUtils';
|
||||||
import { PLACEHOLDER_ROUTE_TAB, ROUTES } from './constants';
|
import { PLACEHOLDER_ROUTE_TAB, ROUTES } from './constants';
|
||||||
|
|
||||||
const DataProductIcon = createIconWithStroke(Cube01, 1.2);
|
const DataProductIcon = createIconWithStroke(
|
||||||
|
Cube01 as React.ComponentType<{
|
||||||
|
size?: number;
|
||||||
|
strokeWidth?: number;
|
||||||
|
style?: React.CSSProperties;
|
||||||
|
}>,
|
||||||
|
1.2
|
||||||
|
);
|
||||||
|
|
||||||
export const SIDEBAR_NESTED_KEYS = {
|
export const SIDEBAR_NESTED_KEYS = {
|
||||||
[ROUTES.OBSERVABILITY_ALERTS]: ROUTES.OBSERVABILITY_ALERTS,
|
[ROUTES.OBSERVABILITY_ALERTS]: ROUTES.OBSERVABILITY_ALERTS,
|
||||||
|
|||||||
@ -80,6 +80,7 @@ class DataQualityClassBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getExportDataQualityDashboardButton(
|
public getExportDataQualityDashboardButton(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
_activeTab: DataQualityPageTabs
|
_activeTab: DataQualityPageTabs
|
||||||
): React.ReactNode {
|
): React.ReactNode {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -130,7 +130,7 @@ const BulkEntityImportPage = () => {
|
|||||||
entityType,
|
entityType,
|
||||||
fqn
|
fqn
|
||||||
);
|
);
|
||||||
setEntity(response);
|
setEntity(response as DataAssetsHeaderProps['dataAsset']);
|
||||||
} catch {
|
} catch {
|
||||||
// not show error here
|
// not show error here
|
||||||
}
|
}
|
||||||
|
|||||||
@ -318,7 +318,7 @@ export const searchGlossaryTermsPaginated = async (
|
|||||||
offset = 0,
|
offset = 0,
|
||||||
fields?: string
|
fields?: string
|
||||||
) => {
|
) => {
|
||||||
const params: Record<string, any> = {
|
const params: Record<string, number | string> = {
|
||||||
limit,
|
limit,
|
||||||
offset,
|
offset,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export const updateLineageEdge = async (edge: AddLineage) => {
|
|||||||
|
|
||||||
export const exportLineageAsync = async (
|
export const exportLineageAsync = async (
|
||||||
fqn: string,
|
fqn: string,
|
||||||
entityType: string,
|
entityType?: string,
|
||||||
config?: LineageConfig,
|
config?: LineageConfig,
|
||||||
queryFilter?: string
|
queryFilter?: string
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
@ -10,9 +10,9 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
const React = require('react');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
useAntdColumnResize: jest.fn().mockImplementation((hookDataFunction) => {
|
useAntdColumnResize: jest.fn().mockImplementation((hookDataFunction) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -107,6 +107,16 @@ import { t } from './i18next/LocalUtil';
|
|||||||
import { jsonToCSV } from './StringsUtils';
|
import { jsonToCSV } from './StringsUtils';
|
||||||
import { showErrorToast } from './ToastUtils';
|
import { showErrorToast } from './ToastUtils';
|
||||||
|
|
||||||
|
interface LayoutedElements {
|
||||||
|
node: Array<
|
||||||
|
Node & {
|
||||||
|
nodeHeight: number;
|
||||||
|
childrenHeight: number;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
edge: Edge[];
|
||||||
|
}
|
||||||
|
|
||||||
export const MAX_LINEAGE_LENGTH = 20;
|
export const MAX_LINEAGE_LENGTH = 20;
|
||||||
|
|
||||||
export const encodeLineageHandles = (handle: string) => {
|
export const encodeLineageHandles = (handle: string) => {
|
||||||
@ -176,7 +186,7 @@ export const getLayoutedElements = (
|
|||||||
isExpanded = true,
|
isExpanded = true,
|
||||||
expandAllColumns = false,
|
expandAllColumns = false,
|
||||||
columnsHavingLineage: string[] = []
|
columnsHavingLineage: string[] = []
|
||||||
) => {
|
): LayoutedElements => {
|
||||||
const Graph = graphlib.Graph;
|
const Graph = graphlib.Graph;
|
||||||
const dagreGraph = new Graph();
|
const dagreGraph = new Graph();
|
||||||
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
||||||
|
|||||||
@ -490,6 +490,7 @@ class EntityUtilClassBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public getEntityFloatingButton(_: EntityType): FC | null {
|
public getEntityFloatingButton(_: EntityType): FC | null {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -325,15 +325,15 @@ describe('EntityUtils unit tests', () => {
|
|||||||
{ text: null, searchText: 'test', expected: '' },
|
{ text: null, searchText: 'test', expected: '' },
|
||||||
{ text: 'mockText', searchText: null, expected: 'mockText' },
|
{ text: 'mockText', searchText: null, expected: 'mockText' },
|
||||||
{ text: null, searchText: null, expected: '' },
|
{ text: null, searchText: null, expected: '' },
|
||||||
{ text: 0 as any, searchText: '', expected: 0 },
|
{ text: 0, searchText: '', expected: 0 },
|
||||||
{ text: false as any, searchText: '', expected: false },
|
{ text: false, searchText: '', expected: false },
|
||||||
];
|
];
|
||||||
|
|
||||||
it.each(falsyTestCases)(
|
it.each(falsyTestCases)(
|
||||||
'should return expected when text or searchText is null or falsy',
|
'should return expected when text or searchText is null or falsy',
|
||||||
({ text, searchText, expected }) => {
|
({ text, searchText, expected }) => {
|
||||||
const result = highlightSearchText(
|
const result = highlightSearchText(
|
||||||
text ?? undefined,
|
(text as string) ?? undefined,
|
||||||
searchText ?? undefined
|
searchText ?? undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -498,14 +498,6 @@ export const getGlossaryWidgetFromKey = (widget: WidgetConfig) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAllExpandableKeys = (terms: ModifiedGlossary[]): string[] => {
|
|
||||||
const keys: string[] = [];
|
|
||||||
|
|
||||||
processTerms(terms, keys);
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
};
|
|
||||||
|
|
||||||
const processTerms = (termList: ModifiedGlossary[], keys: string[]) => {
|
const processTerms = (termList: ModifiedGlossary[], keys: string[]) => {
|
||||||
termList.forEach((term) => {
|
termList.forEach((term) => {
|
||||||
if (
|
if (
|
||||||
@ -520,3 +512,11 @@ const processTerms = (termList: ModifiedGlossary[], keys: string[]) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getAllExpandableKeys = (terms: ModifiedGlossary[]): string[] => {
|
||||||
|
const keys: string[] = [];
|
||||||
|
|
||||||
|
processTerms(terms, keys);
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
};
|
||||||
|
|||||||
@ -54,7 +54,7 @@ import {
|
|||||||
Users01,
|
Users01,
|
||||||
XClose,
|
XClose,
|
||||||
} from '@untitledui/icons';
|
} from '@untitledui/icons';
|
||||||
import { ComponentType } from 'react';
|
import { ComponentType, FC } from 'react';
|
||||||
|
|
||||||
// Map of icon names to their components
|
// Map of icon names to their components
|
||||||
export const ICON_MAP: Record<
|
export const ICON_MAP: Record<
|
||||||
@ -179,7 +179,7 @@ export const renderIcon = (
|
|||||||
* @param entityType - The type of entity
|
* @param entityType - The type of entity
|
||||||
* @returns The icon component
|
* @returns The icon component
|
||||||
*/
|
*/
|
||||||
export const getDefaultIconForEntityType = (entityType?: string) => {
|
export const getDefaultIconForEntityType = (entityType?: string): FC => {
|
||||||
if (entityType === 'dataProduct') {
|
if (entityType === 'dataProduct') {
|
||||||
return Cube01;
|
return Cube01;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -284,7 +284,8 @@ class ServiceUtilClassBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public getServiceExtraInfo(_data?: ServicesType): any {
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
public getServiceExtraInfo(_data?: ServicesType) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,6 +827,7 @@ class ServiceUtilClassBase {
|
|||||||
return getDriveConfig(type);
|
return getDriveConfig(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public getInsightsTabWidgets(_: ServiceTypes) {
|
public getInsightsTabWidgets(_: ServiceTypes) {
|
||||||
const widgets: Record<string, React.ComponentType<any>> = {
|
const widgets: Record<string, React.ComponentType<any>> = {
|
||||||
AgentsStatusWidget,
|
AgentsStatusWidget,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user