diff --git a/source/backend/api/Startup.cs b/source/backend/api/Startup.cs index 7d59653a05..4a84d6097b 100644 --- a/source/backend/api/Startup.cs +++ b/source/backend/api/Startup.cs @@ -380,7 +380,7 @@ public void ConfigureServices(IServiceCollection services) "Ches", sp => new ChesHealthCheck(sp.GetService()), null, - new string[] { SERVICES, EXTERNAL, SYSTEMCHECK }) + new string[] { SERVICES, EXTERNAL }) { Period = TimeSpan.FromMinutes(allHealthCheckOptions.Ches.Period) }); } @@ -518,7 +518,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVers config.MapControllers(); config.MapHealthChecks("health/system", new HealthCheckOptions() { - Predicate = r => r.Tags.Contains("system-check"), + Predicate = r => r.Tags.Contains(SYSTEMCHECK), ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse, }); diff --git a/source/frontend/src/components/layout/Healthcheck/HealthcheckView.test.tsx b/source/frontend/src/components/layout/Healthcheck/HealthcheckView.test.tsx index 45ebec9b03..6f690e7672 100644 --- a/source/frontend/src/components/layout/Healthcheck/HealthcheckView.test.tsx +++ b/source/frontend/src/components/layout/Healthcheck/HealthcheckView.test.tsx @@ -1,5 +1,6 @@ +import { act, render, RenderOptions, userEvent } from '@/utils/test-utils'; + import HealthcheckView, { IHealthCheckIssue, IHealthCheckViewProps } from './HealthcheckView'; -import { act, render, RenderOptions, userEvent, screen } from '@/utils/test-utils'; const mockHealthcheckIssues: IHealthCheckIssue[] = [ { @@ -53,4 +54,41 @@ describe('Healthcheck View component', () => { }); expect(getByTestId('healthcheck-full-list-lnk')).toBeVisible(); }); + + it(`shows modal with full list after clicking the link`, async () => { + const { getByTestId, getByText } = await setup({ + props: { + systemDegraded: true, + systemChecks: [ + ...mockHealthcheckIssues, + { + key: 'Mayan', + msg: 'The PIMS Document server is experiencing service degradation, you will be unable to view, download or upload documents until resolved.', + }, + ], + }, + }); + + const link = getByTestId('healthcheck-full-list-lnk'); + expect(link).toBeVisible(); + await act(() => userEvent.click(link)); + expect( + getByText(/The PIMS Document server is experiencing service degradation/i), + ).toBeVisible(); + }); + + it('works as expected when system is degraded and issues array is empty', async () => { + const { getByLabelText, getByText } = await setup({ + props: { + systemDegraded: true, + systemChecks: [], + }, + }); + expect(getByLabelText('System degraded icon')).toBeVisible(); + expect( + getByText( + 'The system is currently experiencing service degradation, you may experience issues using the application until this is resolved.', + ), + ).toBeVisible(); + }); }); diff --git a/source/frontend/src/components/layout/Healthcheck/HealthcheckView.tsx b/source/frontend/src/components/layout/Healthcheck/HealthcheckView.tsx index f1e2067453..b04ae3842e 100644 --- a/source/frontend/src/components/layout/Healthcheck/HealthcheckView.tsx +++ b/source/frontend/src/components/layout/Healthcheck/HealthcheckView.tsx @@ -5,6 +5,7 @@ import { LinkButton } from '@/components/common/buttons/LinkButton'; import { ModalSize } from '@/components/common/GenericModal'; import { useModalContext } from '@/hooks/useModalContext'; import HealthCheckStyled from '@/layouts/Healthcheck'; +import { firstOrNull } from '@/utils/utils'; export interface IHealthCheckIssue { key: string; @@ -23,17 +24,19 @@ const HealthcheckView: React.FunctionComponent = ({ systemChecks, }) => { const { setModalContent, setDisplayModal } = useModalContext(); + const firstIssue = firstOrNull(systemChecks); return systemChecked && systemDegraded ? ( - + {systemChecks.length > 1 && ( renders as expected 1`] = ` class="c1" >
{ @@ -308,6 +305,9 @@ export const AcquisitionContainer: React.FunctionComponent { onSuccess(); + if (isValidId(response?.id)) { + pathGenerator.showFile('acquisition', response.id); + } return response; }); }, diff --git a/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx b/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx index 24669f92c3..9e18c4c85d 100644 --- a/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx +++ b/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx @@ -240,6 +240,9 @@ export const ResearchContainer: React.FunctionComponent userOverrideCodes, ).then(response => { onSuccess(); + if (isValidId(response?.id)) { + pathGenerator.showFile('research', response.id); + } return response; }); },