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

[Prod] Remove fields from the objective form on the RTR #2167

Merged
merged 99 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
89eead1
Begin the grand refactor
thewatermethod May 13, 2024
00fd48c
Update file refs
thewatermethod May 13, 2024
302ff0a
clean up typescript on reduceGoals
thewatermethod May 14, 2024
1a67457
Merge remote-tracking branch origin/main into mb/TTAHUB-2530/update-R…
thewatermethod May 14, 2024
c5bcd5e
Stash updates
thewatermethod May 14, 2024
d238edc
Merge remote-tracking branch origin/main into mb/TTAHUB-2530/update-…
thewatermethod May 14, 2024
b81a45c
More updated designs, fix of existing issues
thewatermethod May 14, 2024
02307ae
Remove console.log
thewatermethod May 14, 2024
d18a75e
Another layer of "polish" on "view goals"
thewatermethod May 15, 2024
beb4102
Test for GoalCollaboratorName
thewatermethod May 15, 2024
a892e24
Add test for GoalFormTitle
thewatermethod May 15, 2024
d425466
Handle no goal returned from fetch
thewatermethod May 15, 2024
1c744f3
Add test for new page
thewatermethod May 15, 2024
385280d
Hopefully fix API tests
thewatermethod May 15, 2024
606ec9f
Hopefully update e2e tests
thewatermethod May 15, 2024
dbd99f7
Just a typo
thewatermethod May 15, 2024
49ffef2
add onAR to api validation
thewatermethod May 15, 2024
ffce029
Update tests
thewatermethod May 15, 2024
067a31c
Update backend tests
thewatermethod May 15, 2024
ba91175
Update e2e tests
thewatermethod May 15, 2024
816de2a
Fix another e2e interaction
thewatermethod May 15, 2024
189dd44
Add new column for ActivityReportObjectives
thewatermethod May 16, 2024
292926b
Simplify objective frontend
thewatermethod May 16, 2024
1c37190
Simplify all form controls
thewatermethod May 16, 2024
cb2733f
Correct references to moved file
thewatermethod May 17, 2024
c577afb
Complete feature
thewatermethod May 17, 2024
ae07dc0
more fiddling with types
thewatermethod May 17, 2024
a5b9b4f
More type finagling
thewatermethod May 17, 2024
f3c7151
Finish typescript conversion; time to iron out bugs
thewatermethod May 20, 2024
a750252
Scale back changes
thewatermethod May 20, 2024
1850f35
Update and revert some changes
thewatermethod May 20, 2024
c52d826
Let us be inclusive, as before, with reduce goals
thewatermethod May 20, 2024
9af560f
Revert some more changes and fix another test
thewatermethod May 20, 2024
ccec1c2
assert the new AR objective column is set by the cacheObjectiveMetada…
thewatermethod May 20, 2024
579bd63
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2660/activi…
thewatermethod May 20, 2024
7c4c044
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2530/update…
thewatermethod May 20, 2024
324dd5f
Merge branch 'mb/TTAHUB-2530/update-RTR-objective-form' into mb/TTAHU…
thewatermethod May 20, 2024
63fc474
Revert more changes
thewatermethod May 20, 2024
9495c3c
Allow goal number in api test
thewatermethod May 20, 2024
400ea80
Fix API tests
thewatermethod May 21, 2024
e76ffbc
Goal source is read-only on the AR
thewatermethod May 21, 2024
78bede5
Revert "Goal source is read-only on the AR"
thewatermethod May 21, 2024
643481e
Goal source is not editable once on an approved report
thewatermethod May 21, 2024
0f42b96
dedupe ARG and create timeseries functions, restore missing ARGFRs
May 21, 2024
937f4d9
use current values if no historical root cause
May 21, 2024
2f32d4b
pacify linter
May 21, 2024
e8d5eaf
switch to plpgsql
May 21, 2024
b73d627
debug
May 21, 2024
764ff51
debug
May 21, 2024
3fff80b
debug
May 21, 2024
78c51e8
debug
May 21, 2024
cb7cfb5
typo fix
May 21, 2024
53eb1c6
debug
May 21, 2024
b1cf6d7
debug
May 21, 2024
99ddb13
debug
May 21, 2024
4f40d6d
tolerate empty tables
May 21, 2024
c48f55d
delete cruft
May 21, 2024
0ebe29c
Fix for other entity objectives
thewatermethod May 21, 2024
2a72ac6
Create monthly-delivery-report.sql
GarrettEHill May 21, 2024
802bed9
tolerate empty tables
May 21, 2024
5bf5294
improve comments
May 22, 2024
d80fc55
deploy to dev
thewatermethod May 22, 2024
b99cee8
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2660/activi…
thewatermethod May 22, 2024
be509c9
updated to include collaborators and users that have no activity with…
GarrettEHill May 22, 2024
7724d0c
Merge branch 'main' into TTAHUB-2999/monthly-delivery-report
GarrettEHill May 22, 2024
ba9e93a
address review comments
May 22, 2024
9e7c920
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2530/update…
thewatermethod May 23, 2024
e4ea897
Merge branch mb/TTAHUB-2530/update-RTR-objective-form into mb/TTAHUB-…
thewatermethod May 23, 2024
1871a7d
Deploy to sandbox
thewatermethod May 23, 2024
926435f
Group by 1=1
thewatermethod May 23, 2024
daf15e6
Update monthly-delivery-report.sql
GarrettEHill May 23, 2024
dcf31cb
Fix goal nudge CSS bug
thewatermethod May 24, 2024
6819ba8
Merge branch 'mb/TTAHUB-2530/update-RTR-objective-form' into mb/TTAHU…
thewatermethod May 24, 2024
9bb95e8
Hide objective status on RTR
thewatermethod May 24, 2024
a04b40d
I made a mistake
thewatermethod May 24, 2024
5bc5424
bugfix deletion and relink logic
May 24, 2024
a8dd0f1
Merge pull request #2164 from HHS/mb/remove-extra-known-issue-file
thewatermethod May 24, 2024
4e6887e
Merge branch 'main' into TTAHUB-2560/create_missing_root_causes_on_ars
May 24, 2024
5c6384e
expand comments per PR review
May 24, 2024
703eb79
typo fix
May 24, 2024
5889a3a
Merge branch 'main' into TTAHUB-2999/monthly-delivery-report
GarrettEHill May 24, 2024
c409932
add more comments per PR feedback
May 28, 2024
e0d1b19
Merge pull request #2156 from HHS/TTAHUB-2560/create_missing_root_cau…
hardwarehuman May 28, 2024
ff27199
[TTAHUB-2986]Correct Spanish coursenames with unknown characters
May 28, 2024
80dc858
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2660/activi…
thewatermethod May 28, 2024
1aa8bf0
Rename objective migration
thewatermethod May 28, 2024
db583e7
Merge pull request #2166 from HHS/TTAHUB-2986/correct_spanish_course_…
hardwarehuman May 28, 2024
18743bc
JDI to SSDI
GarrettEHill May 28, 2024
a8d19b4
Fix for bug discovered in adding objective to existing goal
thewatermethod May 28, 2024
84e26c8
Remove console.log
thewatermethod May 28, 2024
67c5dc9
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2530/update…
thewatermethod May 28, 2024
08731ff
Merge branch 'mb/TTAHUB-2530/update-RTR-objective-form' into mb/TTAHU…
thewatermethod May 28, 2024
1293893
Merge pull request #2152 from HHS/mb/TTAHUB-2660/activity-report-upda…
thewatermethod May 28, 2024
bdb0758
Rename migration
thewatermethod May 28, 2024
ce63905
Rename migration
thewatermethod May 28, 2024
218cdff
Rename migration
thewatermethod May 28, 2024
6a4b4c9
Rename migration
thewatermethod May 28, 2024
a1442b5
Merge pull request #2157 from HHS/TTAHUB-2999/monthly-delivery-report
GarrettEHill May 28, 2024
eb7e7f3
Merge pull request #2147 from HHS/mb/TTAHUB-2530/update-RTR-objective…
thewatermethod May 28, 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ parameters:
type: string
dev_git_branch: # change to feature branch to test deployment
description: "Name of github branch that will deploy to dev"
default: "mb/TTAHUB-2857/update-goal-status-logic"
default: "mb/TTAHUB-2660/activity-report-updates-for-reduced-objectives"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "mb/TTAHUB-2609/move-components"
default: "mb/TTAHUB-2530/update-RTR-objective-form"
type: string
prod_new_relic_app_id:
default: "877570491"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ playwright
tests/**/report/*.html
tests/api/report
tests/e2e/report
tests/e2e/test-results
tests/api/test-results

# Ignore /doc => /docs symbolic link created for adr-tools
/doc
Expand Down
2 changes: 1 addition & 1 deletion docs/logical_data_model.encoded

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/logical_data_model.puml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class ActivityReportObjectives{
arOrder : integer : 1
closeSuspendContext : text
closeSuspendReason : enum
objectiveCreatedHere : boolean
status : varchar(255)
supportType : enum
title : text
Expand Down
30 changes: 13 additions & 17 deletions frontend/src/components/FileUploader/FileTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,19 @@ const FileTable = ({ onFileRemoved, files }) => {
{getStatus(file.status)}
</td>
<td>
{file.showDelete
? (
<Button
type="button"
className="smart-hub--file-tag-button"
unstyled
onClick={(e) => {
e.preventDefault();
handleDelete(currentIndex);
}}
>
<span className="fa-sm">
<FontAwesomeIcon color={colors.textInk} icon={faTrash} aria-label={`remove ${file.originalFileName}`} />
</span>
</Button>
)
: null }
<Button
type="button"
className="smart-hub--file-tag-button"
unstyled
onClick={(e) => {
e.preventDefault();
handleDelete(currentIndex);
}}
>
<span className="fa-sm">
<FontAwesomeIcon color={colors.textInk} icon={faTrash} aria-label={`remove ${file.originalFileName}`} />
</span>
</Button>
</td>
</tr>
))}
Expand Down
94 changes: 49 additions & 45 deletions frontend/src/components/GoalCards/GoalCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ObjectiveSwitch.propTypes = {
dispatchStatusChange: PropTypes.func.isRequired,
};

function GoalCard({
export default function GoalCard({
goal,
recipientId,
regionId,
Expand Down Expand Up @@ -100,10 +100,12 @@ function GoalCard({
isReopenedGoal,
} = goal;

const { user } = useContext(UserContext);
const { setIsAppLoading } = useContext(AppLoadingContext);
const [invalidStatusChangeAttempted, setInvalidStatusChangeAttempted] = useState();
const sortedObjectives = [...objectives, ...(sessionObjectives || [])];
sortedObjectives.sort((a, b) => ((new Date(a.endDate) < new Date(b.endDate)) ? 1 : -1));

const hasEditButtonPermissions = canEditOrCreateGoals(user, parseInt(regionId, DECIMAL_BASE));
const {
atLeastOneObjectiveIsNotCompletedOrSuspended,
dispatchStatusChange,
Expand All @@ -123,10 +125,8 @@ function GoalCard({

const goalNumbers = `${goal.goalNumbers.join(', ')}${isReopenedGoal ? '-R' : ''}`;

const { user } = useContext(UserContext);
const { setIsAppLoading } = useContext(AppLoadingContext);

const editLink = `/recipient-tta-records/${recipientId}/region/${regionId}/goals?id[]=${ids.join(',')}`;
const viewLink = `/recipient-tta-records/${recipientId}/region/${regionId}/goals/view?${ids.map((d) => `id[]=${d}`).join('&')}`;

const onUpdateGoalStatus = (newStatus) => {
const statusesThatNeedObjectivesFinished = [
Expand Down Expand Up @@ -154,33 +154,39 @@ function GoalCard({
setObjectivesExpanded(!objectivesExpanded);
};

const hasEditButtonPermissions = canEditOrCreateGoals(user, parseInt(regionId, DECIMAL_BASE));
const determineMenuItems = () => {
// Add reopen button if user has permissions and the goal is closed.
const createdMenuItems = [];
const contextMenuLabel = `Actions for goal ${id}`;

if (goalStatus === 'Closed' && hasEditButtonPermissions) {
createdMenuItems.push({
label: 'Reopen',
onClick: () => {
showReopenGoalModal(id);
},
});
}
const menuItems = [];

// Add edit button if user has permissions or if the goal is closed.
createdMenuItems.push({
label: goalStatus === 'Closed' || !hasEditButtonPermissions ? 'View' : 'Edit',
if (goalStatus === 'Closed' && hasEditButtonPermissions) {
menuItems.push({
label: 'Reopen',
onClick: () => {
showReopenGoalModal(id);
},
});
menuItems.push({
label: 'View',
onClick: () => {
history.push(viewLink);
},
});
} else if (hasEditButtonPermissions) {
menuItems.push({
label: 'Edit',
onClick: () => {
history.push(editLink);
},
});
} else {
menuItems.push({
label: 'View',
onClick: () => {
history.push(viewLink);
},
});
}

return createdMenuItems;
};
const menuItems = determineMenuItems();

const contextMenuLabel = `Actions for goal ${id}`;
const canDeleteQualifiedGoals = (() => {
if (isAdmin(user)) {
return true;
Expand Down Expand Up @@ -218,16 +224,16 @@ function GoalCard({
<div className="display-flex flex-justify">
<div className="display-flex flex-align-start flex-row">
{ !hideCheckbox && (
<Checkbox
id={`goal-select-${id}`}
label=""
value={id}
checked={isChecked}
onChange={handleGoalCheckboxSelect}
aria-label={`Select goal ${goalText}`}
className="margin-right-1"
data-testid="selectGoalTestId"
/>
<Checkbox
id={`goal-select-${id}`}
label=""
value={id}
checked={isChecked}
onChange={handleGoalCheckboxSelect}
aria-label={`Select goal ${goalText}`}
className="margin-right-1"
data-testid="selectGoalTestId"
/>
)}
<GoalStatusDropdown
showReadOnlyStatus={showReadOnlyStatus}
Expand All @@ -239,11 +245,11 @@ function GoalCard({
/>
</div>
{ !hideGoalOptions && (
<ContextMenu
label={contextMenuLabel}
menuItems={menuItems}
menuWidthOffset={100}
/>
<ContextMenu
label={contextMenuLabel}
menuItems={menuItems}
menuWidthOffset={100}
/>
)}
</div>
<GoalStatusChangeAlert
Expand All @@ -258,9 +264,9 @@ function GoalCard({
{' '}
{goalNumbers}
{isMerged && (
<Tag className="margin-left-1 text-ink text-normal" background={colors.baseLighter}>
Merged
</Tag>
<Tag className="margin-left-1 text-ink text-normal" background={colors.baseLighter}>
Merged
</Tag>
)}
</h3>
<p className="text-wrap usa-prose margin-y-0">
Expand Down Expand Up @@ -356,5 +362,3 @@ GoalCard.defaultProps = {
hideGoalOptions: false,
erroneouslySelected: false,
};

export default GoalCard;
43 changes: 11 additions & 32 deletions frontend/src/components/GoalForm/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { uniq } from 'lodash';
import {
Alert, FormGroup,
Alert,
} from '@trussworks/react-uswds';
import ObjectiveForm from './ObjectiveForm';
import PlusButton from './PlusButton';
Expand All @@ -16,11 +16,12 @@ import {
} from './constants';
import AppLoadingContext from '../../AppLoadingContext';
import './Form.scss';
import ReadOnlyField from '../ReadOnlyField';
import GoalName from './GoalName';
import RTRGoalSource from './RTRGoalSource';
import FormFieldThatIsSometimesReadOnly from './FormFieldThatIsSometimesReadOnly';
import RTRGoalPrompts from './RTRGoalPrompts';
import ReadOnlyGoalCollaborators from '../ReadOnlyGoalCollaborators';
import GoalFormTitle from './GoalFormTitle';

export const BEFORE_OBJECTIVES_CREATE_GOAL = 'Enter a goal before adding an objective';
export const BEFORE_OBJECTIVES_SELECT_RECIPIENTS = 'Select a grant number before adding an objective';
Expand All @@ -44,7 +45,6 @@ export default function Form({
objectives,
setObjectives,
setObjectiveError,
topicOptions,
isOnApprovedReport,
isOnReport,
isCurated,
Expand All @@ -54,7 +54,6 @@ export default function Form({
fetchError,
goalNumbers,
clearEmptyObjectiveError,
onUploadFiles,
userCanEdit,
source,
setSource,
Expand Down Expand Up @@ -101,17 +100,16 @@ export default function Form({
};

const objectiveErrors = errors[FORM_FIELD_INDEXES.OBJECTIVES];

const formTitle = goalNumbers && goalNumbers.length ? `Goal ${goalNumbers.join(', ')}${isReopenedGoal ? '-R' : ''}` : 'Recipient TTA goal';

const showAlert = isOnReport && status !== 'Closed';

const notClosedWithEditPermission = (() => (status !== 'Closed' && userCanEdit))();
return (
<div className="ttahub-create-goals-form">
{ fetchError ? <Alert type="error" role="alert">{ fetchError }</Alert> : null}
<div className="display-flex flex-align-center margin-top-2 margin-bottom-1">
<h2 className="margin-0">{formTitle}</h2>
<GoalFormTitle
goalNumbers={goalNumbers}
isReopenedGoal={isReopenedGoal}
/>
{ status.toLowerCase() === 'draft'
&& (
<span className="usa-tag smart-hub--table-tag-status smart-hub--status-draft padding-x-105 padding-y-1 margin-left-2">Draft</span>
Expand All @@ -134,22 +132,9 @@ export default function Form({

<h3 className="margin-top-4 margin-bottom-3">Goal summary</h3>

{collaborators.length > 0 ? collaborators.map((collaborator) => {
const {
goalCreatorName,
goalCreatorRoles,
goalNumber,
} = collaborator;
if (!goalCreatorName) return null;
return (
<FormGroup key={goalNumber}>
<ReadOnlyField label={`Entered by${collaborators.length > 1 ? ` (${goalNumber})` : ''}`}>
{goalCreatorName}
{goalCreatorRoles ? `, ${goalCreatorRoles}` : ''}
</ReadOnlyField>
</FormGroup>
);
}) : null}
<ReadOnlyGoalCollaborators
collaborators={collaborators}
/>

<GrantSelect
selectedGrants={selectedGrants}
Expand Down Expand Up @@ -197,6 +182,7 @@ export default function Form({
status !== 'Closed',
createdVia !== 'tr',
userCanEdit,
!isOnApprovedReport,
]}
label="Goal source"
value={uniq(Object.values(source || {})).join(', ') || ''}
Expand Down Expand Up @@ -238,8 +224,6 @@ export default function Form({
// that way we don't get the white screen of death
errors={objectiveErrors[i] || OBJECTIVE_DEFAULT_ERRORS}
setObjective={(data) => setObjective(data, i)}
topicOptions={topicOptions}
onUploadFiles={onUploadFiles}
goalStatus={status}
userCanEdit={userCanEdit}
/>
Expand Down Expand Up @@ -302,10 +286,6 @@ Form.propTypes = {
endDate: PropTypes.string,
setEndDate: PropTypes.func.isRequired,
setObjectives: PropTypes.func.isRequired,
topicOptions: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.string,
value: PropTypes.number,
})).isRequired,
objectives: PropTypes.arrayOf(PropTypes.shape({
objective: PropTypes.string,
topics: PropTypes.arrayOf(PropTypes.shape({
Expand All @@ -325,7 +305,6 @@ Form.propTypes = {
[PropTypes.string, PropTypes.arrayOf(PropTypes.string)],
).isRequired,
clearEmptyObjectiveError: PropTypes.func.isRequired,
onUploadFiles: PropTypes.func.isRequired,
validateGoalNameAndRecipients: PropTypes.func.isRequired,
userCanEdit: PropTypes.bool,
prompts: PropTypes.shape({
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/components/GoalForm/GoalFormTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';

const GoalFormTitle = ({ goalNumbers, isReopenedGoal }) => {
const formTitle = goalNumbers && goalNumbers.length ? `Goal ${goalNumbers.join(', ')}${isReopenedGoal ? '-R' : ''}` : 'Recipient TTA goal';
return (
<h2 className="font-serif-xl margin-0">{formTitle}</h2>
);
};

GoalFormTitle.propTypes = {
goalNumbers: PropTypes.arrayOf(PropTypes.string),
isReopenedGoal: PropTypes.bool,
};

GoalFormTitle.defaultProps = {
goalNumbers: [],
isReopenedGoal: false,
};

export default GoalFormTitle;
6 changes: 4 additions & 2 deletions frontend/src/components/GoalForm/GoalNudge.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export default function GoalNudge({

// what a hack
const checkboxZed = similar.length && !useOhsInitiativeGoal && !dismissSimilar ? 'z-bottom' : '';
const showOhsInitiativeGoalCheckbox = goalTemplates && goalTemplates.length > 0;
const buttonGroupFlex = showOhsInitiativeGoalCheckbox ? 'flex-justify' : 'flex-justify-end';

return (
<div className="ttahub-goal-nudge--container position-relative margin-bottom-3">
Expand All @@ -131,8 +133,8 @@ export default function GoalNudge({
onSelectNudgedGoal={onSelectNudgedGoal}
initiativeRef={initiativeRef}
/>
<div className="desktop:display-flex flex-justify margin-top-1 smart-hub-maxw-form-field">
{ (goalTemplates && goalTemplates.length > 0) && (
<div className={`desktop:display-flex ${buttonGroupFlex} margin-top-1 smart-hub-maxw-form-field`}>
{ (showOhsInitiativeGoalCheckbox) && (
<Checkbox
id="use-ohs-initiative-goal"
name="use-ohs-initiative-goal"
Expand Down
Loading