Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/Nodes/NodeResources/NodeResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export function NodeResources({ metrics, resources }) {
<UI5RadialChart
color="var(--sapChart_OrderedColor_5)"
value={cpu.usage}
max={cpu.capacity}
max={cpu.capacity * 1000}
additionalInfo={`${roundTwoDecimals(cpu.usage)}m / ${roundTwoDecimals(
cpu.capacity,
)}m`}
) * 1000}m`}
/>
</Card>
<Card
Expand Down Expand Up @@ -53,10 +53,10 @@ export function NodeResources({ metrics, resources }) {
<UI5RadialChart
color="var(--sapChart_OrderedColor_5)"
value={resources?.requests?.cpu}
max={cpu.capacity}
max={cpu.capacity * 1000}
additionalInfo={`${roundTwoDecimals(
resources?.requests?.cpu,
)}m / ${roundTwoDecimals(cpu.capacity)}m`}
)}m / ${roundTwoDecimals(cpu.capacity) * 1000}m`}
/>
</Card>
<Card
Expand Down Expand Up @@ -85,10 +85,10 @@ export function NodeResources({ metrics, resources }) {
<UI5RadialChart
color="var(--sapChart_OrderedColor_5)"
value={resources?.limits?.cpu}
max={cpu.capacity}
max={cpu.capacity * 1000}
additionalInfo={`${roundTwoDecimals(
resources?.limits?.cpu,
)}m / ${roundTwoDecimals(cpu.capacity)}m`}
)}m / ${roundTwoDecimals(cpu.capacity) * 1000}m`}
/>
</Card>
<Card
Expand Down
1 change: 1 addition & 0 deletions src/components/Nodes/nodeQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function useNodesQuery(skip = false) {
{
pollingInterval: 4000,
skip,
compareEntireResource: true,
},
);

Expand Down
27 changes: 23 additions & 4 deletions src/shared/hooks/BackendAPI/useGet.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ const ERROR_TOLERANCY = 2;
const useGetHook = processDataFn =>
function(
path,
{ pollingInterval, onDataReceived, skip, errorTolerancy = undefined } = {},
{
pollingInterval,
onDataReceived,
skip,
errorTolerancy = undefined,
compareEntireResource = false,
} = {},
) {
const authData = useRecoilValue(authDataState);
const lastAuthData = useRef(null);
Expand Down Expand Up @@ -82,7 +88,13 @@ const useGetHook = processDataFn =>
if (error) setTimeout(_ => setError(null)); // bring back the data and clear the error once the connection started working again
errorTolerancyCounter.current = 0;
setTimeout(_ =>
processDataFn(payload, currentData, setData, lastResourceVersion),
processDataFn(
payload,
currentData,
setData,
lastResourceVersion,
compareEntireResource,
),
);
} catch (e) {
previousRequestNotFinished.current = null;
Expand Down Expand Up @@ -325,10 +337,17 @@ function handleListDataReceived(filter) {
};
}

function handleSingleDataReceived(newData, oldData, setDataFn) {
function handleSingleDataReceived(
newData,
oldData,
setDataFn,
compareEntireResource,
) {
if (
!oldData || // current data is empty and we received some. There's no doubdt we should update.
newData.metadata.resourceVersion !== oldData.metadata?.resourceVersion
newData.metadata.resourceVersion !== oldData.metadata?.resourceVersion ||
(compareEntireResource &&
JSON.stringify(newData) !== JSON.stringify(oldData))
) {
// Compare resourceVersion.
setDataFn(newData);
Expand Down
Loading