Skip to content

Commit

Permalink
fix: print error when __CATEGORIES__ used and no categories set (#388)
Browse files Browse the repository at this point in the history
* Print error when categories are empty

* lint fix
  • Loading branch information
iloveitaly committed Jan 11, 2023
1 parent 0f7cf77 commit 7d4438f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/views/QueryExplorer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ RETURN = sort_by_duration(merged_events);
// replace magic string `__CATEGORIES__` in query text with latest category rule
if (_.includes(query, '__CATEGORIES__')) {
const categoryRules = useCategoryStore().classes_for_query;
// const classes_str = JSON.stringify(params.classes).replace(/\\\\/g, '\\');
if (useCategoryStore().classes_for_query.length === 0) {
this.error = '__CATEGORIES__ was used in query but no categories have been defined yet.';
return;
}
query = query.replace('__CATEGORIES__', JSON.stringify(categoryRules));
}
Expand Down

1 comment on commit 7d4438f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are screenshots of this commit:

Screenshots using aw-server v0.12.1 (click to expand)

Screenshots using aw-server-rust master (click to expand)

Screenshots using aw-server-rust v0.12.1 (click to expand)

Please sign in to comment.