Skip to content

Commit

Permalink
Added auto-update search + fixed minor bug with label selection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyOplachko committed Mar 1, 2022
1 parent 3723519 commit 6071816
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/actions/LoadLabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default function loadLabels(apiUrl) {
hidden: false,
facets: 0,
}));
console.log(labels)
dispatch(setLabels(labels || []));

dispatch(setApiError(''))
Expand Down
1 change: 1 addition & 0 deletions src/actions/loadLabelValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function loadLabelValues(label, labelList, apiUrl) {
selected: false,
loading: false,
hidden: false,
inverted: false
}));

const lsList = [...labelList];
Expand Down
1 change: 1 addition & 0 deletions src/components/LabelBrowser/ValuesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const ValuesList = (props) => {
const onLabelValueClick = (e, value) => {
e.preventDefault()
value.selected = !value.selected;
value.inverted = false;
onLabelValueChange();
};

Expand Down
16 changes: 8 additions & 8 deletions src/components/LogView.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ZoomIn, ZoomOut } from "@mui/icons-material/";
import { CircularProgress, IconButton } from "@mui/material";
import * as moment from "moment";
import React, { Component } from "react";
import { connect } from "react-redux";
import { CircularProgress } from "@mui/material";
import * as moment from "moment";
import store from "../store/store"
import { IconButton } from "@mui/material";
import { ZoomIn, ZoomOut } from "@mui/icons-material/";
import { setLabels } from "../actions";
import { queryBuilderWithLabels } from "./LabelBrowser/helpers/querybuilder";
import loadLabelValues from '../actions/loadLabelValues';
import ClokiChart from "../plugins/charts";
import store from "../store/store";
import { queryBuilderWithLabels } from "./LabelBrowser/helpers/querybuilder";

import loadLogs from "../actions/loadLogs"
const TAGS_LEVEL = {
critical: ['emerg', 'fatal', 'alert', 'crit', 'critical'],
error: ['err', 'eror', 'error', 'warning'],
Expand All @@ -31,7 +31,6 @@ export const ValueTags = (props) => {
labelValue.inverted = !labelValue.inverted && isInverted;
label.selected = label.values.some(value => value.selected);
store.dispatch(setLabels(labels));
queryBuilderWithLabels()
} else {
await store.dispatch(loadLabelValues(label,labels,apiUrl));
const updatedLabels = store.getState().labels;
Expand All @@ -41,8 +40,9 @@ export const ValueTags = (props) => {
labelValue.inverted = !labelValue.inverted && isInverted;
updatedLabel.selected = updatedLabel.values.some(value => value.selected);
store.dispatch(setLabels(updatedLabels));
queryBuilderWithLabels()
}
queryBuilderWithLabels()
store.dispatch(loadLogs())
}
}
const getTags = (tags) => {
Expand Down
1 change: 1 addition & 0 deletions src/components/UpdateStateFromQueryParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ async function decodeQuery(query, apiUrl) {
return i.name !== a[k - 1]?.name})
.filter((i) => !!i);
labelWithValues.values = values;
labelWithValues.selected = true;
store.dispatch(setLabels(labelsWithValues))
})

Expand Down

0 comments on commit 6071816

Please sign in to comment.