Skip to content

Commit

Permalink
Merge pull request #1518 from cityofaustin/2.27.0-release-candidate
Browse files Browse the repository at this point in the history
2.27.0 San Ygnacio Creek
  • Loading branch information
mddilley authored Jan 2, 2025
2 parents 72167ad + 4b92f39 commit 3bf9357
Show file tree
Hide file tree
Showing 25 changed files with 238 additions and 221 deletions.
2 changes: 1 addition & 1 deletion moped-database/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Architecture Independent Docker Stack Components for Moped Development Environment
services:
hasura:
image: hasura/graphql-engine:v2.45.0
image: hasura/graphql-engine:v2.45.1
depends_on:
- moped-pgsql
expose:
Expand Down
14 changes: 10 additions & 4 deletions moped-database/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1767,18 +1767,21 @@
columns:
- funding_status_id
- funding_status_name
- funding_status_description
filter: {}
- role: moped-editor
permission:
columns:
- funding_status_id
- funding_status_name
- funding_status_description
filter: {}
- role: moped-viewer
permission:
columns:
- funding_status_id
- funding_status_name
- funding_status_description
filter: {}
- table:
name: moped_funds
Expand Down Expand Up @@ -5466,25 +5469,28 @@
- role: moped-admin
permission:
columns:
- date_added
- is_deleted
- workgroup_id
- workgroup_name
- date_added
filter: {}
allow_aggregations: true
- role: moped-editor
permission:
columns:
- date_added
- is_deleted
- workgroup_id
- workgroup_name
- date_added
filter: {}
allow_aggregations: true
- role: moped-viewer
permission:
columns:
- workgroup_name
- workgroup_id
- date_added
- is_deleted
- workgroup_id
- workgroup_name
filter: {}
allow_aggregations: true
- table:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Updating moped_workgroup table will be up only. If we need to revert, we will need do it manually or
-- update with a future migration.
SELECT 0;
37 changes: 37 additions & 0 deletions moped-database/migrations/1734717637542_update_workgroups/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
-- Add soft deletes to workgroup table
ALTER TABLE moped_workgroup ADD is_deleted boolean DEFAULT FALSE;
COMMENT ON COLUMN moped_workgroup.is_deleted IS 'Indicates soft deletion';

INSERT INTO moped_workgroup ("workgroup_name", "workgroup_abbreviation", "department_id") VALUES
('Sidewalks and Urban Trails', 'SUTD', 11);

-- Soft delete existing workgroup records that are merging into the new one
UPDATE moped_workgroup SET is_deleted = TRUE WHERE workgroup_name IN ('Sidewalks', 'Urban Trails');

-- Find existing users records that are associated with the workgroups that are merging
-- and update them to the new workgroup row for SUTD
WITH user_todos AS (
SELECT workgroup_id AS ids
FROM
moped_workgroup
WHERE
workgroup_name IN (
'Sidewalks',
'Urban Trails'
)
),

new_workgroup_row AS (
SELECT workgroup_id AS id
FROM
moped_workgroup
WHERE
workgroup_name = 'Sidewalks and Urban Trails'
)

UPDATE
moped_users
SET
workgroup_id = (SELECT id FROM new_workgroup_row)
WHERE
workgroup_id IN (SELECT ids FROM user_todos);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Remove the funding_status_description column
ALTER TABLE "public"."moped_fund_status"
DROP COLUMN "funding_status_description";
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ALTER TABLE "public"."moped_fund_status"
ADD COLUMN "funding_status_description" text NULL;

COMMENT ON COLUMN "public"."moped_fund_status"."funding_status_description" IS 'Description of the funding status';

UPDATE "public"."moped_fund_status"
SET "funding_status_description" = CASE "funding_status_name"
WHEN 'Tentative' THEN 'In conversation about possible funding commitment'
WHEN 'Confirmed' THEN 'Commitment to funding'
WHEN 'Available' THEN 'Funding is available, e.g. private developer'
WHEN 'Funding setup requested' THEN 'Requested that funding be set up in eCAPRIS'
WHEN 'Set up' THEN 'Funding has been set up in eCAPRIS; has FDU'
ELSE "funding_status_description"
END;
2 changes: 1 addition & 1 deletion moped-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "atd-moped-editor",
"author": "ATD Data & Technology Services",
"license": "CC0-1.0",
"version": "2.26.0",
"version": "2.27.0",
"homepage": "/moped",
"private": false,
"repository": {
Expand Down
10 changes: 9 additions & 1 deletion moped-editor/src/components/DataGridPro/DataGridActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ const DataGridActions = ({
*/
const hasRequiredFields = useGridSelector(apiRef, () => {
const editState = apiRef.current.state.editRows;

for (const field of requiredFields) {
if (!editState[id]?.[field]?.value) {
const hasError = Boolean(editState[id]?.[field]?.error);
const hasValue = Boolean(editState[id]?.[field]?.value);

if (hasError || !hasValue) {
return false;
}
}
Expand All @@ -58,6 +62,7 @@ const DataGridActions = ({
<GridActionsCellItem
icon={<CheckIcon sx={defaultEditColumnIconStyle} />}
label="Save"
key="save"
sx={{
color: "primary.main",
}}
Expand All @@ -67,6 +72,7 @@ const DataGridActions = ({
<GridActionsCellItem
icon={<CloseIcon sx={defaultEditColumnIconStyle} />}
label="Cancel"
key="cancel"
className="textPrimary"
onClick={handleCancelClick(id)}
color="inherit"
Expand All @@ -79,6 +85,7 @@ const DataGridActions = ({
<GridActionsCellItem
icon={<EditOutlinedIcon sx={defaultEditColumnIconStyle} />}
label="Edit"
key="edit"
className="textPrimary"
onClick={handleEditClick(id)}
color="inherit"
Expand All @@ -87,6 +94,7 @@ const DataGridActions = ({
<GridActionsCellItem
icon={<DeleteOutlineIcon sx={defaultEditColumnIconStyle} />}
label="Delete"
key="delete"
onClick={handleDeleteOpen(id)}
color="inherit"
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const DataGridTextField = ({
return (
<TextField
variant="standard"
style={{ width: "inherit", paddingTop: "inherit" }}
sx={{ width: "100%", mx: 1, pt: 1 }}
id={field}
inputRef={ref}
name={field}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const FileUploadDialogSingle = (props) => {
value={undefined}
onChange={handleFileNameChange}
fullWidth
helperText={"Required"}
/>

<FormControl>
Expand Down Expand Up @@ -244,7 +245,7 @@ const FileUploadDialogSingle = (props) => {
value={undefined}
onChange={handleExternalLinkChange}
fullWidth
helperText={"Enter URL or network location"}
helperText={"Required. Enter URL or network location"}
/>
) : (
<FileUpload
Expand Down
8 changes: 8 additions & 0 deletions moped-editor/src/queries/tableLookups.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,13 @@ export const TABLE_LOOKUPS_QUERY = gql`
project_role_name
project_role_description
}
moped_fund_status(
# Filter out the "Archived" status
where: { funding_status_id: { _neq: 0 } }
) {
funding_status_name
funding_status_id
funding_status_description
}
}
`;
5 changes: 4 additions & 1 deletion moped-editor/src/queries/workgroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { gql } from "@apollo/client";

export const WORKGROUPS_QUERY = gql`
query GetWorkgroups {
moped_workgroup(order_by: {workgroup_name: asc}) {
moped_workgroup(
order_by: { workgroup_name: asc }
where: { is_deleted: { _eq: false } }
) {
workgroup_id
workgroup_name
}
Expand Down
18 changes: 18 additions & 0 deletions moped-editor/src/views/dev/LookupsView/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ export const SETTINGS = [
},
],
},
{
key: "moped_fund_status",
label: "Fund status",
columns: [
{
key: "funding_status_id",
label: "Status ID",
},
{
key: "funding_status_name",
label: "Name",
},
{
key: "funding_status_description",
label: "Description",
},
],
},
{
key: "moped_milestones",
label: "Milestones",
Expand Down
57 changes: 0 additions & 57 deletions moped-editor/src/views/projects/projectView/DataGridTextField.js

This file was deleted.

6 changes: 3 additions & 3 deletions moped-editor/src/views/projects/projectView/ProjectFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import downloadFileAttachment from "../../../utils/downloadFileAttachment";
import { FormattedDateString } from "src/utils/dateAndTime";
import { isValidUrl } from "src/utils/urls";
import ProjectFilesToolbar from "./ProjectFilesToolbar";
import DataGridTextField from "./DataGridTextField";
import DataGridTextField from "src/components/DataGridPro/DataGridTextField";
import ProjectFilesTypeSelect from "./ProjectFilesTypeSelect";
import DeleteConfirmationModal from "./DeleteConfirmationModal";
import DataGridActions from "src/components/DataGridPro/DataGridActions";
Expand Down Expand Up @@ -64,7 +64,7 @@ const fileTypes = ["", "Funding", "Plans", "Estimates", "Other"];
// 'private/project/65/80_04072022191747_40d4c982e064d0f9_1800halfscofieldridgepwkydesignprint.pdf'
const cleanUpFileKey = (str) => str.replace(/^(?:[^_]*_){3}/g, "");

const requiredFields = ["file_name", "file_url", "file_type"];
const requiredFields = ["file_name", "file_type"];

const useColumns = ({
classes,
Expand Down Expand Up @@ -161,7 +161,7 @@ const useColumns = ({
field: "file_description",
editable: true,
width: 200,
renderEditCell: (props) => <DataGridTextField {...props} />,
renderEditCell: (props) => <DataGridTextField {...props} multiline />,
},
{
headerName: "Uploaded by",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ProjectFilesTypeSelect = ({ id, value, field, hasFocus }) => {
};

return (
<FormControl variant="standard" sx={{ paddingTop: "8px", width: "90%" }}>
<FormControl variant="standard" sx={{ width: "100%", mx: 1 }}>
<Select
variant="standard"
id={field}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
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 { getLookupValueByID } from "src/components/DataGridPro/utils/helpers";
import CustomPopper from "src/components/CustomPopper";

const useStyles = makeStyles((theme) => ({
autocompleteLookupInput: {
minWidth: "200px",
alignContent: "center",
padding: theme.spacing(1),
},
}));

/**
* Component for dropdown select using a lookup table as options
* @param {Number} id - row id in Data Grid
Expand All @@ -31,7 +22,6 @@ const LookupAutocompleteComponent = ({
name,
lookupTable,
}) => {
const classes = useStyles();
const apiRef = useGridApiContext();
const ref = React.useRef(null);

Expand All @@ -51,7 +41,7 @@ const LookupAutocompleteComponent = ({

return (
<Autocomplete
className={classes.autocompleteLookupInput}
sx={{ width: "100%", mx: 1 }}
value={
// if we are editing, the autocomplete has the value provided by the material table, which is the record id
// need to get its corresponding text value
Expand Down
Loading

0 comments on commit 3bf9357

Please sign in to comment.