Skip to content

Commit 4708230

Browse files
committed
fixing eslint issue on ubuntu latest
1 parent e5e5850 commit 4708230

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/components/Tables/ACPUTable.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ function ACPUTable({ device, update, notify }) {
3737
const handleToggle = () => {
3838
if (!device || !href) {
3939
setDisable(true);
40-
} else {
41-
setDisable(!disable);
40+
} else if (device && href) {
41+
setDisable(!disable); // Toggle the fields' disable state
4242
}
4343
};
4444

@@ -55,10 +55,9 @@ function ACPUTable({ device, update, notify }) {
5555
function fetchAcpuData(link) {
5656
if (link !== '') {
5757
server.GET(server.peripheralPath(device, link), (data) => {
58-
if (
59-
data.name !== acpuData.name
60-
|| (data.frequency !== acpuData.frequency && data.load !== acpuData.load)
61-
) {
58+
if (data.name !== acpuData.name
59+
|| data.frequency !== acpuData.frequency
60+
|| data.load !== acpuData.load) {
6261
setAcpuData({
6362
name: data.name,
6463
frequency: data.frequency,
@@ -166,7 +165,7 @@ function ACPUTable({ device, update, notify }) {
166165
type="checkbox"
167166
onChange={handleToggle}
168167
checked={!disable}
169-
disabled={!device || !href}
168+
disabled={!device || !href} // Disable toggle based on device and ACPU selection
170169
/>
171170
<span className="slider" />
172171
</label>
@@ -187,7 +186,7 @@ function ACPUTable({ device, update, notify }) {
187186
type="text"
188187
onChange={(e) => handleChange('name', e.target.value)}
189188
value={acpuData.name}
190-
disabled={disable} // freeze when toggle is off
189+
disabled={disable} // Freeze when toggle is off
191190
/>
192191
</div>
193192
<div className="acpu-group">
@@ -198,7 +197,7 @@ function ACPUTable({ device, update, notify }) {
198197
step={1}
199198
onChange={(e) => handleChange('frequency', e.target.value)}
200199
value={acpuData.frequency}
201-
disabled={disable}
200+
disabled={disable} // Freeze when toggle is off
202201
/>
203202
</div>
204203
<div className="acpu-group">
@@ -207,7 +206,7 @@ function ACPUTable({ device, update, notify }) {
207206
value={acpuData.load}
208207
onChangeHandler={(value) => handleChange('load', value)}
209208
items={loadActivity}
210-
disabled={disable}
209+
disabled={disable} // Freeze when toggle is off
211210
/>
212211
</div>
213212
</div>
@@ -243,14 +242,14 @@ function ACPUTable({ device, update, notify }) {
243242
setEditIndex(null);
244243
}}
245244
onSubmit={handleSubmit}
246-
defaultValue={editIndex !== null && {
245+
defaultValue={(editIndex !== null && {
247246
name: acpuNames.indexOf(acpuNames.find(
248247
(elem) => elem.text === endpoints[editIndex].data.name,
249248
)),
250249
activity: endpoints[editIndex].data.activity,
251250
read_write_rate: endpoints[editIndex].data.read_write_rate,
252251
toggle_rate: endpoints[editIndex].data.toggle_rate,
253-
} || {
252+
}) || {
254253
name: 0,
255254
activity: 0,
256255
read_write_rate: 0.5,

0 commit comments

Comments
 (0)