diff --git a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html index 5c90c76f66..84d328db75 100644 --- a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html +++ b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.html @@ -32,14 +32,19 @@
-
{{databaseConnectionErrorMessage}}
+ +
+ warning +

{{databaseConnectionErrorObject.message}}

+

{{databaseConnectionErrorObject.developerMessage}}

+
- + - + Field names separated by a comma
diff --git a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts index 20a97e007b..15328d8e63 100644 --- a/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts +++ b/plugins/ui-sqoop-table-data-processor-template/src/main/resources/static/js/plugin/processor-templates/sqoop-table-data/table-properties.component.ts @@ -87,7 +87,7 @@ export class TablePropertiesComponent implements OnChanges, OnInit { */ databaseConnectionError = false; - databaseConnectionErrorMessage: string; + databaseConnectionErrorObject: any; dbConnectionProperty: any; @@ -492,22 +492,34 @@ export class TablePropertiesComponent implements OnChanges, OnInit { return query ? tables.filter(this.createFilterForTable(query)) : tables; }), catchError((error: any) => { - this.databaseConnectionError = true; - if(error && error.error && error.error.message){ - this.databaseConnectionErrorMessage = error.error.message; - } - else if(error && error.message ){ - this.databaseConnectionErrorMessage = error.message; - } - else { - this.databaseConnectionErrorMessage = "Unable to connecto to data source."; - } - throw error; + this.setDatabaseConnectionError(error) + return Observable.throw(error); }) ); } } + private setDatabaseConnectionError(error:any){ + if(error && error.error && error.error.message){ + this.databaseConnectionErrorObject = error.error; + } + else if(error && error.message ){ + this.databaseConnectionErrorObject = error; + } + else { + this.databaseConnectionErrorObject = {message:"Unable to connect to data source ",developerMessage:null}; + } + this.databaseConnectionErrorObject.message +=". You can manually enter the table and fields below"; + + if(this.tableProperty){ + this.tableProperty.value = ""; + } + if(this.fieldsProperty) { + this.fieldsProperty.value = ""; + } + this.databaseConnectionError = true; + } + /** * Turn the schema.table string into an object for template display */ @@ -562,7 +574,7 @@ export class TablePropertiesComponent implements OnChanges, OnInit { this.tableFields = this.tableSchema.fields; this.filteredFieldDates = this.tableFields.filter(this.filterFieldDates); }, (error:any) => { - this.databaseConnectionError = true; + this.setDatabaseConnectionError(error); console.error("error",error) }); } @@ -621,8 +633,8 @@ export class TablePropertiesComponent implements OnChanges, OnInit { this.model.table.sourceTableSchema.name = this.model.table.existingTableName; this.describingTableSchema = false; this.hideDescribeTableSchemaDialog(dialogRef); - }, () => { - this.databaseConnectionError = true; + }, (error:any) => { + this.setDatabaseConnectionError(error) this.describingTableSchema = false; this.hideDescribeTableSchemaDialog(dialogRef); }); @@ -630,6 +642,7 @@ export class TablePropertiesComponent implements OnChanges, OnInit { } } + onManualTableNameChange() { if (this.model.table.method != 'EXISTING_TABLE') { this.model.table.method = 'EXISTING_TABLE'; @@ -653,7 +666,7 @@ export class TablePropertiesComponent implements OnChanges, OnInit { fieldNames.push(col.name); }); this.model.table.sourceTableSchema.fields = [...fields]; - this.feedService.setTableFields(fields); + this.model.table.setTableFields(fields) this.model.table.sourceFieldsCommaString = fieldNames.join(","); this.model.table.sourceFields = fieldNames.join("\n") diff --git a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java index 8ba9033486..f8f4c2dfd0 100644 --- a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java +++ b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/rest/controller/NifiIntegrationRestController.java @@ -464,7 +464,7 @@ public Response getTableNames(@PathParam("serviceId") String serviceId, @QueryPa tables = catalogTableManager.getTableNames(dataSource.get(), schema, tableName); } catch (final SQLException | InvalidControllerServiceLookupException e) { log.error("Unable to list table names for data source: {}", dataSource.get().getId(), e); - throw new InternalServerErrorException(e.getMessage(), e); + throw new InternalServerErrorException("Unable to connect to the data source", e); } } else { log.info("Query for Table Names against service: {}({})", serviceName, serviceId); @@ -472,7 +472,7 @@ public Response getTableNames(@PathParam("serviceId") String serviceId, @QueryPa tables = dbcpConnectionPoolTableInfo.getTableNamesForControllerService(serviceId, serviceName, schema, tableName); } catch (final InvalidControllerServiceLookupException e) { log.error("Unable to list table names for controller service: {}", serviceName, e); - throw new InternalServerErrorException(e.getMessage(), e); + throw new InternalServerErrorException("Unable to connect to the data source", e); } }