Skip to content
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
33 changes: 33 additions & 0 deletions doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). The format is based on the `RELEASE-NOTES-TEMPLATE.md` file.

## Release 1.31.0

## Introduction
* Product name: Open Supply Hub
* Release date: March 8, 2025

### Database changes
* *Describe high-level database changes.*

#### Migrations:
* *Describe migrations here.*

#### Schema changes
* *Describe schema changes here.*

### Code/API changes
* *Describe code/API changes here.*

### Architecture/Environment changes
* *Describe architecture/environment changes here.*

### Bugfix
* [OSDEV-1777](https://opensupplyhub.atlassian.net/browse/OSDEV-1777) - A consistent URL style was established across all pages of the SLC workflow. After the changes, the URL begins from `/contribute/single-location/`.

### What's new
* *Describe what's new here. The changes that can impact user experience should be listed in this section.*

### Release instructions:
* Ensure that the following commands are included in the `post_deployment` command:
* `migrate`
* `reindex_database`


## Release 1.30.0

## Introduction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jest.mock('../../components/Contribute/SearchByOsIdTab', () => () => <div>Mocked
jest.mock('../../components/Contribute/SearchByNameAndAddressTab', () => () => <div>Mocked SearchByNameAndAddressTab</div>);

describe('ContributeProductionLocation component', () => {
const renderComponent = (initialEntries = ['/']) =>
const renderComponent = (queryParams = '') =>
renderWithProviders(
<MemoryRouter initialEntries={initialEntries}>
<MemoryRouter initialEntries={[`/contribute/single-location${queryParams}`]}>
<ContributeProductionLocation />
</MemoryRouter>
);
Expand All @@ -33,15 +33,14 @@ describe('ContributeProductionLocation component', () => {
});

it('changes the tab when clicked and updates the URL', () => {
const { getByRole, getByText } = renderComponent();
const { getByRole } = renderComponent();
const nameAddressTab = getByRole('tab', { name: /Search by name and address/i });
const osIdTab = getByRole('tab', { name: /Search by OS ID/i });

expect(nameAddressTab).toHaveAttribute('aria-selected', 'true');
fireEvent.click(osIdTab);
expect(osIdTab).toHaveAttribute('aria-selected', 'true');
expect(nameAddressTab).toHaveAttribute('aria-selected', 'false');
expect(getByText('Search by OS ID')).toBeInTheDocument();
});

it('renders SearchByNameAndAddressTab when Name and Address tab is selected', () => {
Expand All @@ -58,9 +57,9 @@ describe('ContributeProductionLocation component', () => {
});

it('handles invalid tab and defaults to Name and Address tab', () => {
const { getByRole } = renderComponent(['contribute/production-location?tab=invalid-tab']);
const osIdTab = getByRole('tab', { name: /Search by name and address/i });
const { getByRole } = renderComponent('?tab=invalid-tab');
const nameAddressTab = getByRole('tab', { name: /Search by name and address/i });

expect(osIdTab).toHaveAttribute('aria-selected', 'true');
expect(nameAddressTab).toHaveAttribute('aria-selected', 'true');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('ProductionLocationDetails component', () => {

test('renders production location details correctly', () => {
useLocation.mockReturnValue({
pathname: '/contribute/production-location/search/id/US2021250D1DTN7',
pathname: '/contribute/single-location/search/id/US2021250D1DTN7',
});

const { getByText } = renderWithProviders(
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('ProductionLocationDetails component', () => {

test('renders previous OS IDs that match the search parameter', () => {
useLocation.mockReturnValue({
pathname: '/contribute/production-location/search/id/US2020053ZH1RY5',
pathname: '/contribute/single-location/search/id/US2020053ZH1RY5',
});

const { getByText } = renderWithProviders(
Expand All @@ -73,7 +73,7 @@ describe('ProductionLocationDetails component', () => {

test('does not render previous OS IDs if they do not match the search parameter', () => {
useLocation.mockReturnValue({
pathname: '/contribute/production-location/search/id/UNKNOWN_OS_ID',
pathname: '/contribute/single-location/search/id/UNKNOWN_OS_ID',
});

const { queryByText } = renderWithProviders(
Expand All @@ -85,7 +85,7 @@ describe('ProductionLocationDetails component', () => {

test('renders only "OS ID:" if there are no historical OS IDs', () => {
useLocation.mockReturnValue({
pathname: '/contribute/production-location/search/id/US2021250D1DTN7',
pathname: '/contribute/single-location/search/id/US2021250D1DTN7',
});

const { getByText } = renderWithProviders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('SearchByNameAndAddressSuccessResult component', () => {
selectButtons.forEach((button, index) => {
fireEvent.click(button);
expect(mockHistoryPush).toHaveBeenCalledWith(
`/contribute/production-location/${defaultProps.productionLocations[index].os_id}/info/`
`/contribute/single-location/${defaultProps.productionLocations[index].os_id}/info/`
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/react/src/__tests__/components/SearchByOsIdTab.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('SearchByOsIdTab component', () => {
fireEvent.click(getByRole('button', { name: /Search by ID/i }));

expect(history.location.pathname).toBe(
'/contribute/production-location/search/id/CN2021250D1DTN7'
'/contribute/single-location/search/id/CN2021250D1DTN7'
);
});

Expand Down
10 changes: 5 additions & 5 deletions src/react/src/__tests__/utils.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1877,27 +1877,27 @@ it('should not call setter when dataKey is null', () => {
});

it('extracts the ID from a valid URL without a trailing slash', () => {
const url = '/contribute/production-location/search/id/BD202034606B9SA';
const url = '/contribute/single-location/search/id/BD202034606B9SA';
expect(getLastPathParameter(url)).toBe('BD202034606B9SA');
});

it('extracts the ID from a valid URL with a trailing slash', () => {
const url = '/contribute/production-location/search/id/BD202034606B9SA/';
const url = '/contribute/single-location/search/id/BD202034606B9SA/';
expect(getLastPathParameter(url)).toBe('BD202034606B9SA');
});

it('returns id when the URL ends at "id/" with no ID', () => {
const url = '/contribute/production-location/search/id/';
const url = '/contribute/single-location/search/id/';
expect(getLastPathParameter(url)).toBe('id');
});

it('returns the correct ID when the URL contains query parameters', () => {
const url = '/contribute/production-location/search/id/BD202034606B9SA?foo=bar';
const url = '/contribute/single-location/search/id/BD202034606B9SA?foo=bar';
expect(getLastPathParameter(url)).toBe('BD202034606B9SA');
});

it('returns the correct ID when the URL has multiple segments after "id/"', () => {
const url = '/contribute/production-location/search/id/BD202034606B9SA/extra';
const url = '/contribute/single-location/search/id/BD202034606B9SA/extra';
expect(getLastPathParameter(url)).toBe('extra');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SearchByOsIdSuccessResult = ({
const history = useHistory();

const handleGoToSelectedProductionLocationInfo = () =>
history.push(`/contribute/production-location/${osId}/info/`);
history.push(`/contribute/single-location/${osId}/info/`);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/react/src/components/Contribute/SearchByOsIdTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SearchByOsIdTab = ({ classes }) => {
};

const handleSearch = () => {
history.push(`/contribute/production-location/search/id/${inputOsId}`);
history.push(`/contribute/single-location/search/id/${inputOsId}`);
};

return (
Expand Down
10 changes: 5 additions & 5 deletions src/react/src/util/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ export const dashboardClaimsDetailsRoute = '/dashboard/claims/:claimID';
export const aboutClaimedFacilitiesRoute = `${InfoLink}/${InfoPaths.claimedFacilities}`;
export const contributeProductionLocationRoute = '/contribute/single-location';
export const searchByOsIdResultRoute =
'/contribute/production-location/search/id/:osID';
'/contribute/single-location/search/id/:osID';
export const searchByNameAndAddressResultRoute =
'/contribute/production-location/search/';
'/contribute/single-location/search/';
export const productionLocationInfoRouteCommon =
'/contribute/production-location/info/';
'/contribute/single-location/info/';
export const productionLocationInfoRouteCreate =
'/contribute/production-location/info/:moderationID?';
'/contribute/single-location/info/:moderationID?';
export const productionLocationInfoRouteUpdate =
'/contribute/production-location/:osID/info/:moderationID?';
'/contribute/single-location/:osID/info/:moderationID?';

export const contributeFieldsEnum = Object.freeze({
name: 'name',
Expand Down
2 changes: 1 addition & 1 deletion src/react/src/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export const makeProductionLocationFromModerationEventURL = (
};

export const makeContributeProductionLocationUpdateURL = osID =>
`/contribute/production-location/${osID}/info/`;
`/contribute/single-location/${osID}/info/`;

export const makeGetModerationEventsWithQueryString = (
qs,
Expand Down