Skip to content

Commit

Permalink
Renamed configs for the table profile and table lineage sections (#15)
Browse files Browse the repository at this point in the history
- Added 'isBeta' configs which adds a "(BETA)" label in each section
  • Loading branch information
Daniel authored and Hans Adriaans committed Jun 30, 2022
1 parent 6ed8954 commit 8b484a9
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 39 deletions.
30 changes: 16 additions & 14 deletions frontend/amundsen_application/static/config/config-default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@ const configDefault: AppConfig = {
curatedTags: [],
showAllTags: true,
},
exploreSql: {
enabled: false,
generateUrl: (database: string, cluster: string, schema: string, table: string, partitionKey?: string, partitionValue?: string) => {
return `https://DEFAULT_EXPLORE_URL?schema=${schema}&cluster=${cluster}&db=${database}&table=${table}`;
}
},
google: {
key: 'default-key',
sampleRate: 100,
},
lineage: {
enabled: false,
generateUrl: (database: string, cluster: string, schema: string, table: string) => {
return `https://DEFAULT_LINEAGE_URL?schema=${schema}&cluster=${cluster}&db=${database}&table=${table}`;
},
iconPath: 'PATH_TO_ICON'
},
logoPath: null,
navLinks: [
{
Expand All @@ -34,7 +21,22 @@ const configDefault: AppConfig = {
href: "/browse",
use_router: true,
}
]
],
tableLineage: {
iconPath: 'PATH_TO_ICON',
isBeta: false,
isEnabled: false,
urlGenerator: (database: string, cluster: string, schema: string, table: string) => {
return `https://DEFAULT_LINEAGE_URL?schema=${schema}&cluster=${cluster}&db=${database}&table=${table}`;
},
},
tableProfile: {
isBeta: false,
isExploreEnabled: false,
exploreUrlGenerator: (database: string, cluster: string, schema: string, table: string, partitionKey?: string, partitionValue?: string) => {
return `https://DEFAULT_EXPLORE_URL?schema=${schema}&cluster=${cluster}&db=${database}&table=${table}`;
}
},
};

export default configDefault;
36 changes: 20 additions & 16 deletions frontend/amundsen_application/static/config/config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

export interface AppConfig {
browse: BrowseConfig;
exploreSql: ExploreSqlConfig;
google: GoogleAnalyticsConfig;
lineage: LineageConfig;
logoPath: string | null;
navLinks: Array<LinkConfig>;
tableLineage: TableLineageConfig;
tableProfile: TableProfileConfig;
}

export interface AppConfigCustom {
browse?: BrowseConfig;
exploreSql?: ExploreSqlConfig;
google?: GoogleAnalyticsConfig
lineage?: LineageConfig;
logoPath?: string;
navLinks?: Array<LinkConfig>;
tableLineage?: TableLineageConfig;
tableProfile?: TableProfileConfig;
}

/**
Expand All @@ -45,27 +45,31 @@ interface BrowseConfig {
}

/**
* ExploreSqlCongfig - Customize an optional section in the 'table details' page where users can run SQL queries.
* TableProfileConfig - Customize the "Table Profile" section of the "Table Details" page.
*
* enabled - Whether to show or hide this section
* generateUrl - Generates a URL to a third party SQL explorable website.
* isBeta - Adds a "beta" tag to the "Table Profile" section header.
* isExploreEnabled - Enables the third party SQL explore feature.
* exploreUrlGenerator - Generates a URL to a third party SQL explorable website.
*/
interface ExploreSqlConfig {
enabled: boolean;
generateUrl: (database: string, cluster: string, schema: string, table: string, partitionKey?: string, partitionValue?: string) => string;
interface TableProfileConfig {
isBeta: boolean;
isExploreEnabled: boolean;
exploreUrlGenerator: (database: string, cluster: string, schema: string, table: string, partitionKey?: string, partitionValue?: string) => string;
}

/**
* LineageConfig - Customize an optional section in the 'table details' page where users can see a table's lineage.
* TableLineageConfig - Customize the "Table Lineage" section of the "Table Details" page.
*
* enabled - Whether to show or hide this section
* generateUrl - Generate a URL to the third party lineage website
* iconPath - Path to an icon image to display next to the lineage URL.
* isBeta - Adds a "beta" tag to the section header.
* isEnabled - Whether to show or hide this section
* urlGenerator - Generate a URL to the third party lineage website
*/
interface LineageConfig {
enabled: boolean;
generateUrl: (database: string, cluster: string, schema: string , table: string) => string;
interface TableLineageConfig {
iconPath: string;
isBeta: boolean;
isEnabled: boolean;
urlGenerator: (database: string, cluster: string, schema: string , table: string) => string;
}

interface LinkConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class DataPreviewButton extends React.Component<DataPreviewButtonProps, DataPrev
disabled={disabled}
onClick={this.handleShow}>
<img className={"icon icon-color " + iconClass} />
<span>{`${buttonText} (beta)`}</span>
<span>{buttonText}</span>
</button>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,21 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
}

getAvatarForLineage = () => {
const href = AppConfig.lineage.generateUrl(this.database, this.cluster, this.schema, this.tableName);
const href = AppConfig.tableLineage.urlGenerator(this.database, this.cluster, this.schema, this.tableName);
const displayName = `${this.schema}.${this.tableName}`;
return (
<a href={ href } target='_blank'>
<AvatarLabel label={ displayName } src={ AppConfig.lineage.iconPath }/>
<AvatarLabel label={ displayName } src={ AppConfig.tableLineage.iconPath }/>
</a>
);
};

getExploreSqlUrl = () => {
const partition = this.state.tableData.partition;
if (partition.is_partitioned) {
return AppConfig.exploreSql.generateUrl(this.database, this.cluster, this.schema, this.tableName, partition.key, partition.value);
return AppConfig.tableProfile.exploreUrlGenerator(this.database, this.cluster, this.schema, this.tableName, partition.key, partition.value);
}
return AppConfig.exploreSql.generateUrl(this.database, this.cluster, this.schema, this.tableName);
return AppConfig.tableProfile.exploreUrlGenerator(this.database, this.cluster, this.schema, this.tableName);
};

createEntityCardSections(data) {
Expand Down Expand Up @@ -234,8 +234,12 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
}

// "Lineage" Section
if (AppConfig.lineage.enabled) {
entityCardSections.push({'title': 'Table Lineage', 'contentRenderer': this.getAvatarForLineage, 'isEditable': false});
if (AppConfig.tableLineage.isEnabled) {
entityCardSections.push({
'title': 'Table Lineage' + (AppConfig.tableLineage.isBeta ? ' (beta)' : ''),
'contentRenderer': this.getAvatarForLineage,
'isEditable': false
});
}

// "Preview" Section
Expand All @@ -244,7 +248,7 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
<div>
<DataPreviewButton queryParams={{'schema': data.schema, 'tableName': data.table_name}} />
{
AppConfig.exploreSql.enabled &&
AppConfig.tableProfile.isExploreEnabled &&
<a role="button" href={this.getExploreSqlUrl()} target="_blank" className="btn btn-primary btn-block">
<img className="icon icon-color icon-database"/>
Explore with SQL
Expand All @@ -253,7 +257,11 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
</div>
);
};
entityCardSections.push({'title': 'Table Profile', 'contentRenderer': previewSectionRenderer, 'isEditable': false});
entityCardSections.push({
'title': 'Table Profile' + (AppConfig.tableProfile.isBeta ? ' (beta)' : ''),
'contentRenderer': previewSectionRenderer,
'isEditable': false
});

// "Tags" Section
const sectionContentRenderer = (readOnly: boolean) => {
Expand Down

0 comments on commit 8b484a9

Please sign in to comment.