Skip to content

Commit

Permalink
Merge pull request #483 from cityofaustin/7713-project-types
Browse files Browse the repository at this point in the history
Add project types to signal project dashboard and project summary views
  • Loading branch information
chiaberry authored Dec 6, 2021
2 parents b756435 + ea4d190 commit 94b7333
Show file tree
Hide file tree
Showing 15 changed files with 409 additions and 37 deletions.
47 changes: 30 additions & 17 deletions moped-database/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4112,64 +4112,77 @@
permission:
check: {}
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
- status_id
backend_only: false
- role: moped-editor
permission:
check: {}
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
backend_only: false
- status_id
select_permissions:
- role: moped-admin
permission:
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
- status_id
filter: {}
- role: moped-editor
permission:
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
- status_id
filter: {}
- role: moped-viewer
permission:
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
- status_id
filter: {}
update_permissions:
- role: moped-admin
permission:
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
- status_id
filter: {}
check: {}
check: null
- role: moped-editor
permission:
columns:
- added_by
- date_added
- id
- project_id
- project_type_id
- date_added
- added_by
- status_id
filter: {}
check: {}
check: null
event_triggers:
- name: activity_log_moped_project_types
definition:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."moped_project_types" DROP COLUMN "id";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."moped_project_types" ADD COLUMN "id" serial NOT NULL UNIQUE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."moped_project_types" drop constraint "moped_project_types_pkey";
alter table "public"."moped_project_types"
add constraint "moped_project_types_pkey"
primary key ( "project_type_id" );
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."moped_project_types" drop constraint "moped_project_types_pkey";
alter table "public"."moped_project_types"
add constraint "moped_project_types_pkey"
primary key ( "id" );
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."moped_project_types" DROP COLUMN "status_id";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "public"."moped_project_types" ADD COLUMN "status_id" integer NOT NULL DEFAULT 0;
29 changes: 29 additions & 0 deletions moped-editor/src/queries/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export const SUMMARY_QUERY = gql`
project_note_id
project_note
}
moped_project_types(where: { status_id: { _eq: 1 } }) {
id
status_id
moped_type {
type_name
type_id
}
}
}
moped_proj_partners(
where: { project_id: { _eq: $projectId }, status_id: { _eq: 1 } }
Expand Down Expand Up @@ -92,6 +100,10 @@ export const SUMMARY_QUERY = gql`
entity_id
entity_name
}
moped_types {
type_id
type_name
}
moped_status(
where: { status_id: { _gt: 0 } }
order_by: { status_order: asc }
Expand Down Expand Up @@ -817,6 +829,23 @@ export const PROJECT_UPDATE_CURRENT_STATUS = gql`
}
`;

export const PROJECT_UPDATE_TYPES = gql`
mutation UpdateMopedProjectTypes(
$types: [moped_project_types_insert_input!]!
$deleteList: [Int!]!
) {
insert_moped_project_types(objects: $types) {
affected_rows
}
update_moped_project_types(
where: { id: { _in: $deleteList } }
_set: { status_id: 0 }
) {
affected_rows
}
}
`;

export const PROJECT_UPDATE_ECAPRIS_SUBPROJECT_ID = gql`
mutation UpdateProjectECapris(
$projectId: Int!
Expand Down
20 changes: 19 additions & 1 deletion moped-editor/src/queries/signals.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ export const SIGNAL_PROJECTS_QUERY = gql`
funding_source_name
}
}
moped_project_types {
moped_project_types(where: { status_id: { _eq: 1 } }) {
id
status_id
moped_type {
type_name
type_id
}
}
moped_proj_personnel(where: { status_id: { _eq: 1 } }) {
Expand All @@ -65,6 +68,10 @@ export const SIGNAL_PROJECTS_QUERY = gql`
entity_id
entity_name
}
moped_types {
type_id
type_name
}
}
`;

Expand All @@ -74,6 +81,8 @@ export const UPDATE_SIGNAL_PROJECT = gql`
$contractor: String
$purchase_order_number: String
$entity_id: Int
$projectTypes: [moped_project_types_insert_input!]!
$typesDeleteList: [Int!]
) {
update_moped_project_by_pk(
pk_columns: { project_id: $project_id }
Expand All @@ -85,5 +94,14 @@ export const UPDATE_SIGNAL_PROJECT = gql`
) {
project_id
}
insert_moped_project_types(objects: $projectTypes) {
affected_rows
}
update_moped_project_types(
where: { id: { _in: $typesDeleteList } }
_set: { status_id: 0 }
) {
affected_rows
}
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useParams } from "react-router-dom";

import ProjectSummaryMap from "./ProjectSummaryMap";
import ProjectSummaryStatusUpdate from "./ProjectSummaryStatusUpdate";
import ProjectSummaryCurrentPhase from "./ProjectSummaryCurrentPhase";
import { createFeatureCollectionFromProjectFeatures } from "../../../../utils/mapHelpers";

import { Grid, CardContent, CircularProgress } from "@material-ui/core";
Expand All @@ -21,8 +20,8 @@ import makeStyles from "@material-ui/core/styles/makeStyles";
import ProjectSummarySnackbar from "./ProjectSummarySnackbar";
import ProjectSummaryProjectWebsite from "./ProjectSummaryProjectWebsite";
import ProjectSummaryProjectDescription from "./ProjectSummaryProjectDescription";
import ProjectSummaryCurrentStatus from "./ProjectSummaryCurrentStatus";
import ProjectSummaryProjectECapris from "./ProjectSummaryProjectECapris";
import ProjectSummaryProjectTypes from "./ProjectSummaryProjectTypes";

import { countFeatures } from "../../../../utils/mapHelpers";

Expand Down Expand Up @@ -147,14 +146,9 @@ const ProjectSummary = ({ loading, error, data, refetch }) => {
refetch={refetch}
classes={classes}
/>
<ProjectSummaryCurrentPhase
projectId={projectId}
data={data}
classes={classes}
/>
<Grid container spacing={0}>
<Grid item xs={6}>
<ProjectSummaryCurrentStatus
<ProjectSummaryProjectSponsor
projectId={projectId}
data={data}
refetch={refetch}
Expand All @@ -163,7 +157,7 @@ const ProjectSummary = ({ loading, error, data, refetch }) => {
/>
</Grid>
<Grid item xs={6}>
<ProjectSummaryProjectECapris
<ProjectSummaryProjectPartners
projectId={projectId}
data={data}
refetch={refetch}
Expand All @@ -174,7 +168,7 @@ const ProjectSummary = ({ loading, error, data, refetch }) => {
</Grid>
<Grid container spacing={0}>
<Grid item xs={6}>
<ProjectSummaryProjectSponsor
<ProjectSummaryProjectTypes
projectId={projectId}
data={data}
refetch={refetch}
Expand All @@ -183,7 +177,7 @@ const ProjectSummary = ({ loading, error, data, refetch }) => {
/>
</Grid>
<Grid item xs={6}>
<ProjectSummaryProjectPartners
<ProjectSummaryProjectWebsite
projectId={projectId}
data={data}
refetch={refetch}
Expand All @@ -194,7 +188,7 @@ const ProjectSummary = ({ loading, error, data, refetch }) => {
</Grid>
<Grid container spacing={0}>
<Grid item xs={6}>
<ProjectSummaryProjectWebsite
<ProjectSummaryProjectECapris
projectId={projectId}
data={data}
refetch={refetch}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const ProjectSummaryProjectPartners = ({

return (
<Grid item xs={12} className={classes.fieldGridItem}>
<Typography className={classes.fieldLabel}>Project partners</Typography>
<Typography className={classes.fieldLabel}>Partners</Typography>
<Box
display="flex"
justifyContent="flex-start"
Expand Down Expand Up @@ -164,6 +164,7 @@ const ProjectSummaryProjectPartners = ({
<MenuItem key={entity.entity_id} value={entity.entity_id}>
<Checkbox
checked={selectedEntities.includes(entity.entity_id)}
color={"primary"}
/>
<ListItemText primary={entity.entity_name} />
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const ProjectSummaryProjectSponsor = ({

return (
<Grid item xs={12} className={classes.fieldGridItem}>
<Typography className={classes.fieldLabel}>Project sponsor</Typography>
<Typography className={classes.fieldLabel}>Sponsor</Typography>
<Box
display="flex"
justifyContent="flex-start"
Expand Down
Loading

0 comments on commit 94b7333

Please sign in to comment.