Skip to content

Commit

Permalink
Fix source controller service database ui rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
scottreisdorf committed Nov 29, 2018
1 parent eaa0492 commit 1a72fea
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<processor-form *ngIf="processor.form.disabled" [form]="form" [processor]="processor" [readonly]="true"></processor-form>

<div *ngIf="processor.form.enabled" class="layout-padding-indent">
<div *ngIf="processor.form.enabled && initialized == true" class="layout-padding-indent">

<processor-form [form]="form" [processor]="processor" [properties]="dbConnectionProperty" [readonly]="false" class="layout-padding-top-bottom"></processor-form>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);

}

Expand Down Expand Up @@ -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;
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 1a72fea

Please sign in to comment.