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

Add subcount sign & sampling site list styling changes #1268

Merged
merged 93 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
2768ab6
wip: sample method response metric
mauberti-bc Mar 10, 2024
3eb971a
wip: observation subcount sign
mauberti-bc Mar 11, 2024
4870022
migration changes & ui updates
mauberti-bc Mar 11, 2024
e84c32d
migration to add method lookup options
mauberti-bc Mar 11, 2024
af5ad07
add and edit response metric for sampling methods
mauberti-bc Mar 11, 2024
8441dd5
order by in sample methods sql
mauberti-bc Mar 12, 2024
597f1c4
Merge branch 'dev' of github.com:bcgov/biohubbc into method-response-…
mauberti-bc Mar 12, 2024
7d819a7
separate sampling sites method and periods into own component
mauberti-bc Mar 12, 2024
651f2ed
styling sample site list
mauberti-bc Mar 12, 2024
22154a1
styling
mauberti-bc Mar 12, 2024
315629e
add method response metric chip to method edit form
mauberti-bc Mar 12, 2024
6e20f88
styling
mauberti-bc Mar 12, 2024
e2dc8c4
make survey areas orange on the survey map
mauberti-bc Mar 12, 2024
c410564
update survey map componenent & include map legend
mauberti-bc Mar 12, 2024
80f88eb
update survey map legend
mauberti-bc Mar 13, 2024
af9cd76
colors
mauberti-bc Mar 13, 2024
7f9c626
Merge branch 'dev' of github.com:bcgov/biohubbc into method-response-…
mauberti-bc Mar 14, 2024
1238e16
method-response-variable
mauberti-bc Mar 15, 2024
069d5cc
Merge branch 'dev' of github.com:bcgov/biohubbc into method-response-…
mauberti-bc Mar 15, 2024
3b29c36
console logs
mauberti-bc Mar 15, 2024
3c9135a
move geojson transform from zod schema into sql for observation geome…
mauberti-bc Mar 15, 2024
6dbfce0
update colours
mauberti-bc Mar 15, 2024
862f8d9
linter
mauberti-bc Mar 15, 2024
588d249
Merge branch 'dev' of github.com:bcgov/biohubbc into method-response-…
mauberti-bc Mar 15, 2024
6395983
Merge branch 'dev' of github.com:bcgov/biohubbc into method-response-…
mauberti-bc Mar 15, 2024
8b509c8
move legend position
mauberti-bc Mar 15, 2024
9a75b92
styling sampling site list panel
mauberti-bc Mar 16, 2024
9d3708e
cleanup
mauberti-bc Mar 16, 2024
2eb7075
more styling sample periods list
mauberti-bc Mar 16, 2024
9f9a3f1
change timelinedot to calendar icon
mauberti-bc Mar 16, 2024
417edfa
change observations map marker
mauberti-bc Mar 16, 2024
c8a660b
styling timeline icons
mauberti-bc Mar 16, 2024
a9d1d07
leaflet sampling site map
mauberti-bc Mar 16, 2024
18408e2
icons to indicate geometry type of sampling site
mauberti-bc Mar 16, 2024
504ca8b
survey map tooltip
mauberti-bc Mar 17, 2024
da8ca3e
merge in dev
mauberti-bc Mar 18, 2024
bcaa065
undo
mauberti-bc Mar 18, 2024
d4710b6
remove extra fields from get study area request
mauberti-bc Mar 19, 2024
9509073
remove survey map legend
mauberti-bc Mar 19, 2024
3da013c
include start and end date in survey list table
mauberti-bc Mar 19, 2024
600d0fa
cleanup
mauberti-bc Mar 19, 2024
17a19dc
console log
mauberti-bc Mar 19, 2024
2eba603
Initial working observation import against sampling period
NickPhura Apr 5, 2024
b1b0079
Add better loading/disabled handlers
NickPhura Apr 8, 2024
f9a4999
Merge remote-tracking branch 'origin/dev' into SIMSBIOHUB-501
NickPhura Apr 8, 2024
c26af5f
SIMSBIOHUB-492: Fix project advanced filters (#1235)
mauberti-bc Apr 8, 2024
9a482fa
remove duplicated migration
mauberti-bc Apr 8, 2024
f06837a
update styling
mauberti-bc Apr 8, 2024
e372d2a
linter
mauberti-bc Apr 8, 2024
5545b77
Add Knip and SWC
NickPhura Apr 9, 2024
bf0c063
Update import observations
NickPhura Apr 9, 2024
f3572c7
Remove console logs
NickPhura Apr 9, 2024
3ffe5b5
Remove swc from API to fix unit tests
NickPhura Apr 9, 2024
16d7f10
Remove knip
NickPhura Apr 9, 2024
303288d
Remove gulp
NickPhura Apr 9, 2024
fe9538c
Update lock
NickPhura Apr 9, 2024
b88fe37
Merge remote-tracking branch 'origin/dev' into SIMSBIOHUB-501
NickPhura Apr 9, 2024
72b5c65
Merge branch 'dev' into SIMSBIOHUB-501
NickPhura Apr 10, 2024
8da65db
Merge branch 'SIMSBIOHUB-501' of https://github.com/bcgov/biohubbc in…
NickPhura Apr 10, 2024
e384884
Add unit tests. fix spelling
NickPhura Apr 10, 2024
84dc2e0
Add tests
NickPhura Apr 10, 2024
24d3a20
Merge remote-tracking branch 'origin/dev' into SIMSBIOHUB-501
NickPhura Apr 15, 2024
07e9f84
Fix merge conflicts
NickPhura Apr 15, 2024
089d9e3
merge in dev
mauberti-bc Apr 16, 2024
4f45b77
merge in SIMSBIOHUB-501
mauberti-bc Apr 16, 2024
c5ea58b
merge in dev
mauberti-bc Apr 17, 2024
38ea558
import button changes
mauberti-bc Apr 17, 2024
fa05ee0
observation import button styling
mauberti-bc Apr 17, 2024
082a31f
include inset sampling site map
mauberti-bc Apr 17, 2024
3a280de
sampling site list tsyling
mauberti-bc Apr 18, 2024
0ce4861
Merge branch 'dev' of github.com:bcgov/biohubbc into method-response-…
mauberti-bc Apr 18, 2024
c84c970
spacing
mauberti-bc Apr 18, 2024
be31220
Merge branch 'dev' into method-response-variable
mauberti-bc Apr 18, 2024
1dba7d2
Merge branch 'method-response-variable' of github.com:bcgov/biohubbc …
mauberti-bc Apr 18, 2024
31f68c3
alternate styling
mauberti-bc Apr 18, 2024
a6b963d
additionalproperties: false in samplesite openapi spec
mauberti-bc Apr 18, 2024
c2a91e1
remove not null constraint on subcount sign
mauberti-bc Apr 19, 2024
e341f5f
linter
mauberti-bc Apr 19, 2024
d55b022
update survey progress chip deisgn
mauberti-bc Apr 19, 2024
6b4d015
linter
mauberti-bc Apr 19, 2024
8091002
replace sampling site inset map with survey map component
mauberti-bc Apr 19, 2024
2067bfa
jsdoc fixes
mauberti-bc Apr 19, 2024
bdf8b26
linter
mauberti-bc Apr 19, 2024
c34d7b2
linter
mauberti-bc Apr 19, 2024
4bc844f
code smells
mauberti-bc Apr 20, 2024
64f1672
code smell
mauberti-bc Apr 20, 2024
1297d92
styling
mauberti-bc Apr 20, 2024
9d3e373
change to direct imports for MUI components
mauberti-bc Apr 24, 2024
5329631
change mui/system to mui/material in imports
mauberti-bc Apr 24, 2024
6e09839
prettier
mauberti-bc Apr 24, 2024
4946eee
cleanup
mauberti-bc Apr 24, 2024
894e862
sort sampling periods by date and time
mauberti-bc Apr 24, 2024
e92a492
typo
mauberti-bc Apr 24, 2024
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 @@ -131,6 +131,10 @@ GET.apiDoc = {
type: 'integer',
minimum: 1
},
method_response_metric_id: {
type: 'integer',
minimum: 1
},
description: {
type: 'string',
maxLength: 250
Expand Down Expand Up @@ -173,8 +177,7 @@ GET.apiDoc = {
}
}
}
},
method_response_metric_id: { type: 'integer', minimum: 1 }
}
}
}
},
Expand Down Expand Up @@ -456,15 +459,15 @@ POST.apiDoc = {
nullable: true
},
create_user: {
type: 'number',
type: 'integer',
nullable: true
},
update_date: {
type: 'string',
nullable: true
},
update_user: {
type: 'string',
type: 'integer',
nullable: true
},
revision_count: {
Expand Down Expand Up @@ -500,15 +503,15 @@ POST.apiDoc = {
nullable: true
},
create_user: {
type: 'string',
type: 'integer',
nullable: true
},
update_date: {
type: 'string',
nullable: true
},
update_user: {
type: 'string',
type: 'integer',
nullable: true
},
revision_count: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ PUT.apiDoc = {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
mauberti-bc marked this conversation as resolved.
Show resolved Hide resolved
required: ['survey_block_id'],
properties: {
survey_block_id: {
Expand All @@ -178,7 +177,6 @@ PUT.apiDoc = {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
mauberti-bc marked this conversation as resolved.
Show resolved Hide resolved
required: ['survey_stratum_id'],
properties: {
survey_stratum_id: {
Expand Down
4 changes: 2 additions & 2 deletions api/src/repositories/code-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export const IAllCodeSets = z.object({
vantage_codes: CodeSet(),
survey_jobs: CodeSet(),
site_selection_strategies: CodeSet(),
survey_progress: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape),
sample_methods: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape),
survey_progress: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape),
method_response_metrics: CodeSet(z.object({ id: z.number(), name: z.string(), description: z.string() }).shape)
});

Expand All @@ -53,7 +53,7 @@ export type IAllCodeSets = z.infer<typeof IAllCodeSets>;
export class CodeRepository extends BaseRepository {
async getSampleMethods() {
const sql = SQL`
SELECT method_lookup_id as id, name, description FROM method_lookup;
SELECT method_lookup_id as id, name, description FROM method_lookup ORDER BY name ASC;
`;
const response = await this.connection.sql(sql);
return response.rows;
Expand Down
9 changes: 8 additions & 1 deletion api/src/repositories/survey-location-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ export class SurveyLocationRepository extends BaseRepository {
async getSurveyLocationsData(surveyId: number): Promise<SurveyLocationRecord[]> {
const sqlStatement = SQL`
SELECT
*
survey_location_id,
name,
description,
geography,
geojson,
geometry,
name,
revision_count
FROM
survey_location
WHERE
Expand Down
34 changes: 34 additions & 0 deletions app/src/components/chips/ColouredRectangleChip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Chip, ChipProps, Color } from '@mui/material';

export interface IColouredRectangleChipProps extends ChipProps {
colour: Color;
label: string | JSX.Element;
}

/**
* Returns a stylized MUI chip
*
* @param props {IColouredRectangleChipProps}
* @returns
*/
const ColouredRectangleChip = (props: IColouredRectangleChipProps) => {
return (
<Chip
size="small"
{...props}
sx={{
bgcolor: props.colour[50],
borderRadius: '5px',
minWidth: 0,
'& .MuiChip-label': {
color: props.colour[700],
fontWeight: 700,
fontSize: '0.75rem',
p: 1
}
}}
/>
);
};

export default ColouredRectangleChip;
22 changes: 12 additions & 10 deletions app/src/components/map/components/StaticLayers.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Feature } from 'geojson';
import L from 'leaflet';
import { PropsWithChildren, ReactElement, useMemo } from 'react';
import {
FeatureGroup,
Expand All @@ -11,7 +10,7 @@ import {
Tooltip,
TooltipProps
} from 'react-leaflet';
import { coloredPoint } from 'utils/mapUtils';
import { coloredCustomPointMarker, coloredPoint } from 'utils/mapUtils';

export interface IStaticLayerFeature {
geoJSON: Feature;
Expand All @@ -36,14 +35,19 @@ export interface IStaticLayersProps {
layers: IStaticLayer[];
}

/**
* Returns static map layers to be displayed in leaflet
*
* @param props {PropsWithChildren<IStaticLayersProps>}
* @returns
*/
const StaticLayers = (props: PropsWithChildren<IStaticLayersProps>) => {
const layerControls: ReactElement[] = useMemo(
() =>
props.layers
.filter((layer) => Boolean(layer.features?.length))
.map((layer) => {
const layerColors = layer.layerColors || { color: '#1f7dff', fillColor: '#1f7dff' };

return (
<LayersControl.Overlay checked={true} name={layer.layerName} key={`static-layer-${layer.layerName}`}>
<FeatureGroup key={`static-feature-group-${layer.layerName}`}>
Expand All @@ -54,13 +58,11 @@ const StaticLayers = (props: PropsWithChildren<IStaticLayersProps>) => {
<GeoJSON
key={`static-feature-${id}`}
style={{ ...layerColors }}
pointToLayer={(feature, latlng) => {
if (feature.properties?.radius) {
return new L.Circle([latlng.lat, latlng.lng], feature.properties.radius);
}

return coloredPoint({ latlng });
}}
pointToLayer={(_, latlng) =>
layer.layerName === 'Observations'
? coloredCustomPointMarker({ latlng, fillColor: layer.layerColors?.fillColor })
: coloredPoint({ latlng, fillColor: layer.layerColors?.fillColor })
}
data={item.geoJSON}
{...item.GeoJSONProps}>
{item.tooltip && (
Expand Down
9 changes: 9 additions & 0 deletions app/src/constants/misc.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Color } from '@mui/material';
import { blue, green, purple } from '@mui/material/colors';

export enum AdministrativeActivityType {
SYSTEM_ACCESS = 'System Access'
}
Expand All @@ -7,3 +10,9 @@ export enum AdministrativeActivityStatusType {
ACTIONED = 'Actioned',
REJECTED = 'Rejected'
}

export const SurveyProgressChipColours: Record<string, Color> = {
PLANNING: blue,
'IN PROGRESS': purple,
COMPLETED: green
};
8 changes: 8 additions & 0 deletions app/src/constants/spatial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ export const ALL_OF_BC_BOUNDARY: Feature = {
]
}
};

export const SURVEY_MAP_LAYER_COLOURS = {
OBSERVATIONS_COLOUR: '#db4f4f',
STUDY_AREA_COLOUR: '#e3a82b',
SAMPLING_SITE_COLOUR: '#1f6fb5',
TELEMETRY_COLOUR: '#ff5454',
DEFAULT_COLOUR: '#a7bfd1'
};
7 changes: 5 additions & 2 deletions app/src/features/projects/view/ProjectHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
mdiAccountMultipleOutline,
mdiCalendarRange,
mdiCalendarTodayOutline,
mdiChevronDown,
mdiCogOutline,
Expand All @@ -8,6 +9,7 @@ import {
} from '@mdi/js';
import Icon from '@mdi/react';
import Button from '@mui/material/Button';
import { grey } from '@mui/material/colors';
import ListItemIcon from '@mui/material/ListItemIcon';
import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
Expand Down Expand Up @@ -106,9 +108,10 @@ const ProjectHeader = () => {
<>
{projectData.projectData.project.end_date ? (
<Stack flexDirection="row" alignItems="center" gap={0.75} color="text.secondary">
<Typography component="span">Project Timeline:</Typography>
<Icon path={mdiCalendarRange} size={0.8} color={grey[600]} style={{ marginTop: 1.5 }} />

{getFormattedDateRangeString(
DATE_FORMAT.ShortMediumDateFormat,
DATE_FORMAT.MediumDateFormat,
projectData.projectData.project.start_date,
projectData.projectData.project.end_date
)}
Expand Down
1 change: 1 addition & 0 deletions app/src/features/surveys/components/EditSamplingMethod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface IEditSamplingMethodProps {

const EditSamplingMethod: React.FC<IEditSamplingMethodProps> = (props) => {
const { open, initialData, onSubmit, onClose } = props;

return (
<>
<EditDialog
Expand Down
13 changes: 9 additions & 4 deletions app/src/features/surveys/components/MethodForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mdiArrowRight, mdiCalendarMonthOutline, mdiClockOutline, mdiPlus, mdiTrashCanOutline } from '@mdi/js';
import { mdiArrowRightThin, mdiCalendarMonthOutline, mdiClockOutline, mdiPlus, mdiTrashCanOutline } from '@mdi/js';
import Icon from '@mdi/react';
import Alert from '@mui/material/Alert';
import Box from '@mui/material/Box';
Expand All @@ -18,7 +18,7 @@ import { FieldArray, FieldArrayRenderProps, useFormikContext } from 'formik';
import { useContext, useEffect } from 'react';
import yup from 'utils/YupSchema';

interface ISurveySampleMethodPeriodData {
export interface ISurveySampleMethodPeriodData {
survey_sample_period_id: number | null;
survey_sample_method_id: number | null;
start_date: string;
Expand Down Expand Up @@ -99,6 +99,11 @@ export const SamplingSiteMethodYupSchema = yup.object({
.min(1, 'At least one time period is required')
});

/**
* Returns a form for editing a sampling method
*
* @returns
*/
const MethodForm = () => {
const formikProps = useFormikContext<ISurveySampleMethodData>();
const { values, errors } = formikProps;
Expand Down Expand Up @@ -161,7 +166,7 @@ const MethodForm = () => {
sx={{
mb: 1
}}>
Time Periods
Periods
</Typography>
<Box>
<FieldArray
Expand Down Expand Up @@ -236,7 +241,7 @@ const MethodForm = () => {
</Stack>

<Box flex="0 0 auto" mt={2.25}>
<Icon path={mdiArrowRight} size={0.8} />
<Icon path={mdiArrowRightThin} size={1} />
</Box>

<Stack>
Expand Down
Loading
Loading