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

Remove HIV bulk upload link from admin page #8050

Merged
merged 8 commits into from
Aug 21, 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 @@ -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;
bobbywells52 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading