Skip to content

Commit

Permalink
Adjust Tags tab on Application Details Drawer when a Task is running
Browse files Browse the repository at this point in the history
When an analysis task is running, and the application drawer is
open, show both loading text and spinner and the existing tags.
Once the analysis is complete, the loading text/spinner will be
removed and any new tags will be shown.

Bug-Url: https://issues.redhat.com/browse/MTA-465
Signed-off-by: Scott J Dickerson <[email protected]>
  • Loading branch information
sjd78 committed Jul 21, 2023
1 parent ba2f5ac commit f0274e3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
3 changes: 3 additions & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"savingSelection": "Saving selection",
"selectOwnerFromStakeholdersList": "Select owner from list of stakeholders",
"suggestedAdoptionPlanHelpText": "The suggested approach to migration based on effort, priority, and dependencies.",
"taskInProgressForTags": "A new analysis is in-progress. Tags may be updated upon completion.",
"toTagApplication": "Either no tags exist yet or you may not have permission to view any. If you have permission, try creating a new custom tag."
},
"proposedActions": {
Expand Down Expand Up @@ -236,13 +237,15 @@
"decision": "Decision",
"dependencies": "Dependencies",
"description": "Description",
"details": "Details",
"displayName": "Display name",
"effort": "Effort",
"effortEstimate": "Effort estimate",
"email": "Email",
"error": "Error",
"errorReport": "Error report",
"exportToIssue": "Export to Issue Manager",
"facts": "Facts",
"failed": "Failed",
"filename": "File name",
"filter": "Filter...",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as React from "react";
import { Link } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
TextContent,
Text,
TextVariants,
Title,
Tabs,
Tab,
Expand Down Expand Up @@ -48,10 +50,13 @@ export const ApplicationDetailDrawer: React.FC<
reportsTabContent = null,
factsTabContent = null,
}) => {
const { t } = useTranslation();
const [activeTabKey, setActiveTabKey] = React.useState<TabKey>(
TabKey.Details
);

const isTaskRunning = task?.state === "Running";

return (
<PageDrawerContent
isExpanded={!!application}
Expand All @@ -61,7 +66,7 @@ export const ApplicationDetailDrawer: React.FC<
>
<TextContent>
<Text component="small" className={spacing.mb_0}>
Name
{t("terms.name")}
</Text>
<Title headingLevel="h2" size="lg" className={spacing.mtXs}>
{application?.name}
Expand All @@ -74,7 +79,7 @@ export const ApplicationDetailDrawer: React.FC<
>
<Tab
eventKey={TabKey.Details}
title={<TabTitleText>Details</TabTitleText>}
title={<TabTitleText>{t("terms.details")}</TabTitleText>}
>
<TextContent className={`${spacing.mtMd} ${spacing.mbMd}`}>
<Text component="small">{application?.description}</Text>
Expand All @@ -84,43 +89,54 @@ export const ApplicationDetailDrawer: React.FC<
</Link>
) : null}
<Title headingLevel="h3" size="md">
Business service
{t("terms.businessService")}
</Title>
<Text component="small">
{application?.businessService && (
{application?.businessService ? (
<ApplicationBusinessService
id={application.businessService.id}
/>
)}
) : null}
</Text>
</TextContent>
{detailsTabMainContent}
</Tab>

<Tab eventKey={TabKey.Tags} title={<TabTitleText>Tags</TabTitleText>}>
{application && task?.state === "Running" ? (
{application && isTaskRunning ? (
<Bullseye className={spacing.mtLg}>
<Spinner size="xl">Loading...</Spinner>
<TextContent>
<Text component={TextVariants.h3}>
{t("message.taskInProgressForTags")}
<Spinner
isInline
aria-label="spinner when a new analysis is running"
/>
</Text>
</TextContent>
</Bullseye>
) : (
application && <ApplicationTags application={application} />
)}
) : null}

{application ? <ApplicationTags application={application} /> : null}
</Tab>
{reportsTabContent && task && (

{reportsTabContent && task ? (
<Tab
eventKey={TabKey.Reports}
title={<TabTitleText>Reports</TabTitleText>}
title={<TabTitleText>{t("terms.reports")}</TabTitleText>}
>
{reportsTabContent}
</Tab>
)}
{factsTabContent && (
) : null}

{factsTabContent ? (
<Tab
eventKey={TabKey.Facts}
title={<TabTitleText>Facts</TabTitleText>}
title={<TabTitleText>{t("terms.facts")}</TabTitleText>}
>
{factsTabContent}
</Tab>
)}
) : null}
</Tabs>
</PageDrawerContent>
);
Expand Down

0 comments on commit f0274e3

Please sign in to comment.