Support disable glances cpu + mem (#1931)

pull/1936/head
shamoon 1 year ago committed by GitHub
parent 89f2e9739d
commit 63f952509e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,8 +33,8 @@ export default function Widget({ options }) {
if (!data) { if (!data) {
return <Resources options={options}> return <Resources options={options}>
<Resource icon={FiCpu} label={t("glances.wait")} percentage="0" /> { options.cpu !== false && <Resource icon={FiCpu} label={t("glances.wait")} percentage="0" /> }
<Resource icon={FaMemory} label={t("glances.wait")} percentage="0" /> { options.mem !== false && <Resource icon={FaMemory} label={t("glances.wait")} percentage="0" /> }
{ options.cputemp && <Resource icon={FaThermometerHalf} label={t("glances.wait")} percentage="0" /> } { options.cputemp && <Resource icon={FaThermometerHalf} label={t("glances.wait")} percentage="0" /> }
{ options.disk && !Array.isArray(options.disk) && <Resource key={options.disk} icon={FiHardDrive} label={t("glances.wait")} percentage="0" /> } { options.disk && !Array.isArray(options.disk) && <Resource key={options.disk} icon={FiHardDrive} label={t("glances.wait")} percentage="0" /> }
{ options.disk && Array.isArray(options.disk) && options.disk.map((disk) => <Resource key={`disk_${disk}`} icon={FiHardDrive} label={t("glances.wait")} percentage="0" /> ) } { options.disk && Array.isArray(options.disk) && options.disk.map((disk) => <Resource key={`disk_${disk}`} icon={FiHardDrive} label={t("glances.wait")} percentage="0" /> ) }
@ -71,7 +71,7 @@ export default function Widget({ options }) {
return ( return (
<Resources options={options} target={settings.target ?? "_blank"}> <Resources options={options} target={settings.target ?? "_blank"}>
<Resource {options.cpu !== false && <Resource
icon={FiCpu} icon={FiCpu}
value={t("common.number", { value={t("common.number", {
value: data.cpu.total, value: data.cpu.total,
@ -89,8 +89,8 @@ export default function Widget({ options }) {
expandedLabel={t("glances.load")} expandedLabel={t("glances.load")}
percentage={data.cpu.total} percentage={data.cpu.total}
expanded={options.expanded} expanded={options.expanded}
/> />}
<Resource {options.mem !== false && <Resource
icon={FaMemory} icon={FaMemory}
value={t("common.bytes", { value={t("common.bytes", {
value: data.mem.free, value: data.mem.free,
@ -106,7 +106,7 @@ export default function Widget({ options }) {
expandedLabel={t("glances.total")} expandedLabel={t("glances.total")}
percentage={data.mem.percent} percentage={data.mem.percent}
expanded={options.expanded} expanded={options.expanded}
/> />}
{disks.map((disk) => ( {disks.map((disk) => (
<Resource key={`disk_${disk.mnt_point ?? disk.device_name}`} <Resource key={`disk_${disk.mnt_point ?? disk.device_name}`}
icon={FiHardDrive} icon={FiHardDrive}

Loading…
Cancel
Save