diff --git a/src/app.jsx b/src/app.jsx index fa79b26..64c4d04 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -20,7 +20,7 @@ import cockpit from 'cockpit'; import React from 'react'; import { Alert, Card, CardTitle, CardHeader, CardBody, CardExpandableContent, Checkbox, Button, Spinner, Flex, FlexItem } from '@patternfly/react-core'; -import { FanIcon, ThermometerHalfIcon, ChargingStationIcon, CpuIcon } from '@patternfly/react-icons/dist/esm/icons/'; +import { FanIcon, ThermometerHalfIcon, ChargingStationIcon, CpuIcon, EyeSlashIcon } from '@patternfly/react-icons/dist/esm/icons/'; const _ = cockpit.gettext; @@ -35,7 +35,7 @@ export class Application extends React.Component { if (!this.state.isShowBtnInstall && !this.state.isError) this.loadSensors(); }, 1000); - this.setState({ intervalId }); + this.setState({ intervalId, hidedCards: localStorage.getItem('hidedCards') }); } componentWillUnmount() { @@ -225,7 +225,7 @@ export class Application extends React.Component { hideCard(cardId) { const hidedCards = this.state.hidedCards.push(cardId); - console.log(cardId, hidedCards); + localStorage.setItem('hidedCards', hidedCards) this.setState({ hidedCards }); } @@ -257,46 +257,54 @@ export class Application extends React.Component { {sensors !== null ? Object.entries(sensors).map((key, keyIndex) => - - {key[0]} - - {key[1].Adapter} - - {Object.entries(key[1]).map((item, itemIndex) => { - if (itemIndex === 0) return ""; - const chave = keyIndex.toString() + itemIndex.toString(); - if (isExpanded[chave] === undefined) { - isExpanded[chave] = false; - } - return ( - - - this.handleOnExpand(e, chave)} - toggleButtonProps={{ - id: 'toggle-button2', - 'aria-label': 'Patternfly Details', - 'aria-expanded': isExpanded[chave] - }} - >{item[0]} - - {this.setIcon(Object.keys(item[1])[0])} {this.adjustValue(Object.keys(item[1])[0], Object.values(item[1])[0])} - - - - {Object.entries(item[1]).map((sensors, index) => ( - {this.adjustLabel(sensors[0])}: {sensors[1]}
- ))} -
-
-
-
- ); - })} -
-
-
+
+ + {key[0]} + + {key[1].Adapter} + + {Object.entries(key[1]).map((item, itemIndex) => { + if (itemIndex === 0) return ""; + const chave = keyIndex.toString() + itemIndex.toString(); + if (isExpanded[chave] === undefined) { + isExpanded[chave] = false; + } + return ( + + + this.handleOnExpand(e, chave)} + toggleButtonProps={{ + id: 'toggle-button2', + 'aria-label': 'Patternfly Details', + 'aria-expanded': isExpanded[chave] + }} + >{item[0]} + + {this.setIcon(Object.keys(item[1])[0])} {this.adjustValue(Object.keys(item[1])[0], Object.values(item[1])[0])} + + + + {Object.entries(item[1]).map((sensors, index) => ( + {this.adjustLabel(sensors[0])}: {sensors[1]}
+ ))} +
+
+
+
+ ); + })} +
+
+
+
+ + +
+
) : ''}