Skip to content

Commit

Permalink
Remove HIV bulk upload link from admin page (#8050)
Browse files Browse the repository at this point in the history
* remove beta link

* remove coresponding endpoint

* remove HIV upload form code

* remove corresponding route

* lint

* remove obsolete tests

* refactor test

* last tidy
  • Loading branch information
bobbywells52 authored Aug 21, 2024
1 parent 47f0129 commit 1259bad
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static gov.cdc.usds.simplereport.api.Translators.parseUUID;
import static gov.cdc.usds.simplereport.config.WebConfiguration.CONDITION_AGNOSTIC_RESULT_UPLOAD;
import static gov.cdc.usds.simplereport.config.WebConfiguration.HIV_RESULT_UPLOAD;
import static gov.cdc.usds.simplereport.config.WebConfiguration.PATIENT_UPLOAD;
import static gov.cdc.usds.simplereport.config.WebConfiguration.RESULT_UPLOAD;

Expand Down Expand Up @@ -50,18 +49,6 @@ public PatientBulkUploadResponse handlePatientsUpload(
}
}

@PostMapping(HIV_RESULT_UPLOAD)
@PreAuthorize("@featureFlagsConfig.isHivBulkUploadEnabled()")
public TestResultUpload handleHIVResultsUpload(@RequestParam("file") MultipartFile file) {
assertCsvFileType(file);
try (InputStream resultsUpload = file.getInputStream()) {
return testResultUploadService.processHIVResultCSV(resultsUpload);
} catch (IOException e) {
log.error("Test result CSV encountered an unexpected error", e);
throw new CsvProcessingException("Unable to process test result CSV upload");
}
}

@PostMapping(CONDITION_AGNOSTIC_RESULT_UPLOAD)
@PreAuthorize("@featureFlagsConfig.isAgnosticBulkUploadEnabled()")
public TestResultUpload handleConditionAgnosticResultsUpload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public class WebConfiguration implements WebMvcConfigurer {
public static final String FEATURE_FLAGS = "/feature-flags";
public static final String PATIENT_UPLOAD = "/upload/patients";
public static final String RESULT_UPLOAD = "/upload/results";

public static final String HIV_RESULT_UPLOAD = "/upload/hiv-results";

public static final String CONDITION_AGNOSTIC_RESULT_UPLOAD = "/upload/condition-agnostic";
public static final String GRAPH_QL = "/graphql";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class FileUploadControllerTest {
// https://github.com/CDCgov/prime-simplereport/issues/7240

@Test
void handleHIVResultsUpload_handlesIoException() throws IOException {
void handleResultsUpload_handlesIoException() throws IOException {
var file = mock(MultipartFile.class);
when(featureFlagsConfig.isHivEnabled()).thenReturn(true);
when(file.getContentType()).thenReturn("text/csv");
when(file.getInputStream()).thenThrow(IOException.class);

assertThrows(
CsvProcessingException.class, () -> fileUploadController.handleHIVResultsUpload(file));
CsvProcessingException.class, () -> fileUploadController.handleResultsUpload(file));
}
}
99 changes: 0 additions & 99 deletions frontend/src/app/supportAdmin/HIVUpload/HivUploadForm.tsx

This file was deleted.

31 changes: 1 addition & 30 deletions frontend/src/app/supportAdmin/SupportAdmin.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { render, screen } from "@testing-library/react";
import { render } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import * as flaggedMock from "flagged";

import SupportAdmin from "./SupportAdmin";

Expand All @@ -16,32 +15,4 @@ describe("SupportAdmin", () => {
const { container } = renderWithRouter();
expect(container).toMatchSnapshot();
});

it("loads menu categories including beta when hivBulkUploadEnabled flag is on", async () => {
const flagSpy = jest.spyOn(flaggedMock, "useFeature");
flagSpy.mockImplementation((flagName) => {
return flagName === "hivBulkUploadEnabled";
});
renderWithRouter();
expect(
await screen.findByText("Beta - HIV CSV Upload", { exact: false })
).toBeInTheDocument();

// force us to clean up this test when we clean up the feature flag
expect(flagSpy).toHaveBeenCalledWith("hivBulkUploadEnabled");
});

it("loads menu categories without beta when hivBulkUploadEnabled flag is off", async () => {
const flagSpy = jest.spyOn(flaggedMock, "useFeature");
flagSpy.mockImplementation((flagName) => {
return flagName !== "hivBulkUploadEnabled";
});
renderWithRouter();
expect(
screen.queryByText("Beta - HIV CSV Upload", { exact: false })
).not.toBeInTheDocument();

// force us to clean up this test when we clean up the feature flag
expect(flagSpy).toHaveBeenCalledWith("hivBulkUploadEnabled");
});
});
12 changes: 0 additions & 12 deletions frontend/src/app/supportAdmin/SupportAdmin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useFeature } from "flagged";

import { LinkWithQuery } from "../commonComponents/LinkWithQuery";
import { useDocumentTitle } from "../utils/hooks";

Expand Down Expand Up @@ -35,7 +33,6 @@ const CategoryMenu: React.FC<CategoryMenuProps> = ({

const SupportAdmin = () => {
useDocumentTitle("Support admin");
const hivBulkUploadEnabled = useFeature("hivBulkUploadEnabled") as boolean;
return (
<div className="prime-home flex-1">
<div className="grid-container">
Expand Down Expand Up @@ -99,15 +96,6 @@ const SupportAdmin = () => {
</LinkWithQuery>
</li>
</CategoryMenu>
{hivBulkUploadEnabled && (
<CategoryMenu heading="Beta">
<li>
<LinkWithQuery to="/admin/hiv-csv-upload">
Beta - HIV CSV Upload
</LinkWithQuery>
</li>
</CategoryMenu>
)}
</div>
</div>
</div>
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/app/supportAdmin/SupportAdminRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import { useFeature } from "flagged";

import AddOrganizationAdminFormContainer from "./AddOrganizationAdmin/AddOrganizationAdminFormContainer";
import DeviceTypeFormContainer from "./DeviceType/DeviceTypeFormContainer";
Expand All @@ -9,7 +8,6 @@ import SupportAdmin from "./SupportAdmin";
import PendingOrganizationsContainer from "./PendingOrganizations/PendingOrganizationsContainer";
import ManageDeviceTypeFormContainer from "./DeviceType/ManageDeviceTypeFormContainer";
import UnarchivePatient from "./UnarchivePatients/UnarchivePatient";
import { HivUploadForm } from "./HIVUpload/HivUploadForm";
import { AdminManageUser } from "./ManageUsers/AdminManageUser";
import ManageFacility from "./ManageFacility/ManageFacility";
import { Escalations } from "./Escalations/Escalations";
Expand All @@ -19,8 +17,6 @@ interface Props {
}

const SupportAdminRoutes: React.FC<Props> = ({ isAdmin }) => {
const hivBulkUploadEnabled = useFeature("hivBulkUploadEnabled") as boolean;

if (!isAdmin) {
return <Navigate to="/queue" />;
}
Expand Down Expand Up @@ -49,9 +45,6 @@ const SupportAdminRoutes: React.FC<Props> = ({ isAdmin }) => {
<Route path="unarchive-patient" element={<UnarchivePatient />}>
<Route path=":pageNumber" element={<UnarchivePatient />} />
</Route>
{hivBulkUploadEnabled && (
<Route path="hiv-csv-upload" element={<HivUploadForm />} />
)}
<Route path="/" element={<SupportAdmin />} />
</Routes>
);
Expand Down

0 comments on commit 1259bad

Please sign in to comment.