diff --git a/client/src/components/nodesPanel.js b/client/src/components/nodesPanel.js index 86cb69b..81f89e6 100644 --- a/client/src/components/nodesPanel.js +++ b/client/src/components/nodesPanel.js @@ -6,6 +6,7 @@ import LoadingEllipsis from './loadingEllipsis'; import {MetadataHeaders, MetadataColumns, TableBody, objectMap} from './listViewHelpers'; import {unparseCpu, unparseRam} from '../utils/unitHelpers'; import {getNodeResourceValue, getNodeResourcePercent, getNodeUsagePercent, getNodeUsage, getNodeResourcesAvailable} from '../utils/metricsHelpers'; +import getReadyStatus from '../utils/nodeHelpers'; export default class NodesPanel extends Base { constructor(props) { @@ -91,16 +92,6 @@ export default class NodesPanel extends Base { } } -/** - * - * @param {*status* object with a status field (most likely the row from the TableBody)} - * @returns the status text, as defined in https://kubernetes.io/docs/concepts/architecture/nodes/#condition - */ -export function getReadyStatus({status}) { - if (!status.conditions) return null; - const ready = status.conditions.find(y => y.type === 'Ready'); - return ready && ready.status; -} /** Simple mapping between ready statuses and an UTF-8 symbol character */ const statusesToUtf8 = { "True": "\u2713", "False": "\uD83D\uDEC7", "Unknown": "\u003F" } diff --git a/client/src/utils/nodeHelpers.js b/client/src/utils/nodeHelpers.js new file mode 100644 index 0000000..4f2eb4a --- /dev/null +++ b/client/src/utils/nodeHelpers.js @@ -0,0 +1,11 @@ +/** + * @param {*status* object with a status field (most likely the row from the TableBody)} + * @returns the status text, as defined in https://kubernetes.io/docs/concepts/architecture/nodes/#condition + */ +function getReadyStatus({status}) { + if (!status.conditions) return null; + const ready = status.conditions.find(y => y.type === 'Ready'); + return ready && ready.status; +} + +export default getReadyStatus; diff --git a/client/src/views/nodes.js b/client/src/views/nodes.js index e658f7e..a7413df 100644 --- a/client/src/views/nodes.js +++ b/client/src/views/nodes.js @@ -6,7 +6,8 @@ import {defaultSortInfo} from '../components/sorter'; import NodeStatusChart from '../components/nodeStatusChart'; import api from '../services/api'; import test from '../utils/filterHelper'; -import NodesPanel, {getReadyStatus} from '../components/nodesPanel'; +import NodesPanel from '../components/nodesPanel'; +import getReadyStatus from '../utils/nodeHelpers'; import NodeCpuChart from '../components/nodeCpuChart'; import NodeRamChart from '../components/nodeRamChart'; import getMetrics from '../utils/metricsHelpers';