diff options
author | Emiliano Ciavatta | 2020-10-16 09:13:21 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2020-10-16 09:13:21 +0000 |
commit | 2fb8993008752063fa13f253784e9e92552e339d (patch) | |
tree | cf95bee27b217b993008939dd63b83609b0c9796 /frontend/src/components/filters | |
parent | af087d327d065c92d454c4e6391a0040d8d527b9 (diff) |
Refactor js files
Diffstat (limited to 'frontend/src/components/filters')
5 files changed, 15 insertions, 25 deletions
diff --git a/frontend/src/components/filters/AdvancedFilters.js b/frontend/src/components/filters/AdvancedFilters.js index f5ba825..2b479ed 100644 --- a/frontend/src/components/filters/AdvancedFilters.js +++ b/frontend/src/components/filters/AdvancedFilters.js @@ -15,11 +15,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import React, {Component} from 'react'; +import React, {Component} from "react"; import {withRouter} from "react-router-dom"; import dispatcher from "../../dispatcher"; -import ButtonField from "../fields/ButtonField"; import {updateParams} from "../../utils"; +import ButtonField from "../fields/ButtonField"; class AdvancedFilters extends Component { diff --git a/frontend/src/components/filters/BooleanConnectionsFilter.js b/frontend/src/components/filters/BooleanConnectionsFilter.js index 9558323..0355167 100644 --- a/frontend/src/components/filters/BooleanConnectionsFilter.js +++ b/frontend/src/components/filters/BooleanConnectionsFilter.js @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import React, {Component} from 'react'; +import React, {Component} from "react"; import {withRouter} from "react-router-dom"; -import CheckField from "../fields/CheckField"; import dispatcher from "../../dispatcher"; +import CheckField from "../fields/CheckField"; class BooleanConnectionsFilter extends Component { @@ -30,7 +30,7 @@ class BooleanConnectionsFilter extends Component { let params = new URLSearchParams(this.props.location.search); this.setState({filterActive: this.toBoolean(params.get(this.props.filterName)).toString()}); - this.connectionsFiltersCallback = payload => { + this.connectionsFiltersCallback = (payload) => { const name = this.props.filterName; if (name in payload && this.state.filterActive !== payload[name]) { this.setState({filterActive: payload[name]}); diff --git a/frontend/src/components/filters/ExitSearchFilter.js b/frontend/src/components/filters/ExitSearchFilter.js index 68ca686..72cfb0c 100644 --- a/frontend/src/components/filters/ExitSearchFilter.js +++ b/frontend/src/components/filters/ExitSearchFilter.js @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import React, {Component} from 'react'; +import React, {Component} from "react"; import {withRouter} from "react-router-dom"; -import CheckField from "../fields/CheckField"; import dispatcher from "../../dispatcher"; +import CheckField from "../fields/CheckField"; class ExitSearchFilter extends Component { diff --git a/frontend/src/components/filters/RulesConnectionsFilter.js b/frontend/src/components/filters/RulesConnectionsFilter.js index 8e40d30..86eae7e 100644 --- a/frontend/src/components/filters/RulesConnectionsFilter.js +++ b/frontend/src/components/filters/RulesConnectionsFilter.js @@ -15,14 +15,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import React, {Component} from 'react'; +import React, {Component} from "react"; import {withRouter} from "react-router-dom"; import backend from "../../backend"; import dispatcher from "../../dispatcher"; import TagField from "../fields/TagField"; -const classNames = require('classnames'); -const _ = require('lodash'); +const classNames = require("classnames"); +const _ = require("lodash"); class RulesConnectionsFilter extends Component { diff --git a/frontend/src/components/filters/StringConnectionsFilter.js b/frontend/src/components/filters/StringConnectionsFilter.js index 18b3784..c3c5925 100644 --- a/frontend/src/components/filters/StringConnectionsFilter.js +++ b/frontend/src/components/filters/StringConnectionsFilter.js @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import React, {Component} from 'react'; +import React, {Component} from "react"; import {withRouter} from "react-router-dom"; -import InputField from "../fields/InputField"; import dispatcher from "../../dispatcher"; +import InputField from "../fields/InputField"; class StringConnectionsFilter extends Component { @@ -56,15 +56,9 @@ class StringConnectionsFilter extends Component { fieldValue = this.props.replaceFunc(fieldValue); } if (this.isValueValid(fieldValue)) { - this.setState({ - fieldValue: fieldValue, - filterValue: filterValue - }); + this.setState({fieldValue, filterValue: filterValue}); } else { - this.setState({ - fieldValue: fieldValue, - invalidValue: true - }); + this.setState({fieldValue, invalidValue: true}); } } else { this.setState({fieldValue: "", filterValue: null}); @@ -97,7 +91,6 @@ class StringConnectionsFilter extends Component { } - if (this.isValueValid(fieldValue)) { let filterValue = fieldValue; if (filterValue !== "" && typeof this.props.encodeFunc === "function") { @@ -113,10 +106,7 @@ class StringConnectionsFilter extends Component { invalidValue: false }); } else { - this.setState({ - fieldValue: fieldValue, - invalidValue: true - }); + this.setState({fieldValue, invalidValue: true}); } }; |