forked from konveyor/tackle2-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'konveyor:main' into main
- Loading branch information
Showing
43 changed files
with
714 additions
and
632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
client/src/app/components/ConfirmDeleteDialog/ConfirmDeleteDialog.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
.confirm-deletion { | ||
margin-top: var(--pf-v5-global--spacer--xl); | ||
} | ||
|
||
.confirm-deletion-input { | ||
margin-top: var(--pf-v5-global--spacer--sm); | ||
margin-bottom: var(--pf-v5-global--spacer--sm); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 24 additions & 28 deletions
52
...s/applications/components/application-assessment-status/application-assessment-status.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,45 @@ | ||
import React from "react"; | ||
import { AxiosError } from "axios"; | ||
import { useTranslation } from "react-i18next"; | ||
import { Spinner } from "@patternfly/react-core"; | ||
|
||
import { EmptyTextMessage } from "@app/components/EmptyTextMessage"; | ||
import { Assessment, Ref } from "@app/api/models"; | ||
import { IconedStatus, IconedStatusPreset } from "@app/components/IconedStatus"; | ||
import { useFetchAssessmentById } from "@app/queries/assessments"; | ||
import { Application } from "@app/api/models"; | ||
import { IconedStatus } from "@app/components/IconedStatus"; | ||
import { useFetchAssessmentsByItemId } from "@app/queries/assessments"; | ||
|
||
export interface ApplicationAssessmentStatusProps { | ||
assessments?: Ref[]; | ||
application: Application; | ||
isLoading?: boolean; | ||
fetchError?: AxiosError; | ||
} | ||
|
||
const getStatusIconFrom = (assessment: Assessment): IconedStatusPreset => { | ||
switch (assessment.status) { | ||
case "empty": | ||
return "NotStarted"; | ||
case "started": | ||
return "InProgress"; | ||
case "complete": | ||
return "Completed"; | ||
default: | ||
return "NotStarted"; | ||
} | ||
}; | ||
|
||
export const ApplicationAssessmentStatus: React.FC< | ||
ApplicationAssessmentStatusProps | ||
> = ({ assessments, isLoading = false, fetchError = null }) => { | ||
> = ({ application, isLoading = false }) => { | ||
const { t } = useTranslation(); | ||
//TODO: remove this once we have a proper assessment status | ||
const { assessment } = useFetchAssessmentById(assessments?.[0]?.id); | ||
|
||
const { | ||
assessments, | ||
isFetching: isFetchingAssessmentsById, | ||
fetchError, | ||
} = useFetchAssessmentsByItemId(false, application.id); | ||
|
||
if (application?.assessed) { | ||
return <IconedStatus preset="Completed" />; | ||
} | ||
|
||
if (fetchError) { | ||
return <EmptyTextMessage message={t("terms.notAvailable")} />; | ||
} | ||
if (isLoading) { | ||
|
||
if (isLoading || isFetchingAssessmentsById) { | ||
return <Spinner size="md" />; | ||
} | ||
|
||
return assessment ? ( | ||
<IconedStatus preset={getStatusIconFrom(assessment)} /> | ||
) : ( | ||
<IconedStatus preset="NotStarted" /> | ||
); | ||
if ( | ||
assessments?.some((a) => a.status === "started" || a.status === "complete") | ||
) { | ||
return <IconedStatus preset="InProgress" />; | ||
} | ||
|
||
return <IconedStatus preset="NotStarted" />; | ||
}; |
Oops, something went wrong.