-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement soft deletes for crash notes #1540
Changes from all commits
bc4dac1
04e9612
8e34a87
827448a
0d54fd7
98ae099
03fbe30
1cf166a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table public.crash_notes | ||
drop column if exists is_deleted; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
alter table public.crash_notes add column is_deleted bool | ||
not null default false; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const Notes = ({ | |
notes, | ||
INSERT_NOTE, | ||
UPDATE_NOTE, | ||
DELETE_NOTE, | ||
SOFT_DELETE_NOTE, | ||
refetch, | ||
}) => { | ||
// add a state variable to manage value when new note is entered | ||
|
@@ -30,7 +30,7 @@ const Notes = ({ | |
// declare mutation functions | ||
const [addNote] = useMutation(INSERT_NOTE); | ||
const [editNote] = useMutation(UPDATE_NOTE); | ||
const [deleteNote] = useMutation(DELETE_NOTE); | ||
const [deleteNote] = useMutation(SOFT_DELETE_NOTE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah i am very down to remove the note text completely! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, Rose! 🚢 |
||
const fieldConfig = notesDataMap[0]; | ||
|
||
// function to handle add button click | ||
|
@@ -154,8 +154,8 @@ const Notes = ({ | |
{/* display user input row for users with edit permissions*/} | ||
{!isReadOnly(roles) && ( | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
<td /> | ||
<td /> | ||
<td> | ||
<Input | ||
type="textarea" | ||
|
@@ -176,7 +176,7 @@ const Notes = ({ | |
Add | ||
</Button> | ||
</td> | ||
<td></td> | ||
<td /> | ||
</tr> | ||
)} | ||
{/* iterate through each row in notes table */} | ||
|
@@ -222,7 +222,7 @@ const Notes = ({ | |
</td> | ||
) : ( | ||
// else if user has edit permissions and is not editing render empty cell | ||
!isReadOnly(roles) && !isEditing && <td></td> | ||
!isReadOnly(roles) && !isEditing && <td /> | ||
)} | ||
{/* display delete button if row was created by current user, | ||
user has edit permissions, and user is not currently editing */} | ||
|
@@ -234,14 +234,13 @@ const Notes = ({ | |
modalBody={ | ||
<div> | ||
Are you sure you want to delete this note? | ||
<p className="mt-2 text-truncate">{row.text}</p> | ||
</div> | ||
} | ||
/> | ||
</td> | ||
) : ( | ||
// else if user has edit permissions and is not editing render empty cell | ||
!isReadOnly(roles) && !isEditing && <td></td> | ||
!isReadOnly(roles) && !isEditing && <td /> | ||
)} | ||
{/* display save button if user is editing */} | ||
{!isReadOnly(roles) && isEditing && ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ import { UPDATE_CRASH, GET_CRASH } from "../../queries/crashes"; | |
import { | ||
INSERT_NOTE, | ||
UPDATE_NOTE, | ||
DELETE_NOTE, | ||
SOFT_DELETE_NOTE, | ||
} from "../../queries/crashNotes"; | ||
|
||
function Crash(props) { | ||
|
@@ -286,7 +286,7 @@ function Crash(props) { | |
notes={crashRecord?.crash?.crash_notes} | ||
INSERT_NOTE={INSERT_NOTE} | ||
UPDATE_NOTE={UPDATE_NOTE} | ||
DELETE_NOTE={DELETE_NOTE} | ||
SOFT_DELETE_NOTE={SOFT_DELETE_NOTE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i love this kind of detail! |
||
refetch={crashRefetch} | ||
/> | ||
</Col> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀