diff --git a/src/js/components/Overview/LastIngestion.tsx b/src/js/components/Overview/LastIngestion.tsx index 88ea533c..0ccd0bc4 100644 --- a/src/js/components/Overview/LastIngestion.tsx +++ b/src/js/components/Overview/LastIngestion.tsx @@ -6,14 +6,19 @@ import { useTranslation } from 'react-i18next'; import { DEFAULT_TRANSLATION } from '@/constants/configConstants'; import { useAppSelector } from '@/hooks'; import { getDataTypeLabel } from '@/types/dataTypes'; -import { LastIngestionDataTypeResponse, DataResponseArray } from '@/types/lastIngestionDataTypeResponse'; + +import { LastIngestionDataTypeResponse } from '@/types/lastIngestionDataTypeResponse'; const LastIngestionInfo: React.FC = () => { const { t, i18n } = useTranslation(DEFAULT_TRANSLATION); - const lastEndTimesByDataType: DataResponseArray = useAppSelector((state) => state.lastIngestionData?.dataTypes) || []; + const dataTypesObject = useAppSelector((state) => state.lastIngestionData?.dataTypes) || {}; + const dataTypesArray = Object.values(dataTypesObject); + + const sortedDataTypes = dataTypesArray.sort((a, b) => a.label.localeCompare(b.label)); - const queryableDataTypes = lastEndTimesByDataType.filter((item: LastIngestionDataTypeResponse) => item.queryable); + // Filter out the queryable data types + const queryableDataTypes = sortedDataTypes.filter((dataType: LastIngestionDataTypeResponse) => dataType.queryable); const formatDate = useCallback( (dateString: string) => { @@ -42,7 +47,7 @@ const LastIngestionInfo: React.FC = () => { queryableDataTypes.map((dataType: LastIngestionDataTypeResponse) => ( - {getDataTypeLabel(dataType.id)} + {t(getDataTypeLabel(dataType.id))} {dataType.last_ingested ? formatDate(dataType.last_ingested) : 'Not Available'}