Skip to content

Commit

Permalink
🐛 Adds spinner for isLoading prop in asessment status component (#1727)…
Browse files Browse the repository at this point in the history
… (#1734)

- Replaces erroneous not available status that is shown when no
assessments are available on an app

Signed-off-by: Ian Bolton <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>

Signed-off-by: Ian Bolton <[email protected]>
Signed-off-by: Cherry Picker <[email protected]>
Co-authored-by: Ian Bolton <[email protected]>
  • Loading branch information
github-actions[bot] and ibolton336 authored Mar 4, 2024
1 parent 07b3353 commit 1611d82
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 @@ -215,8 +215,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({
Expand Down Expand Up @@ -915,6 +916,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 1611d82

Please sign in to comment.