Skip to content
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

fix(ui): null dereference #12193

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function matchesTagsOrTermsOrDescription(field: SchemaField, filterText: string,
.toLocaleLowerCase()
.includes(filterText),
) ||
field.description?.toLocaleLowerCase().includes(filterText)
field.description?.toLocaleLowerCase()?.includes(filterText)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions datahub-web-react/src/app/lineage/utils/titleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const useSearchResult = () => {
};

export const useEntityType = () => {
return useSearchResultContext()?.searchResult.entity.type;
return useSearchResultContext()?.searchResult?.entity?.type;
};

export const useMatchedFields = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading