-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into explode-multipoint-for-agol
- Loading branch information
Showing
31 changed files
with
585 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
moped-database/migrations/1723496266685_add_fdu_columns/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Drop generated columns generated columns for fund_dept_unit and fund_name | ||
ALTER TABLE moped_proj_funding DROP COLUMN IF EXISTS fund_dept_unit, DROP COLUMN IF EXISTS fund_name; |
11 changes: 11 additions & 0 deletions
11
moped-database/migrations/1723496266685_add_fdu_columns/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Add generated columns for fund_dept_unit and fund_name | ||
ALTER TABLE moped_proj_funding | ||
ADD COLUMN fund_dept_unit text GENERATED ALWAYS AS (CASE WHEN (fund IS null OR dept_unit IS null) THEN null ELSE | ||
coalesce(fund ->> 'fund_id', ' ') || ' ' || coalesce(dept_unit ->> 'dept', ' ') || ' ' || coalesce(dept_unit ->> 'unit', ' ') | ||
END) STORED, | ||
ADD COLUMN fund_name text GENERATED ALWAYS AS ( | ||
CASE WHEN fund IS null THEN null ELSE coalesce(fund ->> 'fund_name', ' ') END | ||
) STORED; | ||
|
||
COMMENT ON COLUMN moped_proj_funding.fund_dept_unit IS 'Fund, department, and unit numbers concatenated; null if fund or unit is not populated'; | ||
COMMENT ON COLUMN moped_proj_funding.fund_name IS 'Fund name; null if fund is not populated'; |
2 changes: 2 additions & 0 deletions
2
moped-database/migrations/1723496266686_add_bike_share_station_comp/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- if we delete the component in the future, we will soft delete and leave existing data intact | ||
SELECT 0; |
37 changes: 37 additions & 0 deletions
37
moped-database/migrations/1723496266686_add_bike_share_station_comp/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-- add bike share station component type (point) to moped_components table if it doesn't already exist | ||
INSERT INTO moped_components (component_name, line_representation, feature_layer_id) | ||
SELECT | ||
'Bike Share Station', | ||
FALSE, | ||
5 | ||
WHERE NOT EXISTS ( | ||
SELECT * | ||
FROM | ||
moped_components | ||
WHERE (component_name, line_representation, feature_layer_id) = ('Bike Share Station', FALSE, 5) | ||
); | ||
|
||
-- insert new, mod, and replacement work types for bike share station in moped_component_work_types table | ||
WITH inserts_todo AS ( | ||
SELECT | ||
mwt.id AS work_type_id, | ||
mc.component_id AS component_id | ||
FROM | ||
moped_work_types AS mwt, | ||
moped_components AS mc | ||
WHERE | ||
mwt.name IN ( | ||
'New', | ||
'Modification', | ||
'Replacement' | ||
) | ||
AND mc.component_name = 'Bike Share Station' | ||
) | ||
|
||
INSERT INTO moped_component_work_types (work_type_id, component_id) | ||
SELECT | ||
work_type_id, | ||
component_id | ||
FROM | ||
inserts_todo | ||
ON CONFLICT DO NOTHING; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
moped-editor/src/views/projects/projectView/ProjectFunding/FundAutocompleteComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from "react"; | ||
import { Autocomplete, TextField } from "@mui/material"; | ||
import { useGridApiContext } from "@mui/x-data-grid-pro"; | ||
import makeStyles from "@mui/styles/makeStyles"; | ||
import CustomPopper from "src/components/CustomPopper"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
fundSelectStyle: { | ||
width: "190px", | ||
alignContent: "center", | ||
}, | ||
})); | ||
|
||
const FundAutocompleteComponent = (props) => { | ||
const classes = useStyles(); | ||
const { id, value, field, hasFocus } = props; | ||
const apiRef = useGridApiContext(); | ||
const ref = React.useRef(null); | ||
|
||
React.useEffect(() => { | ||
if (hasFocus) { | ||
ref.current.focus(); | ||
} | ||
}, [hasFocus]); | ||
|
||
const handleChange = (event, newValue) => { | ||
apiRef.current.setEditCellValue({ | ||
id, | ||
field, | ||
value: newValue ?? null, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Autocomplete | ||
className={classes.fundSelectStyle} | ||
value={value ?? null} | ||
// use customized popper component so menu expands to fullwidth | ||
PopperComponent={CustomPopper} | ||
id="moped_funds" | ||
options={props.data} | ||
renderInput={(params) => ( | ||
<TextField variant="standard" {...params} inputRef={ref} /> | ||
)} | ||
getOptionLabel={(option) => | ||
// if our value is a string, just return the string | ||
typeof option === "string" | ||
? option | ||
: `${option.fund_id} | ${option.fund_name}` | ||
} | ||
isOptionEqualToValue={(value, option) => | ||
value.fund_id === option.fund_id && value.fund_name === option.fund_name | ||
} | ||
onChange={handleChange} | ||
/> | ||
); | ||
}; | ||
|
||
export default FundAutocompleteComponent; |
File renamed without changes.
Oops, something went wrong.