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

feat: add edit sequence route #550

Merged
merged 31 commits into from
Aug 9, 2023
Merged

feat: add edit sequence route #550

merged 31 commits into from
Aug 9, 2023

Conversation

ismay
Copy link
Contributor

@ismay ismay commented Jul 19, 2023

https://dhis2.atlassian.net/browse/DHIS2-15668

This adds the scheduler edit sequence route. For testing:

  • locally the route is http://localhost:3000/#/edit-sequence/{sequence-id}.
  • On debug 2.40 I've created a sequence and a couple jobs for testing: http://localhost:3000/#/edit-sequence/RWcaltWoKuN.
  • Since the sequence gets its id from the first job, any sequence that has job 1 as the first job will have that id.

Note that the some of the patterns used are things we might want to refactor later. I've stuck with the existing approach to maintain the consistency of the code until then.

Todo

  • Resize observer crash
  • Discard form state lifting (maybe remove discard button from outside of form)
  • Remove outdated comments
  • Check missing elements compared to edit job route (details area, etc.)
  • Update tests
    • Delete sequence modal
    • Delete sequence button
    • SequenceEditForm
    • SequenceEditFormContainer
  • Check necessity of initialValues reduce (replace with simpler approach)

Backend

Follow up

@ismay ismay force-pushed the add-edit-sequence-route branch from 3f74f67 to e085a9c Compare July 19, 2023 13:11
@dhis2-bot
Copy link
Contributor

dhis2-bot commented Jul 19, 2023

🚀 Deployed on https://pr-550--dhis2-scheduler.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify July 19, 2023 13:13 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 19, 2023 14:23 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch from 53d142f to 2e1a254 Compare July 19, 2023 14:26
@dhis2-bot dhis2-bot temporarily deployed to netlify July 19, 2023 14:28 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 20, 2023 13:58 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch from 86f61cb to f920404 Compare July 20, 2023 14:05
@dhis2-bot dhis2-bot temporarily deployed to netlify July 20, 2023 14:07 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 25, 2023 07:58 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 26, 2023 09:54 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 26, 2023 14:08 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch from 15aa5b6 to 340ba49 Compare July 26, 2023 14:11
@dhis2-bot dhis2-bot temporarily deployed to netlify July 26, 2023 14:15 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 27, 2023 09:36 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch from 7affec5 to c356e7a Compare July 27, 2023 09:42
@dhis2-bot dhis2-bot temporarily deployed to netlify July 27, 2023 09:44 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch from c356e7a to 76a4321 Compare July 27, 2023 09:49
@dhis2-bot dhis2-bot temporarily deployed to netlify July 27, 2023 09:51 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch 2 times, most recently from b7b9d36 to 0d5df1b Compare July 27, 2023 15:11
@dhis2-bot dhis2-bot temporarily deployed to netlify July 27, 2023 15:13 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 27, 2023 15:22 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 1, 2023 15:18 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 2, 2023 09:04 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 2, 2023 10:23 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 2, 2023 15:37 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 2, 2023 15:40 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch 2 times, most recently from 8280edc to 30ae67e Compare August 2, 2023 15:53
@ismay ismay force-pushed the add-edit-sequence-route branch from 30ae67e to 3618816 Compare August 2, 2023 15:54
@ismay ismay marked this pull request as ready for review August 2, 2023 15:54
@ismay ismay requested review from a team as code owners August 2, 2023 15:54
@dhis2-bot dhis2-bot temporarily deployed to netlify August 2, 2023 15:55 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 3, 2023 07:53 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 3, 2023 12:55 Inactive
@tomzemp tomzemp self-requested a review August 8, 2023 12:19
@dhis2-bot dhis2-bot temporarily deployed to netlify August 8, 2023 15:19 Inactive
@ismay ismay force-pushed the add-edit-sequence-route branch from 37d4c63 to 9a1c5c2 Compare August 8, 2023 15:24
@dhis2-bot dhis2-bot temporarily deployed to netlify August 8, 2023 15:26 Inactive
@ismay
Copy link
Contributor Author

ismay commented Aug 9, 2023

Btw. @tomzemp, for testing I recommend debug/dev. Hella found out that 2.40 has a bug that has been resolved in dev.

Copy link

@helladawit helladawit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successful on version 2.41

@ismay
Copy link
Contributor Author

ismay commented Aug 9, 2023

Also @tomzemp, if you want to test the UI:

And then you'll have a new sequence to edit

Copy link
Member

@tomzemp tomzemp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I don't have many line-by-line comments, but a couple of things I noticed / had questions about:

  • Clicking edit for a sequence from the overview scheduled jobs list sends you to the edit job page, rather than the edit-sequence page. I assume that's going to be changed later?
  • the useJobScheduleById hook only seems to be used for the job sequences, so would it make sense to rename to useJobSequenceById?
  • the useJobSchedules hook is reassigning the id of the first job to the overall schedule (I understand this is a workaround for the fact that the backend isn't creating an id for the overall sequence/schedule), but this has the effect of making schedules with only one job accessible from the edit-sequence page. Maybe if useJobScheduleById becomes more explicitly for sequences, it should have logic to return an error if the sequence only has one job (in which case, it wouldn't be a sequence but a job)?

src/pages/SequenceEdit/SequenceEdit.js Show resolved Hide resolved
@ismay
Copy link
Contributor Author

ismay commented Aug 9, 2023

Thanks!

  • Clicking edit for a sequence from the overview scheduled jobs list sends you to the edit job page, rather than the edit-sequence page. I assume that's going to be changed later?

Definitely. When updating the list view I'll update the edit button for sequences as well.

  • the useJobScheduleById hook only seems to be used for the job sequences, so would it make sense to rename to useJobSequenceById?

Yeah the wording is a bit messed up atm. I created this issue for it: https://dhis2.atlassian.net/browse/DHIS2-15671. I could tackle that before merging.

  • the useJobSchedules hook is reassigning the id of the first job to the overall schedule (I understand this is a workaround for the fact that the backend isn't creating an id for the overall sequence/schedule), but this has the effect of making schedules with only one job accessible from the edit-sequence page. Maybe if useJobScheduleById becomes more explicitly for sequences, it should have logic to return an error if the sequence only has one job (in which case, it wouldn't be a sequence but a job)?

Yeah this is a bit confusing conceptually. So the schedules are a mix of jobs and queues. A schedule with one item in the sequence is a job, and a schedule with multiple items in the sequence is a queue. Conceptually schedules are there for both jobs and queues. The idea being that it simplifies displaying both types in the overview. I've collected this and other api quirks I've encountered so far here: https://dhis2.atlassian.net/browse/DHIS2-15669. Let me know what you think of that.

@ismay ismay merged commit d5fa50c into master Aug 9, 2023
@ismay ismay deleted the add-edit-sequence-route branch August 9, 2023 15:16
@ismay
Copy link
Contributor Author

ismay commented Aug 9, 2023

Thanks for the review @helladawit & @tomzemp

dhis2-bot added a commit that referenced this pull request Aug 9, 2023
# [101.2.0](v101.1.6...v101.2.0) (2023-08-09)

### Features

* add edit sequence route ([#550](#550)) ([d5fa50c](d5fa50c))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 101.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants