FLS-1452 - Form Runner - Retrieve forms from Pre-Award API#218
Draft
wjrm500 wants to merge 15 commits into
Draft
FLS-1452 - Form Runner - Retrieve forms from Pre-Award API#218wjrm500 wants to merge 15 commits into
wjrm500 wants to merge 15 commits into
Conversation
b8bbb87 to
b77035f
Compare
b77035f to
747ff70
Compare
747ff70 to
78d1538
Compare
|
78d1538 to
2fc38ca
Compare
…CacheService getFormConfigurations was used within one of the publishing endpoints to send back all of the forms in the cache to Form Designer so it could display them on its existing forms page. This endpoint has been removed from Runner now and Form Designer is being re-pointed at the Pre-Award API to support this requirement.
The previous name felt overly-specific, given that the API endpoints defined in this file also include ones that are foundational to the application, including for getting form pages and submitting form data. Plus, we're about to remove the publish functionality.
The publish endpoint in Form Runner is used as Form Designer's primary persistence mechanism - each change made to a form in Form Designer will trigger a POST request to the /publish endpoint, updating the form configuration in the Runner's cache. It is also used as a means to allow FAB and Form Designer to offer form previews for forms that are not loaded into the Runner cache on app startup. Thus it is integral to the current functioning of the application, and this commit can very much be considered a potentially breaking change, so it's important that FAB and Form Designer are redirected at Pre-Award before this goes live. Why are we removing it then? It is a component of a flawed system that is being revamped by Live Services as part of our forms re-architecture work. In the future, there will be no need for arbitrary forms to be published into the cache, in order to support persistence or preview. Forms will be stored in a new location - the Pre-Award database - and Form Designer will POST updated form configuration data to a Pre-Award API. And regarding form preview, for a form to even be shown in Form Designer or FAB it must exist in the Pre-Award database, and so rendering it from Form Designer or FAB will be a simple case of requesting the form directly from the Runner, which will get it from the Pre-Award API, with no precursor publish call necessary.
7165790 to
7fc89d8
Compare
… inline logic under server.route call for 'GET /{id}/{path*}'
… inline logic under server.route call for 'POST /{id}/{path*}'
…d inline logic under server.route call for 'POST /{id}/{path*}'
…tions to follow middleware first, routes second pattern
7fc89d8 to
cbe69a5
Compare
Final changes added here including simplifying docstrings, updating route descriptions, removing redundant imports, removing whitespace and moving expressions onto a single line where reasonable to reduce vertical file length
ef8596c to
ee5e4f8
Compare
Currently we have duplicate Redis client configuration code in the private AdapterCacheService method getRedisClient and in the catboxProvider function. The way the code is formatted is also unnecessarily space-consuming. This commit creates a new shared utility function createRedisClient which can be used in both places, and uses concise formatting to reduce lines of code significantly.
ee5e4f8 to
94df3be
Compare
…vice This commit introduces a common interface attribute formStorage on the AdapterCacheService to represent either a Redis client or a Catbox (in-memory) cache client. This enables us to save significant lines of code, where previously we branched off to different functions depending on whether we were using Redis or not, now we can concentrate logic in fewer functions with no branching. We're able to do this because the way we use the two clients is almost identical since we no longer need getKeys functionality. Previously, because the Catbox cache client doesn't have a getKeys utility built-in like Redis, special code was required to keep track of the keys in the cache in the case of Catbox.
We are going to fetch forms from the Pre-Award API instead. We need to keep the loading of specific forms to ensure unit tests pass.
This new service facilitates calls to endpoints in the Pre-Award API - the GET /forms/{name}/hash endpoint, and the GET /forms/{name}/published endpoint.
f67c473 to
37eda14
Compare
Logging has become noisy, both in the code and in the console. This commit reduces logging code by passing a string not an object to logger calls, and reduces logging noise in the console by switching away from using the request logger, which introduces the 'req' object into every log message, which is noisy and duplicative, especially given that we log the request path upstream.
37eda14 to
46c0fdf
Compare
All of the work we've done has been leading up to this point! In this commit we introduce two new methods into the AdapterCacheService - validateCachedForm and fetchAndCacheForm. These are then used in a revamped getAdapterFormModel. Now, instead of simply looking in the cache, which is no longer in itself sufficient as we don't preload the cache on app startup, we check the cache for the form, if it's not there we go and fetch it from the Pre-Award API and cache it, and if it IS there, then we check to make sure that it hasn't been updated in Pre-Award by comparing the hashed form configurations. Session management is unaffected.
46c0fdf to
6d55b33
Compare
Divides the cache into draft and published namespaces. Introduces a new preview parameter to control access to these namespaces. Removes all publish calls from Designer server. This is just a holding commit to get the stuff onto the draft PR in GitHub, but the plan is to rebase the changes back into the commit lineage, potentially re-ordering, so that it all makes more sense as a narrative.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



🎫 Ticket
Form Runner - Retrieve forms from Pre-Award API
♻️ Changes