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

psp-8605 do not show the add button when a take's file has been compl… #4145

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const SectionListHeader: React.FunctionComponent<
{props.title}
</Col>
<Col xs="auto" className="my-1">
{hasClaim(props.claims) && (
{hasClaim(props.claims) && props.onAdd && (
<StyledSectionAddButton onClick={onClick} data-testid={props['data-testId']}>
{props.addButtonIcon}
&nbsp;{props.addButtonText ?? 'Add'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,26 @@ describe('TakesDetailView component', () => {
expect(onEdit).toHaveBeenCalled();
});

it('hides the add button when the file has been completed', () => {
const fileProperty = getMockApiPropertyFiles()[0];
const file: ApiGen_Concepts_File = fileProperty.file as ApiGen_Concepts_File;
const { queryByTitle, getByTestId } = setup({
props: {
fileProperty: {
...fileProperty,
file: {
...file,
fileStatusTypeCode: toTypeCodeNullable(ApiGen_CodeTypes_AcquisitionStatusTypes.COMPLT),
},
},
takes: getMockApiTakes(),
},
claims: [Claims.PROPERTY_EDIT],
});
const addButton = queryByTitle('Add take');
expect(addButton).toBeNull();
});

it('hides the edit button when the file has been completed', () => {
const fileProperty = getMockApiPropertyFiles()[0];
const file: ApiGen_Concepts_File = fileProperty.file as ApiGen_Concepts_File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const TakesDetailView: React.FunctionComponent<ITakesDetailViewProps> = (
claims={[Claims.PROPERTY_EDIT]}
addButtonIcon={<FaPlus />}
addButtonText="Add Take"
onAdd={onAdd}
onAdd={statusSolver.canEditTakes() ? onAdd : undefined}
/>
</H2>
{[...nonCancelledTakes, ...cancelledTakes].map((take, index) => {
Expand Down
Loading