Skip to content

Commit

Permalink
Merge pull request #62 from metrico/jacovinus-copy-link-fix
Browse files Browse the repository at this point in the history
fix content outside curly braces
  • Loading branch information
jacovinus authored Mar 10, 2022
2 parents d2dfe05 + 4ba972f commit 86dfa2e
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 86dfa2e

Please sign in to comment.