ui icon indicating copy to clipboard operation
ui copied to clipboard

feat(org unit tree): allow request customization

Open Mohammer5 opened this issue 4 years ago • 6 comments

This PR adds the possibility to customize the org unit tree requests. It also provides a possible style for our UI components to open up request customization:

A component with an app-runtime dependency exports two versions:

  1. A component that expects a function which can be used to retrieve the required information
  2. A component that wraps the above component and provides the respective functions

Advantages

  1. A third party app can use their own services to fetch additional data, which might be completely decoupled from the dhis2 instance
  2. App-runtime queries can be (more or less) static (more or less: Until queries accept multiple ids, the query must be generated)
  3. Allows to add any kind of potentially weird request behavior (e. g. sequential requests and whatnot)

Disadvantages

  1. Until the app-runtime provides a way to make the refetch function to throw when an error occurs, we need to use the engine's query method directly, which circumvents the use of the caching mechanism (as that one is build into the hook)
    • If we add an option to the hook that allows the behavior describe above, we can use the useDataQuery callback with that option and lazy: true
  2. The implementing app has to make sure that the response is an object
    • and the property on the response for the root data must use the org unit's ID as the key for the org unit data
    • and the property on the response for the individual org units must be organisationUnit

Neutral

  • Apps can re-use the default prop to preserve the original request behavior
    • Do we want to export that behavior instead?

Stories

As there were a lot of stories, I moved them into a folder called __stories__. In my opinion that makes it a lot easier to work on an individual story, but we'll have to talk (or at least agree) on the proposed structure

Mohammer5 avatar Aug 03 '21 09:08 Mohammer5



Test summary

512 0 0 0


Run details

Project ui
Status Passed
Commit 26878161f4
Started Aug 6, 2021 4:03 PM
Ended Aug 6, 2021 4:15 PM
Duration 11:54 💡
OS Linux Ubuntu - 20.04
Browser Electron 89

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Aug 03 '21 10:08 cypress[bot]

I'm converting this PR to a draft as after discussing with @HendrikThePendric we've agreed to implement these changes in the https://github.com/dhis2/approval-app repo.

mediremi avatar Aug 10 '21 13:08 mediremi

Hi!

Due to a lack of activity on this issue over time (180 days) it seems to be stale. If still relevant, please provide information that moves it forward, e.g. additional information, a pull request with suggested changes, or a reason to keep it open.

Any activity will keep it open, otherwise it will be closed automatically in 30 days. Thanks! 🤖

stale[bot] avatar Mar 02 '22 09:03 stale[bot]

keep it open

Mohammer5 avatar Mar 03 '22 08:03 Mohammer5

Hi!

Due to a lack of activity on this issue over time (180 days) it seems to be stale. If still relevant, please provide information that moves it forward, e.g. additional information, a pull request with suggested changes, or a reason to keep it open.

Any activity will keep it open, otherwise it will be closed automatically in 30 days. Thanks! 🤖

stale[bot] avatar Apr 19 '23 18:04 stale[bot]

@HendrikThePendric is this PR of any relevance to you?

Mohammer5 avatar Apr 20 '23 00:04 Mohammer5