Skip to content

Commit

Permalink
fix datasource querying table names
Browse files Browse the repository at this point in the history
  • Loading branch information
scottreisdorf committed Nov 29, 2018
1 parent 7dd272c commit 2fdcb08
Showing 1 changed file with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
if(this.dbConnectionProperty && this.catalogNiFiControllerServiceIds != null){
(this.dbConnectionProperty.propertyDescriptor.allowableValues as any[])
.filter((allowableValue: any) => allowableValue.displayName.indexOf("**") == -1 && this.catalogNiFiControllerServiceIds.indexOf(allowableValue.value) >=0)
.forEach((allowableValue:any) => {allowableValue.displayName +="**";
.forEach((allowableValue:any) => {
allowableValue.catalogSource = true;
allowableValue.origName = allowableValue.displayName;
allowableValue.displayName +="**";
});
}

Expand Down Expand Up @@ -468,7 +470,11 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
const service = (this.dbConnectionProperty.propertyDescriptor.allowableValues as any[])
.find((allowableValue: any) => allowableValue.value == this.dbConnectionProperty);
if (typeof service !== "undefined") {
httpOptions.params.serviceName = service.displayName;
let name = service.displayName;
if(service.catalogSource && service.origName){
name = service.origName;
}
httpOptions.params.serviceName = name
}
}

Expand Down Expand Up @@ -562,11 +568,17 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
if (dbcpProperty != null && dbcpProperty.value != null && this.selectedTable != null) {
this.updateRestrictIncrementalToDateOnly();
let serviceId = dbcpProperty.value;
let serviceNameValue: any = null;

let serviceName = '';
if (Array.isArray(dbcpProperty.propertyDescriptor.allowableValues)) {
dbcpProperty.propertyDescriptor.allowableValues.find((allowableValue: any) => allowableValue.value == serviceId);
let service = dbcpProperty.propertyDescriptor.allowableValues.find((allowableValue: any) => allowableValue.value == serviceId);
if(service != undefined) {
serviceName = service.displayName;
if (service.catalogSource && service.origName) {
serviceName = service.origName;
}
}
}
let serviceName = serviceNameValue != null && serviceNameValue != undefined ? serviceNameValue.displayName : '';
this.http.get(this.tableSchemaService.DESCRIBE_TABLE_URL(serviceId, this.selectedTable.tableName), {params: {schema: this.selectedTable.schema, serviceName: serviceName}})
.subscribe((response) => {
this.databaseConnectionError = false;
Expand All @@ -593,13 +605,17 @@ export class TablePropertiesComponent implements OnChanges, OnInit {
this.describingTableSchema = true;

let serviceId = dbcpProperty.value;
let serviceNameValue = null;
let service = null;
let serviceName = '';
if (dbcpProperty.propertyDescriptor.allowableValues) {
serviceNameValue = dbcpProperty.propertyDescriptor.allowableValues.find((allowableValue: any) => {
return allowableValue.value == serviceId;
});
service = dbcpProperty.propertyDescriptor.allowableValues.find((allowableValue: any) => allowableValue.value == serviceId);
}
if(service != undefined && service != null) {
serviceName = service.displayName;
if (service.catalogSource && service.origName) {
serviceName = service.origName;
}
}
let serviceName = serviceNameValue != null && serviceNameValue != undefined ? serviceNameValue.displayName : '';
this.http.get(this.tableSchemaService.DESCRIBE_TABLE_URL(serviceId, this.selectedTable.tableName), {params: {schema: this.selectedTable.schema, serviceName: serviceName}})
.subscribe((response) => {
this.databaseConnectionError = false;
Expand Down

0 comments on commit 2fdcb08

Please sign in to comment.