Skip to content

Commit

Permalink
[MDS-6132] Fixing bugs around Project Description Overview (#3250)
Browse files Browse the repository at this point in the history
fixing bugs found for 6132
  • Loading branch information
asinn134 authored Sep 19, 2024
1 parent cc8897b commit 56b4c17
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 20 deletions.
2 changes: 1 addition & 1 deletion services/core-web/src/components/mine/Projects/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const Project: FC = () => {
),
},
isFeatureEnabled(Feature.AMS_AGENT) &&
project_summary?.status_code === "SUB" && {
project_summary?.submission_date && {
key: "project-description",
label: "Project Description",
children: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ export class ProjectOverviewTab extends Component {
link: (
<Link
data-cy="project-description-view-link"
to={routes.EDIT_PROJECT_SUMMARY.dynamicRoute(project_guid, project_summary_guid)}
to={
this.props?.project?.project_summary?.submission_date
? routes.EDIT_PROJECT.dynamicRoute(project_guid, "project-description")
: routes.EDIT_PROJECT_SUMMARY.dynamicRoute(project_guid, project_summary_guid)
}
>
<Button className="full-mobile margin-small" type="secondary">
View
{this.props?.project?.project_summary?.submission_date ? "View" : "Resume"}
</Button>
</Link>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,31 @@ export class ProjectStagesTable extends Component {
render: (text, record) => {
let link;
if (record.project_stage === "Project description") {
let buttonLabel;
if (record.stage_status === "SUB") {
buttonLabel = "View";
let payload = record.stage?.payload;
if (payload?.submission_date) {
link = (
<Button
className="full-mobile margin-small"
type="secondary"
onClick={() => record?.navigate_forward()}
>
View
</Button>
);
} else {
buttonLabel = "Resume";
link = (
<Link
to={routes.EDIT_PROJECT_SUMMARY.dynamicRoute(
payload?.project_guid,
payload?.project_summary_guid
)}
>
<Button className="full-mobile margin-small" type="secondary">
Resume
</Button>
</Link>
);
}
link = (
<Link
to={routes.EDIT_PROJECT_SUMMARY.dynamicRoute(
record.stage?.payload?.project_guid,
record.stage?.payload?.project_summary_guid
)}
>
<Button className="full-mobile margin-small" type="secondary">
{buttonLabel}
</Button>
</Link>
);
}
if (record.project_stage === "IRT") {
let buttonLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class ProjectOverviewTab extends Component {
payload: this.props.projectSummary,
statusHash: this.props.projectSummaryStatusCodesHash,
required: true,
navigateForward: () => this.props.navigateForward("DES"),
},
{
title: "IRT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ const ProjectPage: FC = () => {

const navigateFromProjectStagesTable = (source, status) => {
switch (source) {
case "DES": {
const projectDescriptionTab = document.querySelector('[id*="project-description"]');
if (!projectDescriptionTab) {
return null;
}

// @ts-ignore
return projectDescriptionTab.click();
}
case "IRT": {
if (status === "APV") {
return history.push({
Expand Down Expand Up @@ -203,7 +212,7 @@ const ProjectPage: FC = () => {
),
},
isFeatureEnabled(Feature.AMS_AGENT) &&
project_summary?.status_code === "SUB" && {
project_summary?.submission_date && {
label: "Project Description",
key: "project-description",
children: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ exports[`ProjectOverviewTab renders properly 1`] = `
Array [
Object {
"key": undefined,
"navigateForward": [Function],
"payload": Object {
"documents": Array [],
"mine_guid": "60300a07-376c-46f1-a984-88a813f91438",
Expand Down

0 comments on commit 56b4c17

Please sign in to comment.