Unverified Commit 2fb05b50 authored by Daniel's avatar Daniel Committed by GitHub

Renamed configs for the table profile and table lineage sections (#15)

- Added 'isBeta' configs which adds a "(BETA)" label in each section
parent 2856d4a1
...@@ -5,23 +5,10 @@ const configDefault: AppConfig = { ...@@ -5,23 +5,10 @@ const configDefault: AppConfig = {
curatedTags: [], curatedTags: [],
showAllTags: true, 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: { google: {
key: 'default-key', key: 'default-key',
sampleRate: 100, 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, logoPath: null,
navLinks: [ navLinks: [
{ {
...@@ -34,7 +21,22 @@ const configDefault: AppConfig = { ...@@ -34,7 +21,22 @@ const configDefault: AppConfig = {
href: "/browse", href: "/browse",
use_router: true, 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; export default configDefault;
...@@ -6,20 +6,20 @@ ...@@ -6,20 +6,20 @@
export interface AppConfig { export interface AppConfig {
browse: BrowseConfig; browse: BrowseConfig;
exploreSql: ExploreSqlConfig;
google: GoogleAnalyticsConfig; google: GoogleAnalyticsConfig;
lineage: LineageConfig;
logoPath: string | null; logoPath: string | null;
navLinks: Array<LinkConfig>; navLinks: Array<LinkConfig>;
tableLineage: TableLineageConfig;
tableProfile: TableProfileConfig;
} }
export interface AppConfigCustom { export interface AppConfigCustom {
browse?: BrowseConfig; browse?: BrowseConfig;
exploreSql?: ExploreSqlConfig;
google?: GoogleAnalyticsConfig google?: GoogleAnalyticsConfig
lineage?: LineageConfig;
logoPath?: string; logoPath?: string;
navLinks?: Array<LinkConfig>; navLinks?: Array<LinkConfig>;
tableLineage?: TableLineageConfig;
tableProfile?: TableProfileConfig;
} }
/** /**
...@@ -45,27 +45,31 @@ interface BrowseConfig { ...@@ -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 * isBeta - Adds a "beta" tag to the "Table Profile" section header.
* generateUrl - Generates a URL to a third party SQL explorable website. * isExploreEnabled - Enables the third party SQL explore feature.
* exploreUrlGenerator - Generates a URL to a third party SQL explorable website.
*/ */
interface ExploreSqlConfig { interface TableProfileConfig {
enabled: boolean; isBeta: boolean;
generateUrl: (database: string, cluster: string, schema: string, table: string, partitionKey?: string, partitionValue?: string) => string; 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. * 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 { interface TableLineageConfig {
enabled: boolean;
generateUrl: (database: string, cluster: string, schema: string , table: string) => string;
iconPath: string; iconPath: string;
isBeta: boolean;
isEnabled: boolean;
urlGenerator: (database: string, cluster: string, schema: string , table: string) => string;
} }
interface LinkConfig { interface LinkConfig {
......
...@@ -193,7 +193,7 @@ class DataPreviewButton extends React.Component<DataPreviewButtonProps, DataPrev ...@@ -193,7 +193,7 @@ class DataPreviewButton extends React.Component<DataPreviewButtonProps, DataPrev
disabled={disabled} disabled={disabled}
onClick={this.handleShow}> onClick={this.handleShow}>
<img className={"icon icon-color " + iconClass} /> <img className={"icon icon-color " + iconClass} />
<span>{`${buttonText} (beta)`}</span> <span>{buttonText}</span>
</button> </button>
); );
......
...@@ -153,11 +153,11 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps ...@@ -153,11 +153,11 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
} }
getAvatarForLineage = () => { 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}`; const displayName = `${this.schema}.${this.tableName}`;
return ( return (
<a href={ href } target='_blank'> <a href={ href } target='_blank'>
<AvatarLabel label={ displayName } src={ AppConfig.lineage.iconPath }/> <AvatarLabel label={ displayName } src={ AppConfig.tableLineage.iconPath }/>
</a> </a>
); );
}; };
...@@ -165,9 +165,9 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps ...@@ -165,9 +165,9 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
getExploreSqlUrl = () => { getExploreSqlUrl = () => {
const partition = this.state.tableData.partition; const partition = this.state.tableData.partition;
if (partition.is_partitioned) { 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) { createEntityCardSections(data) {
...@@ -234,8 +234,12 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps ...@@ -234,8 +234,12 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
} }
// "Lineage" Section // "Lineage" Section
if (AppConfig.lineage.enabled) { if (AppConfig.tableLineage.isEnabled) {
entityCardSections.push({'title': 'Table Lineage', 'contentRenderer': this.getAvatarForLineage, 'isEditable': false}); entityCardSections.push({
'title': 'Table Lineage' + (AppConfig.tableLineage.isBeta ? ' (beta)' : ''),
'contentRenderer': this.getAvatarForLineage,
'isEditable': false
});
} }
// "Preview" Section // "Preview" Section
...@@ -244,7 +248,7 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps ...@@ -244,7 +248,7 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
<div> <div>
<DataPreviewButton queryParams={{'schema': data.schema, 'tableName': data.table_name}} /> <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"> <a role="button" href={this.getExploreSqlUrl()} target="_blank" className="btn btn-primary btn-block">
<img className="icon icon-color icon-database"/> <img className="icon icon-color icon-database"/>
Explore with SQL Explore with SQL
...@@ -253,7 +257,11 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps ...@@ -253,7 +257,11 @@ class TableDetail extends React.Component<TableDetailProps & RouteComponentProps
</div> </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 // "Tags" Section
const sectionContentRenderer = (readOnly: boolean) => { const sectionContentRenderer = (readOnly: boolean) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment