Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2300333: [release-4.16] Provider Mode: Object Dashboard: fix RGW performance card #1503

Open
wants to merge 1 commit into
base: release-4.16
Choose a base branch
from
Open
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
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
Loading