-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from metrico/alexey-log-label-filters
Alexey log label filters
- Loading branch information
Showing
14 changed files
with
170 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export default (labelValues) => (dispatch) => { | ||
const setLabelValues = (labelValues) => (dispatch) => { | ||
dispatch({ | ||
type: 'SET_LABEL_VALUES', | ||
labelValues | ||
}); | ||
} | ||
export default setLabelValues; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export default (labels) => (dispatch) => { | ||
export const setLabels = (labels) => (dispatch) => { | ||
dispatch({ | ||
type: 'SET_LABELS', | ||
labels: labels | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
import { setQuery } from "../../../actions"; | ||
import store from "../../../store/store"; | ||
|
||
export function queryBuilder(labels) { | ||
const selectedLabels = []; | ||
for (const label of labels) { | ||
if (label.selected && label.values && label.values.length > 0) { | ||
const selectedValues = label.values | ||
.filter((value) => value.selected) | ||
.filter((value) => value.selected && !value.inverted) | ||
.map((value) => value.name); | ||
const invertedSelectedValues = label.values | ||
.filter((value) => value.selected && value.inverted) | ||
.map((value) => value.name); | ||
|
||
if (selectedValues.length > 1) { | ||
selectedLabels.push( | ||
`${label.name}=~"${selectedValues.join("|")}"` | ||
); | ||
} else if (selectedValues.length === 1) { | ||
selectedLabels.push(`${label.name}="${selectedValues[0]}"`); | ||
} | ||
invertedSelectedValues.forEach(value => { | ||
selectedLabels.push(`${label.name}!="${value}"`) | ||
}); | ||
|
||
} | ||
} | ||
return ["{", selectedLabels.join(","), "}"].join(""); | ||
} | ||
export function queryBuilderWithLabels() { | ||
const labels = store.getState().labels; | ||
console.log(labels) | ||
const query = queryBuilder(labels) | ||
store.dispatch(setQuery(query)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters