Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add app details: Include a list of targets the project was checked against #2124

Closed
wants to merge 11 commits into from
Closed
6 changes: 6 additions & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"message": {
"applicationsBulkDelete": "The selected application(s) will be deleted.",
"delete": "This action cannot be undone.",
"deleteTooltipMessage": "Cannot remove a Job function associated with stakeholder(s)",
"discardAssessment": "The assessment(s) for <1>{{applicationName}}</1> will be discarded. Do you wish to continue?",
"discardReview": "The review for <1>{{applicationName}}</1> will be discarded. Do you wish to continue?",
"leavePage": "Are you sure you want to leave this page? Be sure to save your changes, or they will be lost.",
Expand Down Expand Up @@ -161,6 +162,10 @@
"medium": "Medium",
"small": "Small"
},
"issues": {
"noIssues": "Congratulations! No issues were found",
"issuesFound": "{{minor}} minor, {{critical}} critical"
},
"message": {
"archetypeApplicationCount": "{{count}} application",
"archetypeApplicationCount_plural": "{{count}} applications",
Expand Down Expand Up @@ -477,6 +482,7 @@
"tagsAssessment": "Assessment Tags",
"tagsCriteria": "Criteria Tags",
"target": "Target",
"targets": "Targets",
"tagCategory": "Tag category",
"tagCategoryDeleted": "Tag category deleted",
"tagCategories": "Tag categories",
Expand Down
1 change: 1 addition & 0 deletions client/public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"message": {
"applicationsBulkDelete": "Se eliminarán las aplicacione(s) seleccionadas.",
"delete": "Esta acción no puede ser revertida.",
"deleteTooltipMessage": "No se puede eliminar una función de trabajo asociada con partes interesadas",
"discardAssessment": "La evaluación para <1>{{applicationName}}</1> será descartada, también los resultados de la revisión. ¿Deseas continuar?",
"leavePage": "¿Estás seguro de querer salir de esta página? Asegúrate de guardar tus cambios o estos se perderán.",
"pageError": "¡Ups! Algo salió mal.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
Ref,
Archetype,
TaskDashboard,
AnalysisRuleReport,
AnalysisIssueReport,
} from "@app/api/models";
import { COLOR_HEX_VALUES_BY_NAME } from "@app/Constants";
import { useFetchFacts } from "@app/queries/facts";
Expand Down Expand Up @@ -64,7 +66,8 @@ import { Paths } from "@app/Paths";
import { useFetchArchetypes } from "@app/queries/archetypes";
import { useFetchAssessments } from "@app/queries/assessments";
import { DecoratedApplication } from "../../applications-table/useDecoratedApplications";
import { TaskStates } from "@app/queries/tasks";
import { TaskStates, useFetchTaskByID } from "@app/queries/tasks";
import { useFetchIssueReports } from "@app/queries/issues";

export interface IApplicationDetailDrawerProps
extends Pick<IPageDrawerContentProps, "onCloseClick"> {
Expand Down Expand Up @@ -182,6 +185,26 @@ const TabDetailsContent: React.FC<{
.filter((fullArchetype) => fullArchetype?.review)
.filter(Boolean);

const issueReportsQuery = useFetchIssueReports(application.id);
const {
result: { data, total: totalReportCount },
isFetching: isFetchingReports,
fetchError: reportsFetchError,
} = issueReportsQuery;
const currentPageReports = data as (
| AnalysisRuleReport
| AnalysisIssueReport
)[];
const minor = currentPageReports.filter((u) => u.effort === 1).length;
const critical = currentPageReports.filter((u) => u.effort > 1).length;

const { task, isFetching, fetchError, refetch } = useFetchTaskByID(
application.tasks.currentAnalyzer?.id
);
const targets = task?.data?.rules?.labels?.included.filter((t) =>
t.startsWith("konveyor.io/target=")
);

return (
<>
<TextContent className={`${spacing.mtMd} ${spacing.mbMd}`}>
Expand All @@ -194,6 +217,17 @@ const TabDetailsContent: React.FC<{
<Link to={getIssuesSingleAppSelectedLocation(application.id)}>
Issues
</Link>
<Text component="small">
{application.tasks.currentAnalyzer === undefined ||
application.tasks.currentAnalyzer.state === "Failed"
? t("terms.unassigned")
: currentPageReports.length === 0
? t("issues.noIssues")
: t("issues.issuesFound", {
minor: minor,
critical: critical,
})}
</Text>
</ListItem>
<ListItem>
<Link
Expand Down Expand Up @@ -303,6 +337,12 @@ const TabDetailsContent: React.FC<{
onEditClick={onEditClick}
onCloseClick={onCloseClick}
/>
<TextContent className={spacing.mtLg}>
<Title headingLevel="h3" size="md">
{t("terms.Targets")}
</Title>
{targets?.map((t) => <Text component="small">{t}</Text>)}
</TextContent>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table";

import { AppPlaceholder } from "@app/components/AppPlaceholder";
import { AppTableActionButtons } from "@app/components/AppTableActionButtons";
import { ConditionalRender } from "@app/components/ConditionalRender";
import { ConfirmDialog } from "@app/components/ConfirmDialog";
import { getAxiosErrorMessage } from "@app/utils/utils";
Expand All @@ -37,6 +36,7 @@ import {
import { useLocalTableControls } from "@app/hooks/table-controls";
import { CubesIcon } from "@patternfly/react-icons";
import { RBAC, RBAC_TYPE, controlsWriteScopes } from "@app/rbac";
import { ControlTableActionButtons } from "../ControlTableActionButtons";

export const JobFunctions: React.FC = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -215,9 +215,9 @@ export const JobFunctions: React.FC = () => {
<Td width={90} {...getTdProps({ columnKey: "name" })}>
{jobFunction.name}
</Td>
<AppTableActionButtons
<ControlTableActionButtons
isDeleteEnabled={!!jobFunction.stakeholders}
tooltipMessage="Cannot remove a Job function associated with stakeholder(s)"
deleteTooltipMessage={t("deleteTooltipMessage")}
onEdit={() => setCreateUpdateModalState(jobFunction)}
onDelete={() => deleteRow(jobFunction)}
/>
Expand Down
Loading