Skip to content

Commit

Permalink
Lint: Fix eslint react/jsx-no-bind (#1992)
Browse files Browse the repository at this point in the history
  • Loading branch information
atrovato authored Feb 26, 2024
1 parent 0d5b8c9 commit dd35b83
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DeviceTab extends Component {
this.getHouses();
}

async getDevices() {
getDevices = async () => {
this.setState({
getMelCloudStatus: RequestStatus.Getting
});
Expand All @@ -43,7 +43,7 @@ class DeviceTab extends Component {
getMelCloudStatus: e.message
});
}
}
};

async getHouses() {
this.setState({
Expand Down Expand Up @@ -71,12 +71,13 @@ class DeviceTab extends Component {
});
this.getDevices();
}
async changeOrderDir(e) {

changeOrderDir = async e => {
await this.setState({
orderDir: e.target.value
});
this.getDevices();
}
};

render({}, { orderDir, search, getMELCloudStatus, melcloudDevices, housesWithRooms }) {
return (
Expand All @@ -88,7 +89,7 @@ class DeviceTab extends Component {
<div class="page-options d-flex">
<Localizer>
<CardFilter
changeOrderDir={this.changeOrderDir.bind(this)}
changeOrderDir={this.changeOrderDir}
orderValue={orderDir}
search={this.debouncedSearch}
searchValue={search}
Expand All @@ -115,7 +116,7 @@ class DeviceTab extends Component {
deleteButton
device={device}
deviceIndex={index}
getDevices={this.getDevices.bind(this)}
getDevices={this.getDevices}
housesWithRooms={housesWithRooms}
/>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DiscoverTab extends Component {
}
}

async getDiscoveredDevices() {
getDiscoveredDevices = async () => {
this.setState({
loading: true
});
Expand All @@ -52,7 +52,7 @@ class DiscoverTab extends Component {
errorLoading: true
});
}
}
};

render(props, { loading, errorLoading, discoveredDevices, housesWithRooms }) {
return (
Expand All @@ -62,11 +62,7 @@ class DiscoverTab extends Component {
<Text id="integration.melcloud.discover.title" />
</h1>
<div class="page-options d-flex">
<button
onClick={this.getDiscoveredDevices.bind(this)}
class="btn btn-outline-primary ml-2"
disabled={loading}
>
<button onClick={this.getDiscoveredDevices} class="btn btn-outline-primary ml-2" disabled={loading}>
<Text id="integration.melcloud.discover.scan" /> <i class="fe fe-radio" />
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SetupTab extends Component {
}
}

async saveConfiguration(e) {
saveConfiguration = async e => {
e.preventDefault();
this.setState({
melcloudSaveSettingsStatus: RequestStatus.Getting
Expand All @@ -68,13 +68,13 @@ class SetupTab extends Component {
melcloudSaveSettingsStatus: RequestStatus.Error
});
}
}
};

updateConfiguration(e) {
updateConfiguration = e => {
this.setState({
[e.target.name]: e.target.value
});
}
};

togglePassword = () => {
const { showPassword } = this.state;
Expand Down Expand Up @@ -123,7 +123,7 @@ class SetupTab extends Component {
placeholder={<Text id="integration.melcloud.setup.usernamePlaceholder" />}
value={state.melCloudUsername}
class="form-control"
onInput={this.updateConfiguration.bind(this)}
onInput={this.updateConfiguration}
/>
</Localizer>
</div>
Expand All @@ -140,7 +140,7 @@ class SetupTab extends Component {
placeholder={<Text id="integration.melcloud.setup.passwordPlaceholder" />}
value={state.melCloudPassword}
className="form-control"
onInput={this.updateConfiguration.bind(this)}
onInput={this.updateConfiguration}
/>
</Localizer>
<span class="input-icon-addon cursor-pointer" onClick={this.togglePassword}>
Expand All @@ -156,7 +156,7 @@ class SetupTab extends Component {

<div class="row mt-5">
<div class="col">
<button type="submit" class="btn btn-success" onClick={this.saveConfiguration.bind(this)}>
<button type="submit" class="btn btn-success" onClick={this.saveConfiguration}>
<Text id="integration.melcloud.setup.saveLabel" />
</button>
</div>
Expand Down
13 changes: 7 additions & 6 deletions front/src/routes/integration/all/sonos/device-page/DeviceTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DeviceTab extends Component {
this.getHouses();
}

async getSonosDevices() {
getSonosDevices = async () => {
this.setState({
getSonosStatus: RequestStatus.Getting
});
Expand All @@ -43,7 +43,7 @@ class DeviceTab extends Component {
getSonosStatus: e.message
});
}
}
};

async getHouses() {
this.setState({
Expand Down Expand Up @@ -71,12 +71,13 @@ class DeviceTab extends Component {
});
this.getSonosDevices();
}
async changeOrderDir(e) {

changeOrderDir = async e => {
await this.setState({
orderDir: e.target.value
});
this.getSonosDevices();
}
};

render({}, { orderDir, search, getSonosStatus, sonosDevices, housesWithRooms }) {
return (
Expand All @@ -88,7 +89,7 @@ class DeviceTab extends Component {
<div class="page-options d-flex">
<Localizer>
<CardFilter
changeOrderDir={this.changeOrderDir.bind(this)}
changeOrderDir={this.changeOrderDir}
orderValue={orderDir}
search={this.debouncedSearch}
searchValue={search}
Expand All @@ -115,7 +116,7 @@ class DeviceTab extends Component {
deleteButton
device={device}
deviceIndex={index}
getSonosDevices={this.getSonosDevices.bind(this)}
getSonosDevices={this.getSonosDevices}
housesWithRooms={housesWithRooms}
/>
))}
Expand Down
13 changes: 7 additions & 6 deletions front/src/routes/integration/all/tuya/device-page/DeviceTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DeviceTab extends Component {
this.getHouses();
}

async getTuyaDevices() {
getTuyaDevices = async () => {
this.setState({
getTuyaStatus: RequestStatus.Getting
});
Expand All @@ -43,7 +43,7 @@ class DeviceTab extends Component {
getTuyaStatus: e.message
});
}
}
};

async getHouses() {
this.setState({
Expand Down Expand Up @@ -71,12 +71,13 @@ class DeviceTab extends Component {
});
this.getTuyaDevices();
}
async changeOrderDir(e) {

changeOrderDir = async e => {
await this.setState({
orderDir: e.target.value
});
this.getTuyaDevices();
}
};

render({}, { orderDir, search, getTuyaStatus, tuyaDevices, housesWithRooms }) {
return (
Expand All @@ -88,7 +89,7 @@ class DeviceTab extends Component {
<div class="page-options d-flex">
<Localizer>
<CardFilter
changeOrderDir={this.changeOrderDir.bind(this)}
changeOrderDir={this.changeOrderDir}
orderValue={orderDir}
search={this.debouncedSearch}
searchValue={search}
Expand All @@ -115,7 +116,7 @@ class DeviceTab extends Component {
deleteButton
device={device}
deviceIndex={index}
getTuyaDevices={this.getTuyaDevices.bind(this)}
getTuyaDevices={this.getTuyaDevices}
housesWithRooms={housesWithRooms}
/>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DiscoverTab extends Component {
}
}

async getDiscoveredDevices() {
getDiscoveredDevices = async () => {
this.setState({
loading: true
});
Expand All @@ -52,7 +52,7 @@ class DiscoverTab extends Component {
errorLoading: true
});
}
}
};

render(props, { loading, errorLoading, discoveredDevices, housesWithRooms }) {
return (
Expand All @@ -62,11 +62,7 @@ class DiscoverTab extends Component {
<Text id="integration.tuya.discover.title" />
</h1>
<div class="page-options d-flex">
<button
onClick={this.getDiscoveredDevices.bind(this)}
class="btn btn-outline-primary ml-2"
disabled={loading}
>
<button onClick={this.getDiscoveredDevices} class="btn btn-outline-primary ml-2" disabled={loading}>
<Text id="integration.tuya.discover.scan" /> <i class="fe fe-radio" />
</button>
</div>
Expand Down
18 changes: 9 additions & 9 deletions front/src/routes/integration/all/tuya/setup-page/SetupTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SetupTab extends Component {
}
}

async saveTuyaConfiguration(e) {
saveTuyaConfiguration = async e => {
e.preventDefault();
this.setState({
tuyaSaveSettingsStatus: RequestStatus.Getting
Expand Down Expand Up @@ -84,13 +84,13 @@ class SetupTab extends Component {
tuyaSaveSettingsStatus: RequestStatus.Error
});
}
}
};

updateConfiguration(e) {
updateConfiguration = e => {
this.setState({
[e.target.name]: e.target.value
});
}
};

render(props, state) {
return (
Expand Down Expand Up @@ -126,7 +126,7 @@ class SetupTab extends Component {
className="form-control"
name="tuyaEndpoint"
value={state.tuyaEndpoint}
onChange={this.updateConfiguration.bind(this)}
onChange={this.updateConfiguration}
>
<option value="china">
<Text id="integration.tuya.setup.endpoints.china" />
Expand Down Expand Up @@ -160,7 +160,7 @@ class SetupTab extends Component {
placeholder={<Text id="integration.tuya.setup.accessKeyPlaceholder" />}
value={state.tuyaAccessKey}
class="form-control"
onInput={this.updateConfiguration.bind(this)}
onInput={this.updateConfiguration}
/>
</Localizer>
</div>
Expand All @@ -176,7 +176,7 @@ class SetupTab extends Component {
placeholder={<Text id="integration.tuya.setup.secretKeyPlaceholder" />}
value={state.tuyaSecretKey}
className="form-control"
onInput={this.updateConfiguration.bind(this)}
onInput={this.updateConfiguration}
/>
</Localizer>
</div>
Expand All @@ -192,14 +192,14 @@ class SetupTab extends Component {
placeholder={<Text id="integration.tuya.setup.appAccountIdPlaceholder" />}
value={state.tuyaAppAccountId}
className="form-control"
onInput={this.updateConfiguration.bind(this)}
onInput={this.updateConfiguration}
/>
</Localizer>
</div>

<div class="row mt-5">
<div class="col">
<button type="submit" class="btn btn-success" onClick={this.saveTuyaConfiguration.bind(this)}>
<button type="submit" class="btn btn-success" onClick={this.saveTuyaConfiguration}>
<Text id="integration.tuya.setup.saveLabel" />
</button>
</div>
Expand Down

0 comments on commit dd35b83

Please sign in to comment.