Skip to content

Commit

Permalink
fix post - pre tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jacovinus committed Mar 10, 2022
1 parent d2dfe05 commit 4ba972f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/LabelBrowser/helpers/querybuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { setQuery } from "../../../actions";
import store from "../../../store/store";

export function queryBuilder(labels) {
console.log(labels)
const actualQuery = store.getState().query
const preTags = actualQuery.split("{")[0]
const postTags = actualQuery.split("}")[1]
const selectedLabels = [];
for (const label of labels) {
if (label.selected && label.values && label.values.length > 0) {
Expand All @@ -26,11 +28,11 @@ export function queryBuilder(labels) {

}
}
return ["{", selectedLabels.join(","), "}"].join("");
return [preTags,"{", selectedLabels.join(","), "}",postTags].join("");
}
export function queryBuilderWithLabels() {
const labels = store.getState().labels;
console.log(labels)

const query = queryBuilder(labels)
store.dispatch(setQuery(query));
}

0 comments on commit 4ba972f

Please sign in to comment.