Skip to content

Commit

Permalink
Merge branch 'main' into optimize-polling
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Mar 4, 2024
2 parents c5ce7ae + d77a79f commit 81037ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ export const ApplicationsTable: React.FC = () => {
refetch: fetchApplications,
} = useFetchApplications(!hasActiveTasks);

const { assessments } = useFetchAssessments();
const { archetypes } = useFetchArchetypes();
const { assessments, isFetching: isFetchingAssesments } =
useFetchAssessments();
const { archetypes, isFetching: isFetchingArchetypes } = useFetchArchetypes();

const onDeleteApplicationSuccess = (appIDCount: number) => {
pushNotification({
Expand Down Expand Up @@ -897,6 +898,11 @@ export const ApplicationsTable: React.FC = () => {
application={application}
assessments={assessments}
archetypes={archetypes}
isLoading={
isFetchingApplications ||
isFetchingArchetypes ||
isFetchingAssesments
}
key={`${application?.id}-assessment-status`}
/>
</Td>
Expand Down
Original file line number Diff line number Diff line change
@@ -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[];
Expand All @@ -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(
Expand Down Expand Up @@ -80,8 +80,8 @@ export const ApplicationAssessmentStatus: React.FC<
};
}, [archetypes, assessments]);

if (archetypes?.length === 0 || assessments?.length === 0) {
return <EmptyTextMessage message={t("terms.notAvailable")} />;
if (isLoading) {
return <Spinner size="sm" />;
}

let statusPreset: IconedStatusPreset = "NotStarted"; // Default status
Expand Down

0 comments on commit 81037ec

Please sign in to comment.