From d637cdebcbeb920596095fccb85e4a0ef23a5575 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Fri, 1 Mar 2024 16:21:33 -0500 Subject: [PATCH] :bug: Removes broken status for not available when assessments are empty --- .../applications-table/applications-table.tsx | 10 ++++++++-- .../application-assessment-status.tsx | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index ff7c364c1b..26c9b4d4dc 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -211,8 +211,9 @@ export const ApplicationsTable: React.FC = () => { refetch: fetchApplications, } = useFetchApplications(); - const { assessments } = useFetchAssessments(); - const { archetypes } = useFetchArchetypes(); + const { assessments, isFetching: isFetchingAssesments } = + useFetchAssessments(); + const { archetypes, isFetching: isFetchingArchetypes } = useFetchArchetypes(); const onDeleteApplicationSuccess = (appIDCount: number) => { pushNotification({ @@ -894,6 +895,11 @@ export const ApplicationsTable: React.FC = () => { application={application} assessments={assessments} archetypes={archetypes} + isLoading={ + isFetchingApplications || + isFetchingArchetypes || + isFetchingAssesments + } key={`${application?.id}-assessment-status`} /> diff --git a/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx b/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx index 8f2314f032..b6fba08f30 100644 --- a/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx +++ b/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx @@ -1,8 +1,8 @@ import React from "react"; import { useTranslation } from "react-i18next"; -import { EmptyTextMessage } from "@app/components/EmptyTextMessage"; import { Application, Archetype, Assessment } from "@app/api/models"; import { IconedStatus, IconedStatusPreset } from "@app/components/IconedStatus"; +import { Spinner } from "@patternfly/react-core"; interface ApplicationAssessmentStatusProps { application: Application; assessments: Assessment[]; @@ -12,7 +12,7 @@ interface ApplicationAssessmentStatusProps { export const ApplicationAssessmentStatus: React.FC< ApplicationAssessmentStatusProps -> = ({ application, assessments, archetypes }) => { +> = ({ application, assessments, archetypes, isLoading }) => { const { t } = useTranslation(); const filteredAssessments = assessments?.filter( @@ -80,8 +80,8 @@ export const ApplicationAssessmentStatus: React.FC< }; }, [archetypes, assessments]); - if (archetypes?.length === 0 || assessments?.length === 0) { - return ; + if (isLoading) { + return ; } let statusPreset: IconedStatusPreset = "NotStarted"; // Default status