Uploaded image for project: 'Reference Application'
  1. Reference Application
  2. RA-900

Add a mechanism to fetch all results in angular resources

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Accepted
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Reference Application 2.3
    • Component/s: None
    • Labels:

      Description

      Currently, when you make a REST call to get items from the server, there is a maximum number of results you can get back in a single ajax call, the response you get back actually contains pagination details to fetch either the next or the previous batch in case there are more items. Our angular resources should be smart enough to utilize the next link and be able to make more calls until all the results are returned. Therefore, want to provide a mechanism where all the items get returned within a single call made to an angular resource.

      DEV NOTES:

      • Add a utility function to the uicommons module probably in the angular-common.js file that can fetch all results given an angular resource and optional request parameters, in theory this function should inspect the returned results to get the next link and fetch the next page of results until there are no more results i.e the next link doesn't exist in the returned json. Note that the next link might not be valid if the admin has not yet set the global property value for url prefix for the rest module, if this is the cause you need to default to the current one they have being used in the browser.
      • Update all existing 'get all' functions in the angular apps in the module to delegate to the new function e.g getEncounterTypes in encounterTypeService.js file

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                wyclif Wyclif Luyima
                Reporter:
                wyclif Wyclif Luyima
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: