Skip to content

Commit

Permalink
Merge pull request #834 from MauroDataMapper/feature/gh-833
Browse files Browse the repository at this point in the history
Fix for #833 - fix array when suggestions are for a single data element
  • Loading branch information
joe-crawford authored Nov 6, 2023
2 parents 97a9e55 + f5b3bc6 commit e13b651
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/link-suggestion/link-suggestion.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,10 @@ export class LinkSuggestionComponent implements OnInit {
} else if (this.model.source.domainType === 'DataElement') {
this.resources.dataElement.suggestLinks(this.model.source.model, this.model.source.dataClass, this.model.source.id, this.model.target.id).subscribe((data) => {
if (data.body) {
this.model.suggestions = data.body;
this.model.suggestions = [data.body];
this.model.totalSuggestionLinks = 1;
this.model.suggestions.forEach((suggestion) => {
suggestion.selectedTarget = suggestion.results[0];
});
this.datasource.data = [data];
this.model.suggestions[0].selectedTarget = this.model.suggestions[0].results[0];
this.datasource.data = [data.body];
this.datasource.paginator = this.paginator;
this.datasource.sort = this.sort;
}
Expand Down

0 comments on commit e13b651

Please sign in to comment.