mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-31 12:52:13 +00:00
fix(ui): null dereference (#12193)
This commit is contained in:
parent
d06980f6f3
commit
dd23f9e294
@ -68,6 +68,6 @@ export function getDatasetName(datainput: any): string {
|
||||
datainput?.editableProperties?.name ||
|
||||
datainput?.properties?.name ||
|
||||
datainput?.name ||
|
||||
datainput?.urn?.split(',').at(1)
|
||||
datainput?.urn?.split(',')?.at(1)
|
||||
);
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ export const filterQueries = (filterText, queries: Query[]) => {
|
||||
const lowerFilterText = filterText.toLowerCase();
|
||||
return queries.filter((query) => {
|
||||
return (
|
||||
query.title?.toLowerCase().includes(lowerFilterText) ||
|
||||
query.description?.toLowerCase().includes(lowerFilterText) ||
|
||||
query.query?.toLowerCase().includes(lowerFilterText)
|
||||
query.title?.toLowerCase()?.includes(lowerFilterText) ||
|
||||
query.description?.toLowerCase()?.includes(lowerFilterText) ||
|
||||
query.query?.toLowerCase()?.includes(lowerFilterText)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ function matchesTagsOrTermsOrDescription(field: SchemaField, filterText: string,
|
||||
.toLocaleLowerCase()
|
||||
.includes(filterText),
|
||||
) ||
|
||||
field.description?.toLocaleLowerCase().includes(filterText)
|
||||
field.description?.toLocaleLowerCase()?.includes(filterText)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
|
||||
downloadFile(output, `exec-${urn}.log`);
|
||||
};
|
||||
|
||||
const logs = (showExpandedLogs && output) || output?.split('\n').slice(0, 5).join('\n');
|
||||
const logs = (showExpandedLogs && output) || output?.split('\n')?.slice(0, 5)?.join('\n');
|
||||
const result = data?.executionRequest?.result as Partial<ExecutionRequestResult>;
|
||||
const status = getIngestionSourceStatus(result);
|
||||
|
||||
@ -163,7 +163,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
|
||||
} catch (e) {
|
||||
recipeYaml = '';
|
||||
}
|
||||
const recipe = showExpandedRecipe ? recipeYaml : recipeYaml?.split('\n').slice(0, 5).join('\n');
|
||||
const recipe = showExpandedRecipe ? recipeYaml : recipeYaml?.split('\n')?.slice(0, 5)?.join('\n');
|
||||
|
||||
const areLogsExpandable = output?.split(/\r\n|\r|\n/)?.length > 5;
|
||||
const isRecipeExpandable = recipeYaml?.split(/\r\n|\r|\n/)?.length > 5;
|
||||
|
@ -124,10 +124,10 @@ function truncate(input, length) {
|
||||
function getLastTokenOfTitle(title?: string): string {
|
||||
if (!title) return '';
|
||||
|
||||
const lastToken = title?.split('.').slice(-1)[0];
|
||||
const lastToken = title?.split('.')?.slice(-1)?.[0];
|
||||
|
||||
// if the last token does not contain any content, the string should not be tokenized on `.`
|
||||
if (lastToken.replace(/\s/g, '').length === 0) {
|
||||
if (lastToken?.replace(/\s/g, '')?.length === 0) {
|
||||
return title;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ export const useSearchResult = () => {
|
||||
};
|
||||
|
||||
export const useEntityType = () => {
|
||||
return useSearchResultContext()?.searchResult.entity.type;
|
||||
return useSearchResultContext()?.searchResult?.entity?.type;
|
||||
};
|
||||
|
||||
export const useMatchedFields = () => {
|
||||
|
@ -42,7 +42,7 @@ const RenderedField = ({
|
||||
field: MatchedField;
|
||||
}) => {
|
||||
const entityRegistry = useEntityRegistry();
|
||||
const query = useSearchQuery()?.trim().toLowerCase();
|
||||
const query = useSearchQuery()?.trim()?.toLowerCase();
|
||||
const customRenderedField = customFieldRenderer?.(field);
|
||||
if (customRenderedField) return <b>{customRenderedField}</b>;
|
||||
if (isHighlightableEntityField(field)) {
|
||||
|
@ -23,7 +23,7 @@ const SearchTextHighlighter = ({ field, text, enableFullHighlight = false }: Pro
|
||||
const enableNameHighlight = appConfig.config.visualConfig.searchResult?.enableNameHighlight;
|
||||
const matchedFields = useMatchedFieldsByGroup(field);
|
||||
const hasMatchedField = !!matchedFields?.length;
|
||||
const normalizedSearchQuery = useSearchQuery()?.trim().toLowerCase();
|
||||
const normalizedSearchQuery = useSearchQuery()?.trim()?.toLowerCase();
|
||||
const normalizedText = text.trim().toLowerCase();
|
||||
const hasSubstring = hasMatchedField && !!normalizedSearchQuery && normalizedText.includes(normalizedSearchQuery);
|
||||
const pattern = enableFullHighlight ? HIGHLIGHT_ALL_PATTERN : undefined;
|
||||
|
Loading…
x
Reference in New Issue
Block a user