Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
EshaanAgg committed Jun 26, 2024
1 parent 0a84579 commit 1b09990
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default class FilterCard extends React.PureComponent {
if (!this.props.filter) {
return;
}

if (
!prevProps.filter ||
prevProps.filter.values !== this.props.filter.values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export default class FilterContainer extends React.PureComponent {
};
}
this.props.resetFilterHook(() => this.resetAllFilters());
this.state = { filters, toolName, addingFilter: false, numCards: 0 };
this.state = {
filters,
toolName,
addingFilter: false,
numCards: 0,
};
}

getActiveFilters() {
Expand All @@ -42,6 +47,7 @@ export default class FilterContainer extends React.PureComponent {

addFilter(idx) {
const { filters: newFilterState, numCards } = this.state;

const newFilter = { filtering: true, numCards, touched: 0 };
if (newFilterState[idx].type === "status") {
newFilter.values = [
Expand Down Expand Up @@ -80,12 +86,16 @@ export default class FilterContainer extends React.PureComponent {
const newFilterState = this.state.filters;
newFilterState[idx].filtering = false;
newFilterState[idx].values = [];
this.setState({ filters: [...newFilterState] });
this.setState({
filters: [...newFilterState],
});
this.props.updateFilters({ title, values: [] }, idx);
}

componentDidUpdate({ currentFilters: prevFilters }) {
componentDidUpdate(prevProps, prevState) {
const prevFilters = prevProps.currentFilters;
const { currentFilters } = this.props;

if (!equals(prevFilters, currentFilters)) {
// update set filters
let { filters } = this.state;
Expand Down
35 changes: 0 additions & 35 deletions benchexec/tablegenerator/react-table/src/components/NavSync.js

This file was deleted.

18 changes: 3 additions & 15 deletions benchexec/tablegenerator/react-table/src/components/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import SelectColumn from "./SelectColumn.js";
import ScatterPlot from "./ScatterPlot.js";
import QuantilePlot from "./QuantilePlot.js";
import FilterBox from "./FilterBox/FilterBox.js";
import NavSync from "./NavSync.js";
import LinkOverlay from "./LinkOverlay.js";
import classNames from "classnames";
import FilterInfoButton from "./FilterInfoButton.js";
Expand Down Expand Up @@ -104,7 +103,6 @@ export default class Overview extends React.Component {
active: getActiveTab(),
quantilePreSelection: tools[0].columns[1],
hiddenCols: createHiddenColsFromURL(tools),
mounted: false,
};
// Collect all status and category values for filter drop-down
this.statusValues = this.findAllValuesOfColumn(
Expand Down Expand Up @@ -157,8 +155,8 @@ export default class Overview extends React.Component {
}
}

addTypeToFilter = (filters) =>
filters
addTypeToFilter = (filters) => {
return filters
.filter((filter) => filter.id !== "id")
.forEach((filter) => {
const filterSplitArray = filter.id.split("_");
Expand All @@ -168,18 +166,14 @@ export default class Overview extends React.Component {
].type;
filter.type = type;
});
};

componentDidMount() {
this.updateFiltersFromUrl();
this.setState({
mounted: true,
});
this.updateState();

// window.history.onpushstate = () => {
// this.updateState();
// this.updateFiltersFromUrl();
// };
}

getFiltersFromUrl = () => {
Expand Down Expand Up @@ -375,12 +369,6 @@ export default class Overview extends React.Component {
</div>
<div className="route-container">
{/* Component to sync the navigation state. Does not render anything. */}
{this.state.mounted && (
<NavSync
updateState={this.updateState}
updateFiltersFromUrl={this.updateFiltersFromUrl}
/>
)}
<Routes>
<Route
path="/"
Expand Down
31 changes: 11 additions & 20 deletions benchexec/tablegenerator/react-table/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,21 +338,14 @@ function makeStatusColumnFilter(
const toolCategoryValues = allCategoryValues[tool][columnId];

const hasStatusFilter = !!statusValues;
const hasStatusUnchecked =
hasStatusFilter && statusValues.length !== toolStatusValues.length;

const hasCategoryFilter = !!categoryValues;
const hasCategoryUnchecked =
hasCategoryFilter && categoryValues.length !== toolCategoryValues.length;

if (hasStatusFilter) {
if (hasStatusUnchecked) {
const encodedFilter = createDistinctValueFilters(
statusValues,
toolStatusValues,
);
statusColumnFilter.push(`status(${encodedFilter})`);
}
const encodedFilter = createDistinctValueFilters(
statusValues,
toolStatusValues,
);
statusColumnFilter.push(`status(${encodedFilter})`);
if (!hasCategoryFilter) {
statusColumnFilter.push("category(empty())");
}
Expand All @@ -361,14 +354,12 @@ function makeStatusColumnFilter(
if (!hasStatusFilter) {
statusColumnFilter.push("status(empty())");
}
if (hasCategoryUnchecked) {
const encodedFilter = createDistinctValueFilters(
categoryValues,
toolCategoryValues,
true,
);
statusColumnFilter.push(`category(${encodedFilter})`);
}
const encodedFilter = createDistinctValueFilters(
categoryValues,
toolCategoryValues,
true,
);
statusColumnFilter.push(`category(${encodedFilter})`);
}
return statusColumnFilter.join(",");
}
Expand Down

0 comments on commit 1b09990

Please sign in to comment.