Skip to content

Commit

Permalink
Merge branch 'automation-branch' of https://github.com/stairaku/PSP i…
Browse files Browse the repository at this point in the history
…nto automation-branch
  • Loading branch information
stairaku committed Jun 3, 2024
2 parents 845f0bb + 8a7f006 commit ad363ef
Show file tree
Hide file tree
Showing 132 changed files with 3,684 additions and 3,483 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/api-dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- name: Codecov
uses: codecov/[email protected]
env:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV }}
with:
# User defined upload name. Visible in Codecov UI
Expand All @@ -122,7 +122,7 @@ jobs:

- name: SonarScanner for .NET 8 with pull request decoration support
id: scan
uses: highbyte/sonarscan-dotnet@v2.1.2
uses: highbyte/sonarscan-dotnet@v2.3.2
if: ${{ github.event_name == 'push' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions source/backend/api/Pims.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<UserSecretsId>0ef6255f-9ea0-49ec-8c65-c172304b4926</UserSecretsId>
<Version>5.3.0-81.13</Version>
<Version>5.3.0-81.13</Version>
<Version>5.3.0-81.27</Version>
<Version>5.3.0-81.27</Version>
<AssemblyVersion>5.3.0.81</AssemblyVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ProjectGuid>16BC0468-78F6-4C91-87DA-7403C919E646</ProjectGuid>
Expand Down
4,600 changes: 2,130 additions & 2,470 deletions source/frontend/package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions source/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "5.3.0-81.13",
"version": "5.3.0-81.27",
"private": true,
"dependencies": {
"@bcgov/bc-sans": "1.0.1",
Expand Down Expand Up @@ -90,7 +90,7 @@
"@types/supercluster": "5.0.2",
"@types/yup": "0.26.32",
"@vitejs/plugin-react": "4.2.1",
"@vitest/coverage-v8": "^1.5.0",
"@vitest/coverage-v8": "1.5.0",
"axios-mock-adapter": "1.19.0",
"dependency-cruiser": "13.0.3",
"eslint": "8.57.0",
Expand All @@ -115,7 +115,7 @@
"redux-mock-store": "1.5.4",
"sass": "1.43.2",
"typescript": "5.4.2",
"vite": "5.0.10",
"vite": "5.2.10",
"vite-bundle-visualizer": "1.1.0",
"vite-plugin-compression": "0.5.1",
"vite-plugin-eslint": "1.8.1",
Expand All @@ -131,7 +131,6 @@
"json5": "1.0.2",
"webpack": "5.76.3",
"tough-cookie": "4.1.3",
"word-wrap": "@aashutoshrathi/word-wrap",
"@typescript-eslint/eslint-plugin": "5.62.0",
"react-popper": "2.3.0",
"nth-check": "2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion source/frontend/public/tenants/tenant.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"layers": [],
"propertiesUrl": "ogs-internal/ows?service=wfs&request=GetFeature&typeName=PIMS_PROPERTY_LOCATION_VW&outputformat=json&srsName=EPSG:4326&version=2.0.0&",
"parcelMap": {
"parcelMapFullyAttributed": {
"url": "https://openmaps.gov.bc.ca/geo/pub/WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW/ows",
"name": "pub:WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW"
},
Expand Down
3 changes: 2 additions & 1 deletion source/frontend/src/assets/scss/_variables.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
highlightBackgroundColor: $highlight-background-color;
// buttons
borderOutlineColor: $border-outline-color;

// Colors
pimsGreen80: $pims-green-80;
warningBackgroundColor: $warning-background-color;
numberBackgroundColor: $number-background-color;
dangerBackgroundColor: $danger-background-color;
Expand Down
33 changes: 18 additions & 15 deletions source/frontend/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,20 @@ export const Table = <T extends IIdentifiedObject, TFilter extends object = obje
: [];
}, [externalSort?.sort]);

const handleCheckboxSelect = (values: T[]) => {
const allPreviouslySelected = selectedRowsRef?.current ?? [];
const previouslySelected = allPreviouslySelected.find(
row => values.length === 1 && row.id === values[0].id,
);

if (previouslySelected) {
setExternalSelectedRows &&
setExternalSelectedRows(allPreviouslySelected.filter(row => row !== previouslySelected));
} else {
setExternalSelectedRows && setExternalSelectedRows([...allPreviouslySelected, ...values]);
}
};

// Use the useTable hook to create your table configuration
const instance = useTable<T>(
{
Expand Down Expand Up @@ -366,7 +380,9 @@ export const Table = <T extends IIdentifiedObject, TFilter extends object = obje
<IndeterminateCheckbox
{...getToggleAllRowsSelectedProps()}
isSingleSelect={isSingleSelect}
setSelected={setExternalSelectedRows}
setSelected={(values: T[]) => {
handleCheckboxSelect(values);
}}
selectedRef={selectedRowsRef}
allDataRef={dataRef}
disableSelection={disableSelection}
Expand All @@ -385,20 +401,7 @@ export const Table = <T extends IIdentifiedObject, TFilter extends object = obje
if (isSingleSelect === true) {
setExternalSelectedRows && setExternalSelectedRows([...values]);
} else {
const allPreviouslySelected = selectedRowsRef?.current ?? [];
const previouslySelected = allPreviouslySelected.find(
row => values.length === 1 && row.id === values[0].id,
);

if (previouslySelected) {
setExternalSelectedRows &&
setExternalSelectedRows(
allPreviouslySelected.filter(row => row !== previouslySelected),
);
} else {
setExternalSelectedRows &&
setExternalSelectedRows([...allPreviouslySelected, ...values]);
}
handleCheckboxSelect(values);
}
}}
selectedRef={selectedRowsRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const AuditSection: React.FC<IAuditSectionProps> = ({ baseAudit, lastUpda

export default AuditSection;

const StyledSmallText = styled.span`
export const StyledSmallText = styled.span`
font-size: 0.87em;
line-height: 1.9;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { Dictionary } from '@/interfaces/Dictionary';
import { ApiGen_Base_CodeType } from '@/models/api/generated/ApiGen_Base_CodeType';

import { InlineFlexDiv } from '../styles';
import { StyledSmallText } from './AuditSection';

interface IStatusFieldProps {
statusCodeType: ApiGen_Base_CodeType<string>;
preText?: string;
}

interface StatusStyle {
Expand All @@ -32,6 +34,7 @@ const statusDictionary: Dictionary<StatusStyle> = {

const StatusField: React.FunctionComponent<React.PropsWithChildren<IStatusFieldProps>> = ({
statusCodeType,
preText,
}) => {
const translateStatusCode = (statusCodeType: ApiGen_Base_CodeType<string>) => {
switch (statusCodeType.id.toLowerCase()) {
Expand Down Expand Up @@ -73,7 +76,10 @@ const StatusField: React.FunctionComponent<React.PropsWithChildren<IStatusFieldP
return (
<StyledBottomRow className="no-gutters justify-content-end align-items-end">
<Col />
<Col xs="auto" className="align-self-end">
<Col xs="auto" className="align-self-end d-flex">
<StyledSmallText>
<b>{preText}</b>
</StyledSmallText>
<RetiredWarning $variant={statusFound.colorVariant}>
<statusFound.icon size={16} />
{statusCodeType?.description.toUpperCase()}
Expand All @@ -96,6 +102,7 @@ const RetiredWarning = styled(InlineFlexDiv)<{ $variant: string }>`
align-items: center;
padding: 0.2rem 0.5rem;
margin-left: 0.4rem;
gap: 0.5rem;
Expand Down
2 changes: 1 addition & 1 deletion source/frontend/src/components/common/Section/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const Section: React.FC<
<Row className="no-gutters">
<Col>{header}</Col>
{isCollapsable && (
<Col xs="1">
<Col xs="auto" className="pl-8">
{isCollapsed && (
<ArrowDropDownIcon
title={`expand-${title ?? 'section'}`}
Expand Down
3 changes: 2 additions & 1 deletion source/frontend/src/components/common/SectionListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ISectionListHeaderProps {
addButtonIcon?: JSX.Element;
onAdd?: () => void;
claims: Claims[];
'data-testId'?: string;
}

export const SectionListHeader: React.FunctionComponent<
Expand All @@ -27,7 +28,7 @@ export const SectionListHeader: React.FunctionComponent<
</Col>
<Col xs="auto" className="my-1">
{hasClaim(props.claims) && (
<StyledSectionAddButton onClick={onClick}>
<StyledSectionAddButton onClick={onClick} data-testid={props['data-testId']}>
{props.addButtonIcon}
&nbsp;{props.addButtonText ?? 'Add'}
</StyledSectionAddButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export const MapStateMachineProvider: React.FC<React.PropsWithChildren<unknown>>
}

const geoFilter = getQueryParams(searchCriteria);

if (geoFilter?.PID || geoFilter?.PID_PADDED || geoFilter?.PIN) {
return mapSearch.searchMany(geoFilter);
} else if (geoFilter?.latitude && geoFilter?.longitude) {
Expand All @@ -142,6 +141,9 @@ export const MapStateMachineProvider: React.FC<React.PropsWithChildren<unknown>>
return mapSearch.searchOneLocation(geoLat, geoLng);
} else if (geoFilter?.SURVEY_PLAN_NUMBER && !geoFilter?.PID && !geoFilter?.PIN) {
return mapSearch.searchByPlanNumber(geoFilter);
} else if (geoFilter?.HISTORICAL_FILE_NUMBER_STR) {
geoFilter.forceExactMatch = false;
return mapSearch.searchByHistorical(geoFilter);
} else {
return mapSearch.searchMany(geoFilter);
}
Expand Down Expand Up @@ -381,6 +383,7 @@ const getQueryParams = (filter: IPropertyFilter): IGeoSearchParams => {
PIN: pinOrPidValue,
STREET_ADDRESS_1: filter.address,
SURVEY_PLAN_NUMBER: filter.planNumber,
HISTORICAL_FILE_NUMBER_STR: filter.historical,
latitude: filter.latitude,
longitude: filter.longitude,
forceExactMatch: true,
Expand Down
16 changes: 11 additions & 5 deletions source/frontend/src/components/common/mapFSM/models.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FeatureCollection, Geometry } from 'geojson';
import { LatLngBounds, LatLngLiteral } from 'leaflet';

import { PMBC_Feature_Properties } from '@/models/layers/parcelMapBC';
import { PMBC_FullyAttributed_Feature_Properties } from '@/models/layers/parcelMapBC';
import {
PIMS_Property_Boundary_View,
PIMS_Property_Location_View,
Expand All @@ -11,14 +11,17 @@ export interface FeatureSelected {
readonly clusterId: string;
readonly pimsLocationFeature: PIMS_Property_Location_View | null;
readonly pimsBoundaryFeature: PIMS_Property_Boundary_View | null;
readonly pmbcFeature: PMBC_Feature_Properties | null;
readonly fullyAttributedFeature: PMBC_FullyAttributed_Feature_Properties | null;
readonly latlng: LatLngLiteral;
}

export interface MapFeatureData {
readonly pimsLocationFeatures: FeatureCollection<Geometry, PIMS_Property_Location_View>;
readonly pimsBoundaryFeatures: FeatureCollection<Geometry, PIMS_Property_Boundary_View>;
readonly pmbcFeatures: FeatureCollection<Geometry, PMBC_Feature_Properties>;
readonly fullyAttributedFeatures: FeatureCollection<
Geometry,
PMBC_FullyAttributed_Feature_Properties
>;
}

export interface RequestedFlyTo {
Expand All @@ -42,13 +45,16 @@ export const emptyPimsBoundaryFeatureCollection: FeatureCollection<
features: [],
};

export const emptyPmbcFeatureCollection: FeatureCollection<Geometry, PMBC_Feature_Properties> = {
export const emptyPmbcFeatureCollection: FeatureCollection<
Geometry,
PMBC_FullyAttributed_Feature_Properties
> = {
type: 'FeatureCollection',
features: [],
};

export const emptyFeatureData: MapFeatureData = {
pimsLocationFeatures: emptyPimsLocationFeatureCollection,
pimsBoundaryFeatures: emptyPimsBoundaryFeatureCollection,
pmbcFeatures: emptyPmbcFeatureCollection,
fullyAttributedFeatures: emptyPmbcFeatureCollection,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ import { LatLngLiteral } from 'leaflet';
import { useCallback } from 'react';

import { useAdminBoundaryMapLayer } from '@/hooks/repositories/mapLayer/useAdminBoundaryMapLayer';
import { useFullyAttributedParcelMapLayer } from '@/hooks/repositories/mapLayer/useFullyAttributedParcelMapLayer';
import { useLegalAdminBoundariesMapLayer } from '@/hooks/repositories/mapLayer/useLegalAdminBoundariesMapLayer';
import { useParcelMapLayer } from '@/hooks/repositories/mapLayer/useParcelMapLayer';
import { usePimsPropertyLayer } from '@/hooks/repositories/mapLayer/usePimsPropertyLayer';
import { useMapProperties } from '@/hooks/repositories/useMapProperties';
import { MOT_DistrictBoundary_Feature_Properties } from '@/models/layers/motDistrictBoundary';
import { MOT_RegionalBoundary_Feature_Properties } from '@/models/layers/motRegionalBoundary';
import { WHSE_Municipalities_Feature_Properties } from '@/models/layers/municipalities';
import { PMBC_Feature_Properties } from '@/models/layers/parcelMapBC';
import { PMBC_FullyAttributed_Feature_Properties } from '@/models/layers/parcelMapBC';
import { PIMS_Property_Location_View } from '@/models/layers/pimsPropertyLocationView';

export interface LocationFeatureDataset {
selectingComponentId: string | null;
location: LatLngLiteral;
pimsFeature: Feature<Geometry, PIMS_Property_Location_View> | null;
parcelFeature: Feature<Geometry, PMBC_Feature_Properties> | null;
parcelFeature: Feature<Geometry, PMBC_FullyAttributed_Feature_Properties> | null;
regionFeature: Feature<Geometry, MOT_RegionalBoundary_Feature_Properties> | null;
districtFeature: Feature<Geometry, MOT_DistrictBoundary_Feature_Properties> | null;
municipalityFeature: Feature<Geometry, WHSE_Municipalities_Feature_Properties> | null;
}

const useLocationFeatureLoader = () => {
const pmbcService = useParcelMapLayer();
const fullyAttributedService = useFullyAttributedParcelMapLayer();
const adminBoundaryLayerService = useAdminBoundaryMapLayer();
const adminLegalBoundaryLayerService = useLegalAdminBoundariesMapLayer();

Expand All @@ -33,7 +33,7 @@ const useLocationFeatureLoader = () => {
} = useMapProperties();
const { findOneByBoundary } = usePimsPropertyLayer();

const pmbcServiceFindOne = pmbcService.findOne;
const fullyAttributedServiceFindOne = fullyAttributedService.findOne;
const adminBoundaryLayerServiceFindRegion = adminBoundaryLayerService.findRegion;
const adminBoundaryLayerServiceFindDistrict = adminBoundaryLayerService.findDistrict;
const adminLegalBoundaryLayerServiceFindOneMunicipality =
Expand All @@ -52,12 +52,12 @@ const useLocationFeatureLoader = () => {
};

// call these APIs in parallel - notice there is no "await"
const pmbcTask = pmbcServiceFindOne(latLng);
const fullyAttributedTask = fullyAttributedServiceFindOne(latLng);
const regionTask = adminBoundaryLayerServiceFindRegion(latLng, 'GEOMETRY');
const districtTask = adminBoundaryLayerServiceFindDistrict(latLng, 'GEOMETRY');

const [parcelFeature, regionFeature, districtFeature] = await Promise.all([
pmbcTask,
fullyAttributedTask,
regionTask,
districtTask,
]);
Expand Down Expand Up @@ -96,7 +96,7 @@ const useLocationFeatureLoader = () => {
return result;
},
[
pmbcServiceFindOne,
fullyAttributedServiceFindOne,
adminBoundaryLayerServiceFindRegion,
adminBoundaryLayerServiceFindDistrict,
adminLegalBoundaryLayerServiceFindOneMunicipality,
Expand Down
Loading

0 comments on commit ad363ef

Please sign in to comment.