ROW PTE: TCP Process Automation with Power Automate#248
ROW PTE: TCP Process Automation with Power Automate#248
Conversation
susannegov
left a comment
There was a problem hiding this comment.
Not familiar on the TCP process to fully review it. The CONFIG variable looks okay to me. Everything else I don't have the knowledge (coding/app) to give a good review.
Styling wise I would make sure the contrast between text and background colors follows WCAG AA contrast if using a custom notification for front end users and arguably the console logs as well. I'm making this assumption based on the screenshot of the purple BG with black text font with the nice 🚗 , though the CSS on line 221 did set it to color: 'white' so maybe I am wrong.
Here's a link to a color contrast checker site if you want to play around: https://webaim.org/resources/contrastchecker/
dianamartin
left a comment
There was a problem hiding this comment.
@chiaberry I'd love for you or someone on your team to review this PR.
@ChrispinP Do you have a short gif/mp4 of the page where the process is occuring to see what the user sees?
frankhereford
left a comment
There was a problem hiding this comment.
Thanks for this PR. This is a lot!
I have a couple of thoughts and a request:
-
⚠️ Can you outline the authentication mechanism in use to the web hooks and flow URLs? What system do you use for secrets if any? -
I am concerned about the monolithic file here in terms of readability. Would you consider refactoring this down into individual files that separate out concerns? I am hopeful that will help demonstrate the larger moving parts here and how they interact.
-
I'd recommend opening this PR up to the entire dev team. While they may not all have time to offer individualized feedback, especially on this large of a PR, they will have good instincts on what will not only make this work great now, but stay working into the future. cc @chiaberry @dianamartin
| R: 'https://prod-08.usgovtexas.logic.azure.us:443/workflows/ef368a417608495783f67d5377455950/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Z64x-_80hyVAPgfjjkXCCGJQ0BWn-D-AGwB5r-HUGFw', | ||
| rC: 'https://prod-24.usgovtexas.logic.azure.us:443/workflows/97eb3e24d26d423eb9c96258494dce04/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=zz2BK3y_tYn03Q9E4Se--fml49egWFmt9OkwO3O8v1Q', | ||
| rC1: 'https://prod-35.usgovtexas.logic.azure.us:443/workflows/a4581428a5514eca8a7062a184e567a0/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=ewKkYqb3er_TLgO7ooVT10SHTWeD6M5V869SD7vB17Y', | ||
| iC: 'https://prod-03.usgovtexas.logic.azure.us:443/workflows/9d3c05c5e3c24746a263c8aed6d46f60/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=YpFbJhyA5WHN9ugLC08kWAZfkKYePZ_y9C__JktoYNM', | ||
| iC1: 'https://prod-50.usgovtexas.logic.azure.us:443/workflows/61357f18a97644088256112a4e533c48/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=lWLNzZPLZhOzXzmkwy-BZlCsJbMy9vBf1qx8A3fsj6M', | ||
| ciC1: 'https://prod-62.usgovtexas.logic.azure.us:443/workflows/7448983fcf104882a8fa85052b99eb44/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Mc1xkK-efDZfCC718cPtbQib0C8yO8KMjw2q7gXsdPg', | ||
| U: 'https://prod-61.usgovtexas.logic.azure.us:443/workflows/276b9618f6a144399f09563e0f764ea8/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=80QkHEIAt4SX5dMdIdRf0Y_AcSgtM4yzy8E2JuXt9UA', | ||
| P: 'https://prod-40.usgovtexas.logic.azure.us:443/workflows/0996af8f2d764b7580202f391d20b632/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=WujBv3GLBd3W-MC889WWlh5Jc8dICPLSJhrj8aZEmhg' |
There was a problem hiding this comment.
I'm curious what authentication system is in place here for these URLs. Is there a credential that's being sent back in a cookie? I looked at the code where you use these, and I don't see anything being explicitly added via an Authorization header.
| flowUWebhookUrl: 'https://prod-61.usgovtexas.logic.azure.us:443/workflows/276b9618f6a144399f09563e0f764ea8/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=80QkHEIAt4SX5dMdIdRf0Y_AcSgtM4yzy8E2JuXt9UA', | ||
|
|
||
| // PowerAutomate Flow P webhook URL (checks Knack via custom connector) | ||
| flowPWebhookUrl: 'https://prod-40.usgovtexas.logic.azure.us:443/workflows/0996af8f2d764b7580202f391d20b632/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=WujBv3GLBd3W-MC889WWlh5Jc8dICPLSJhrj8aZEmhg', |
There was a problem hiding this comment.
Can you tell me where these sig values came from? They are not an API key, right?
| .html(` | ||
| <div style="margin-bottom: 12px; font-size: 16px; color: #000000;"> | ||
| Refreshing page in <span id="countdown-seconds" style="font-weight: bold;">${totalSeconds}</span> seconds... | ||
| </div> | ||
| <div id="road-container" style="position: relative; height: 40px; background-color: #555; border-radius: 4px; overflow: hidden; border: 2px solid rgba(255,255,255,0.3);"> | ||
| <div style="position: absolute; width: 100%; height: 100%; background-color: #555;"></div> | ||
| <div style="position: absolute; width: 100%; top: 35%; height: 3%; background: repeating-linear-gradient(to right, #FFD700 0px, #FFD700 8px, transparent 8px, transparent 16px);"></div> | ||
| <div style="position: absolute; width: 100%; top: 62%; height: 3%; background: repeating-linear-gradient(to right, #FFD700 0px, #FFD700 8px, transparent 8px, transparent 16px);"></div> | ||
| <div id="car" style="position: absolute; top: 50%; transform: translateY(-50%) scaleX(-1); left: 0%; font-size: 24px; transition: left 0.3s linear; z-index: 10;"> | ||
| 🚗 | ||
| </div> | ||
| <div style="position: absolute; top: 50%; transform: translateY(-50%) rotate(0deg); right: 4px; z-index: 10;"> | ||
| <div style="position: relative; width: 32px; height: 32px; background: #DC143C; border: 2.5px solid white; border-radius: 3px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.3);"> | ||
| <span style="color: white; font-size: 9px; font-weight: bold; font-family: Arial, sans-serif; line-height: 1; text-align: center;">DONE</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div id="status-message" style="margin-top: 8px; font-size: 16px; opacity: 1; text-align: center; color: #000000; font-weight: 500;"> | ||
| Processing Request | ||
| </div> | ||
| `) |
There was a problem hiding this comment.
This is a lot of very specific HTML to animate a car driving on a road in CSS. Is this in lieu of a completion bar filling up? I would consider reaching for using SVG as a vector graphics format and animating that.
I am not sure that this is going to be long-term maintainable, or even really, clear enough just to grok it. I'm concerned about this application not going through the normal application development process in terms of scoping and design.
If I were asked to modify or enhance this code, the complexity and the lack of structure in the code base -- I'd be considering starting from the ground up due to the significant learning curve that I see in front of me here in this 1K diff.
chiaberry
left a comment
There was a problem hiding this comment.
From what I understand, this PR is adding power automate flows to the forms as well as fancy logging and animated logging.
I am not familiar at all with Power Automate, so its hard for me to give good feedback on its usage here. Where are those workflows defined?
I like the comments above the function defintions, what do you think about renaming the functions to be descriptive, like instead of triggerFlowU name it triggerFlowUpdate, same for the flowUrls. U could be update, iC1 -> intakeCycle1 etc
I am going to tag other devs in the request for review too
| if (secondsLeft >= 20) { | ||
| message = 'Processing Request'; | ||
| } else if (secondsLeft >= 15) { | ||
| message = 'Connecting your Cycle'; | ||
| } else if (secondsLeft >= 10) { | ||
| message = 'Petting Kittens'; | ||
| } else if (secondsLeft >= 5) { | ||
| message = 'Updating your Project'; | ||
| } else if (secondsLeft > 0) { | ||
| message = 'Finalizing Data'; | ||
| } else { | ||
| message = 'Complete!'; | ||
| } |
There was a problem hiding this comment.
What defines these breakpoints? Is everything assured to finish in this time frame? What is "Petting Kittens?"
| pollIntervalMs: 1000, // Check every 1 second initially | ||
| fastPollStartMs: 12000, // Start polling every 1s after 12 seconds | ||
| fastPollIntervalMs: 1000, // Check every 1 second after 12s |
There was a problem hiding this comment.
I think this reads that it starts at a one second interval and then after 12 seconds, switches to a 1 second interval. Can you explain the two tiered approach? I'm curious why this extra complexity is required.

The purpose of this JS is to facilitate automation for the updated TCP Process which includes:
The JS monitors for specific form submits that will trigger a Power Automate Flow via an HTTP Post. When necessary, the JS will pass certain values/parameters to the Flow. Most actions are logged in the console so you can easily follow along as a process is running.
The JS allows us to trigger flows in a way that is more performant and less prone to breaking as each flow has a specific job. With JS we dont have to wait for Knack to index or finish updating a record, we can pass the information we need via JS and runs flows sequentially, in parallel, or pre-fire (before completion) to keep the entire process as close to real-time as possible.
This work was performed in ROW PTE and is now available for testing. Task Issues: #26706 & #26328