Files
flipper/desktop/plugins/public/cpu/TemperatureTable.tsx
Andres Suarez 79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00

77 lines
1.5 KiB
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {Component, Text, SearchableTable} from 'flipper';
import React from 'react';
const ColumnSizes = {
thermal_zone: 'flex',
temperature: 'flex',
path: 'flex',
};
const Columns = {
thermal_zone: {
value: 'Thermal Zone',
resizable: true,
},
temperature: {
value: 'Temperature',
resizable: true,
},
path: {
value: 'Path',
resizable: true,
},
};
type TemperatureTableProps = {
temperatureMap: any;
};
export default class TemperatureTable extends Component<TemperatureTableProps> {
buildRow = (tz: string, tempInfo: any) => {
return {
columns: {
thermal_zone: {value: <Text>{tz}</Text>},
temperature: {
value: <Text>{tempInfo.temp.toString()}</Text>,
},
path: {
value: <Text>{tempInfo.path}</Text>,
},
},
key: tz,
};
};
buildRows = () => {
const rows = [];
for (const tz of Object.keys(this.props.temperatureMap).sort()) {
rows.push(this.buildRow(tz, this.props.temperatureMap[tz]));
}
return rows;
};
render() {
return (
<SearchableTable
multiline
autoHeight
floating={false}
zebra
columnSizes={ColumnSizes}
columns={Columns}
rows={this.buildRows()}
grow
/>
);
}
}