Skip to content

Commit

Permalink
Show only those facilties that aren't linked to user (#6253)
Browse files Browse the repository at this point in the history
* only show unlinked facilties

* rename param

* fix cypress for updated backend

* fix typo
  • Loading branch information
Pranshu1902 authored Oct 31, 2023
1 parent abe4be9 commit ed3a547
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
9 changes: 1 addition & 8 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,7 @@ describe("User Creation", () => {
// .click()
// .type("Dummy Facility 1")
// .wait("@getFacilities");
// cy.get("li[role='option']").first().click();
// cy.intercept(/\/api\/v1\/users\/\w+\/add_facility\//).as("addFacility");
// cy.get("button[id='link-facility']").click();
// cy.wait("@addFacility")
// // .its("response.statusCode")
// // .should("eq", 201)
// .get("span")
// .contains("Facility - User Already has permission to this facility");
// cy.get("li[role='option']").should("not.exist");
// });

afterEach(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Common/FacilitySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FacilityModel } from "../Facility/models";

interface FacilitySelectProps {
name: string;
exclude_user: string;
errors?: string | undefined;
className?: string;
searchAll?: boolean;
Expand All @@ -22,6 +23,7 @@ interface FacilitySelectProps {
export const FacilitySelect = (props: FacilitySelectProps) => {
const {
name,
exclude_user,
multiple,
selected,
setSelected,
Expand All @@ -45,6 +47,7 @@ export const FacilitySelect = (props: FacilitySelectProps) => {
search_text: text,
all: searchAll,
facility_type: facilityType,
exclude_user: exclude_user,
district,
};

Expand Down
1 change: 1 addition & 0 deletions src/Components/Users/ManageUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ function UserFacilities(props: { user: any }) {
<FacilitySelect
multiple={false}
name="facility"
exclude_user={username}
showAll={false} // Show only facilities that user has access to link (not all facilities)
showNOptions={8}
selected={facility}
Expand Down

0 comments on commit ed3a547

Please sign in to comment.