/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import "./details-resources.scss"; import { Table } from "../table/table"; import { TableHead } from "../table/table-head"; import { TableRow } from "../table/table-row"; import React from "react"; import type { Node } from "../../../common/k8s-api/endpoints"; import { TableCell } from "../table/table-cell"; export interface NodeDetailsResourcesProps { node: Node; type: "allocatable" | "capacity"; } function toMi(resource: string | undefined) { if (resource?.endsWith("Ki")) { return `${(parseInt(resource) / 1024).toFixed(1)}Mi`; } return resource; } export function NodeDetailsResources({ type, node: { status = {}}}: NodeDetailsResourcesProps) { const resourceStatus = status[type]; if (!resourceStatus) { return null; } return (