Skip to content

feat: Extend Lineage list view configuration #1961

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

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -339,14 +339,15 @@ interface FeatureLineageConfig {
}

/**
* TableLineageDisableAppListLinksConfig - maps table fields to regular expressions
* TableLineageDisableAppListLinksConfig - maps table fields to regular expressions or string lists
* for matching and disabling list links if they don't match
*/
interface TableLineageDisableAppListLinksConfig {
database?: RegExp;
cluster?: RegExp;
schema?: RegExp;
table?: RegExp;
badges?: string[];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,13 @@ export function isColumnLineagePageEnabled() {
return AppConfig.columnLineage.inAppPageEnabled;
}

/**
* Returns disableAppListLinks configuration for table lineage.
*/
export function getTableLineageDisableAppListLinks() {
return AppConfig.tableLineage.disableAppListLinks;
}
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, it only needs a test though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done:)


/**
* Returns the lineage link for a given column
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import * as React from 'react';

import AppConfig from 'config/config';
import { getTableLineageDisableAppListLinks } from 'config/config-utils';
import { ResourceType, TableResource } from 'interfaces/Resources';
import { LineageItem } from 'interfaces/Lineage';
import TableListItem from 'components/ResourceListItem/TableListItem';
Expand All @@ -15,12 +15,19 @@ export interface LineageListProps {
}

const isTableLinkDisabled = (table: LineageItem) => {
const config = AppConfig.tableLineage;
const disableAppListLinks = getTableLineageDisableAppListLinks();
let disabled = false;
if (config.disableAppListLinks) {
disabled = Object.keys(config.disableAppListLinks).some(
(key) => config.disableAppListLinks![key].test(table[key]) === false
);
if (disableAppListLinks) {
disabled = Object.keys(disableAppListLinks).some((key) => {
if (key === 'badges') {
return (
table.badges.filter(({ badge_name }) =>
disableAppListLinks?.badges?.some((badge) => badge_name === badge)
).length === 0
);
}
return disableAppListLinks![key].test(table[key]) === false;
});
}
return disabled;
};
Expand Down