Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(components): handle empty fields in gql/facets
Browse files Browse the repository at this point in the history
Closes #2126, #2124
  • Loading branch information
Shane Wilson committed Apr 26, 2016
1 parent 3056b21 commit 1078fae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/scripts/components/facets/facets.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ module ngApp.components.facets.controllers {

addFacet() {
var selectedField = this.$scope.filteredFields[this.selectedIndex];
if (!selectedField) return;
var fileOptions = {
fields: [],
expand: [],
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/gql/gql.filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module ngApp.components.gql.filters {
class GqlHighlight {
constructor() {
return function (value: string, query: string): string {
return value.replace(query, '<strong>' + query + '</strong>');
return (value || '').replace(query, '<strong>' + query + '</strong>');
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/components/gql/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ module ngApp.components.gql {
if (parts.docType === "files") {
return this.FilesService.getFiles(params)
.then((fs: IFiles): IDdItem[] => {
var f: IFacet = fs.aggregations[parts.facet];
var f: IFacet = (fs.aggregations || {})[parts.facet] || [];
return _.map(f.buckets, (b) => {
return {field: b.key, full: b.key};
});
});
} else {
return this.ParticipantsService.getParticipants(params)
.then((fs: IParticipants): IDdItem[] => {
var f: IFacet = fs.aggregations[parts.facet];
var f: IFacet = (fs.aggregations || {})[parts.facet] || [];
return _.map(f.buckets, (b) => {
return {field: b.key, full: b.key};
});
Expand Down

0 comments on commit 1078fae

Please sign in to comment.