Skip to content

Commit

Permalink
Provider Mode: Object Dashboard: fix RGW performance card
Browse files Browse the repository at this point in the history
Signed-off-by: Alfonso Martínez <[email protected]>
  • Loading branch information
alfonsomthd authored and openshift-cherrypick-robot committed Jul 29, 2024
1 parent 8956496 commit 834aed0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const ServiceTypeRGW: React.FC<ServiceTypeProps> = ({ queries, metric }) => {
const loading = getLoading || putLoading;
const error = !!getError || !!putError;
const data = !!get && !!put;
const response: Response = React.useMemo(() => {
const response: DataPoint<Date>[][] = React.useMemo(() => {
return !loading && !error && data
? [...getRangeVectorStats(get), ...getRangeVectorStats(put)]
: [];
Expand All @@ -229,7 +229,7 @@ const ServiceTypeRGW: React.FC<ServiceTypeProps> = ({ queries, metric }) => {
<PerformanceGraph
loading={loading}
loadError={error}
dataPoints={response as DataPoint[][][]}
dataPoints={response}
metricType={metric}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { convertNaNToNull, getLatestValue } from '../../../utils';
import './data-consumption-card.scss';

type PerformanceGraphProps = {
dataPoints: DataPoint[][][];
dataPoints: DataPoint[][];
loading: boolean;
loadError: boolean;
metricType: string;
Expand All @@ -41,8 +41,8 @@ const PerformanceGraph: React.FC<PerformanceGraphProps> = ({
metricType === Metrics.BANDWIDTH
? humanizeDecimalBytesPerSec
: humanizeSeconds;
const getData = getDataArray?.[0]?.map(convertNaNToNull);
const putData = putDataArray?.[0]?.map(convertNaNToNull);
const getData = getDataArray?.map(convertNaNToNull);
const putData = putDataArray?.map(convertNaNToNull);
const PUTLatestValue = humanize(getLatestValue(putData)).string;
const GETLatestValue = humanize(getLatestValue(getData)).string;

Expand All @@ -53,10 +53,10 @@ const PerformanceGraph: React.FC<PerformanceGraphProps> = ({

const emptyData = dataPoints.some(_.isEmpty);

if (loadError && emptyData) {
if (loadError || emptyData) {
return <GraphEmpty />;
}
if (!loading && !loadError && !emptyData) {
if (!loading) {
return (
<>
<div className="nb-data-consumption-card__chart-label text-secondary">
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/details-page/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ export const twentyFourHourTime = (
date: Date,
showSeconds?: boolean
): string => {
if (!_.isDate(date)) {
date = new Date(0);
}
const hours = zeroPad(date.getHours() ?? 0);
const minutes = `:${zeroPad(date.getMinutes() ?? 0)}`;
const seconds = showSeconds ? `:${zeroPad(date.getSeconds() ?? 0)}` : '';
Expand Down

0 comments on commit 834aed0

Please sign in to comment.