From 0d9ee366aef95d98646c41fad4b5c683e044762b Mon Sep 17 00:00:00 2001 From: Manuel Rodriguez Date: Tue, 16 Apr 2024 15:46:25 -0700 Subject: [PATCH] disposition filter and advance filter not showing properties on first load --- .../dal/Repositories/PropertyRepository.cs | 2 +- .../FilterContentContainer.test.tsx | 14 +- .../AdvancedFilter/FilterContentContainer.tsx | 9 +- .../AdvancedFilter/FilterContentForm.tsx | 4 +- .../__snapshots__/MapContainer.test.tsx.snap | 1030 +---------------- 5 files changed, 49 insertions(+), 1010 deletions(-) diff --git a/source/backend/dal/Repositories/PropertyRepository.cs b/source/backend/dal/Repositories/PropertyRepository.cs index d534f733d7..813766584d 100644 --- a/source/backend/dal/Repositories/PropertyRepository.cs +++ b/source/backend/dal/Repositories/PropertyRepository.cs @@ -556,7 +556,7 @@ public HashSet GetMatchingIds(PropertyFilterCriteria filter) } if (filter.IsDisposed) { - ownershipBuilder.Or(p => p.PimsDispositionFileProperties.Any(d => d.DispositionFile.DispositionStatusTypeCode == "COMPLETE")); + ownershipBuilder.Or(p => p.PimsDispositionFileProperties.Any(d => d.DispositionFile.DispositionFileStatusTypeCode == "COMPLETE")); } if (filter.IsRetired) { diff --git a/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.test.tsx b/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.test.tsx index fc5af18908..8b01d670c5 100644 --- a/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.test.tsx +++ b/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.test.tsx @@ -2,7 +2,10 @@ import { FormikProps } from 'formik'; import { createMemoryHistory } from 'history'; import { forwardRef } from 'react'; -import { useMapStateMachine } from '@/components/common/mapFSM/MapStateMachineContext'; +import { + IMapStateMachineContext, + useMapStateMachine, +} from '@/components/common/mapFSM/MapStateMachineContext'; import { mockLookups } from '@/mocks/lookups.mock'; import { mapMachineBaseMock } from '@/mocks/mapFSM.mock'; import { lookupCodesSlice } from '@/store/slices/lookupCodes'; @@ -57,7 +60,14 @@ describe('FilterContentContainer component', () => { beforeEach(() => { jest.resetAllMocks(); - (useMapStateMachine as jest.Mock).mockImplementation(() => mapMachineBaseMock); + const testMockMahine: IMapStateMachineContext = { + ...mapMachineBaseMock, + isFiltering: true, + }; + + (useMapStateMachine as unknown as jest.Mock>).mockReturnValue( + testMockMahine, + ); }); afterEach(() => { diff --git a/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.tsx b/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.tsx index 0da8793e6b..70afeb3d3d 100644 --- a/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.tsx +++ b/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentContainer.tsx @@ -16,7 +16,7 @@ export const FilterContentContainer: React.FC< > = ({ View }) => { const mapMachine = useMapStateMachine(); - const { setVisiblePimsProperties, setShowDisposed, setShowRetired } = mapMachine; + const { isFiltering, setVisiblePimsProperties, setShowDisposed, setShowRetired } = mapMachine; const { getMatchingProperties } = usePimsPropertyRepository(); @@ -42,5 +42,10 @@ export const FilterContentContainer: React.FC< [filterProperties, setShowDisposed, setShowRetired], ); - return ; + // Only render if the map state is filtering. + if (isFiltering) { + return ; + } else { + return <>; + } }; diff --git a/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentForm.tsx b/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentForm.tsx index 84e06fcf6a..2dd01db390 100644 --- a/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentForm.tsx +++ b/source/frontend/src/components/maps/leaflet/Control/AdvancedFilter/FilterContentForm.tsx @@ -49,8 +49,8 @@ export const FilterContentForm: React.FC { - const firstLoad = async () => { - await onChange(initialFilter); + const firstLoad = () => { + onChange(initialFilter); }; firstLoad(); }, [initialFilter, onChange]); diff --git a/source/frontend/src/features/properties/map/__snapshots__/MapContainer.test.tsx.snap b/source/frontend/src/features/properties/map/__snapshots__/MapContainer.test.tsx.snap index 04485f39f1..eaab93daed 100644 --- a/source/frontend/src/features/properties/map/__snapshots__/MapContainer.test.tsx.snap +++ b/source/frontend/src/features/properties/map/__snapshots__/MapContainer.test.tsx.snap @@ -141,47 +141,13 @@ exports[`MapContainer Renders the map 1`] = ` margin-right: 0; } -.c19 button.close { - font-size: 2.4rem; -} - -.c21 { +.c15 { border-radius: 1rem; width: 100%; padding: 2.5rem; } -.c17 { - float: right; - cursor: pointer; -} - .c16 { - font-weight: bold; - border-bottom: 0.2rem solid; - margin-bottom: 2rem; -} - -.c15 { - margin: 1.5rem; - padding: 1.5rem; - background-color: white; - text-align: left; - border-radius: 0.5rem; -} - -.c18.required::before { - content: '*'; - position: absolute; - top: 0.75rem; - left: 0rem; -} - -.c20 { - font-weight: bold; -} - -.c22 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -196,22 +162,22 @@ exports[`MapContainer Renders the map 1`] = ` padding-bottom: 0.5rem; } -.c22 .form-group .form-check label { +.c16 .form-group .form-check label { font-weight: bold; color: textColor; font-size: 1.6rem; } -.c23 { +.c17 { margin-right: 1rem; font-size: 2.4rem; } -.c24 { +.c18 { margin-bottom: 0rem; } -.c24 .form-check { +.c18 .form-check { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -222,11 +188,11 @@ exports[`MapContainer Renders the map 1`] = ` align-items: center; } -.c24 .form-check input { +.c18 .form-check input { margin-top: 0rem; } -.c24 .form-check label { +.c18 .form-check label { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -809,949 +775,7 @@ exports[`MapContainer Renders the map 1`] = `
-
-
-

-
-
- Project -
-
- - - collapse-section - - - - -
-
-

-
-
-
-
-
-
-
- - -
-
- - - -
-
-
-
-
-
-
-
-

-
-
- Tenure -
-
- - - collapse-section - - - - -
-
-

-
-
-
- -
-
-
-
-
-
- -
-
-
    - - No Options Available - -
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
-
-
- -
-
-
    - - No Options Available - -
-
-
-
-
-
-
-
-
-
-

-
-
- Lease / License -
-
- - - collapse-section - - - - -
-
-

-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
-
-
- -
-
-
    - - No Options Available - -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
    - - No Options Available - -
-
-
-
-
-
-
-
-
-
-

-
-
- Anomaly -
-
- - - collapse-section - - - - -
-
-

-
-
-
-
-
-
-
-
- -
-
-
    - - No Options Available - -
-
-
-
-
-
-
-
-
-
-

-
-
- Show Ownership -
-
- - - collapse-section - - - - -
-
-

-
-
-
-
-
-
-
-
-
- -
-
-
-
-
- -
-
- - Core Inventory - -
-
-
-
-
-
-
- -
-
-
-
-
- -
-
- - Property of Interest - -
-
-
-
-
-
-
- -
-
-
-
-
- -
-
- - Other Interest - -
-
-
-
-
-
-
- -
-
-
-
-
- -
-
- - Disposed - -
-
-
-
-
-
-
- -
-
-
-
-
- -
-
- - Retired - -
-
-
-
-
-
- -
+ />