From 1a72feaf1849daac73c9a8b46b6969ffc5edb184 Mon Sep 17 00:00:00 2001 From: Scott Reisdorf Date: Wed, 28 Nov 2018 22:19:21 -0800 Subject: [PATCH] Fix source controller service database ui rendering --- .../rest/model/NiFiPropertyDescriptor.java | 5 +++++ .../table-properties.component.html | 2 +- .../table-properties.component.ts | 18 +++++++++++++----- .../template/RegisteredTemplateService.java | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/integrations/nifi/nifi-rest/nifi-rest-model/src/main/java/com/thinkbiganalytics/nifi/rest/model/NiFiPropertyDescriptor.java b/integrations/nifi/nifi-rest/nifi-rest-model/src/main/java/com/thinkbiganalytics/nifi/rest/model/NiFiPropertyDescriptor.java index 0ce2bfd269..6eaae43fe7 100644 --- a/integrations/nifi/nifi-rest/nifi-rest-model/src/main/java/com/thinkbiganalytics/nifi/rest/model/NiFiPropertyDescriptor.java +++ b/integrations/nifi/nifi-rest/nifi-rest-model/src/main/java/com/thinkbiganalytics/nifi/rest/model/NiFiPropertyDescriptor.java @@ -20,11 +20,16 @@ * #L% */ +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + import java.util.List; /** * A description of a property. */ +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonIgnoreProperties(ignoreUnknown = true) public class NiFiPropertyDescriptor { private String name; 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 810abd22e1..5c90c76f66 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 @@ -1,6 +1,6 @@ -
+
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 93504e417c..708171db42 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 @@ -159,6 +159,8 @@ export class TablePropertiesComponent implements OnChanges, OnInit { catalogNiFiControllerServiceIds:string[] = null; + initialized:boolean = false; + constructor(private http: HttpClient, private dialog: MatDialog, @Inject("FeedService") private feedService: any, @Inject("DBCPTableSchemaService") private tableSchemaService: any) { // Handle connection service changes this.form.valueChanges.pipe( @@ -231,14 +233,17 @@ export class TablePropertiesComponent implements OnChanges, OnInit { this.dbConnectionProperty = this.findProperty(this.connectionServiceKey, false); //update the hint only when editing - const hintSuffix = ". ** indicates an existing catalog data source"; + const hintSuffix = " ** Indicates an existing catalog data source"; if(this.dbConnectionProperty) { let desc = this.dbConnectionProperty.propertyDescriptor.origDescription || this.dbConnectionProperty.propertyDescriptor.description; - if (desc != undefined && !this.processor.form.disabled) { - if(desc.indexOf(hintSuffix) == -1){ + if (!this.processor.form.disabled) { + if(desc != undefined && desc.indexOf(hintSuffix) == -1){ this.dbConnectionProperty.propertyDescriptor.origDescription = desc; this.dbConnectionProperty.propertyDescriptor.description = desc+hintSuffix; } + else if (desc == undefined || desc == null){ + this.dbConnectionProperty.propertyDescriptor.description = hintSuffix; + } } else if(desc != undefined){ this.dbConnectionProperty.propertyDescriptor.description = desc; } @@ -279,7 +284,8 @@ export class TablePropertiesComponent implements OnChanges, OnInit { this.http.get(url).subscribe((responses:any[]) => { this.catalogNiFiControllerServiceIds = responses.map((source:any) => source.nifiControllerServiceId); this.updateDbConnectionPropertyOptions(); - }); + this.initialized = true; + },(error1:any) => this.initialized = true); } @@ -494,8 +500,10 @@ export class TablePropertiesComponent implements OnChanges, OnInit { this.databaseConnectionErrorMessage = error.message; } else { - this.databaseConnectionErrorMessage = "Unable to connecto to data source"; + this.databaseConnectionErrorMessage = "Unable to connecto to data source."; } + + this.databaseConnectionErrorMessage +=". If you know the table name and source field names you can manually enter them below." throw error; }) ); diff --git a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/service/template/RegisteredTemplateService.java b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/service/template/RegisteredTemplateService.java index 7a8088dbe3..cd72d86c94 100644 --- a/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/service/template/RegisteredTemplateService.java +++ b/services/feed-manager-service/feed-manager-controller/src/main/java/com/thinkbiganalytics/feedmgr/service/template/RegisteredTemplateService.java @@ -504,7 +504,7 @@ public FeedMetadata mergeTemplatePropertiesWithFeed(FeedMetadata feedMetadata) { RegisteredTemplate registeredTemplate = findRegisteredTemplate( - new RegisteredTemplateRequest.Builder().templateId(feedMetadata.getTemplateId()).isFeedEdit(true).nifiTemplateId(feedMetadata.getTemplateId()).includeAllProperties(true).build()); + new RegisteredTemplateRequest.Builder().templateId(feedMetadata.getTemplateId()).isFeedEdit(true).nifiTemplateId(feedMetadata.getTemplateId()).includePropertyDescriptors(true).includeAllProperties(true).build()); if (registeredTemplate != null) { feedMetadata.setTemplateId(registeredTemplate.getId());