mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-08-24 04:16:18 +00:00
Add utils/nodeHelpers.js to provide some Node related utility functions
This commit is contained in:
@@ -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" }
|
||||
|
||||
@@ -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;
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user