Added templates folder to support app.py for rendering UI - #14524
Conversation
|
Here is the summary of possible violations 😱 DetailsThere are 2 possible violations for not having product prefix.
The end of the violation section. All the stuff below is FYI purposes only. Here is the summary of changes. You are about to add 2 region tags.
This comment is generated by snippet-bot.
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request introduces two new HTML templates, page1.html and page2.html, for a Marketplace Integration UI flow. The feedback suggests improving the forms by replacing hardcoded action paths with Flask's url_for to ensure robust routing, and replacing pre-filled literal default values (PROJECT_ID and SERVICE_ACCOUNT) with the placeholder attribute to prevent accidental submissions of invalid placeholder data.
| <div class="card" style="max-width: 550px;"> | ||
| <h2>Step 1: Generate API</h2> | ||
|
|
||
| <form method="POST" action="/"> |
There was a problem hiding this comment.
Using hardcoded paths like action="/" can break if the application is hosted under a subdirectory or behind a reverse proxy with path-based routing. It is highly recommended to use Flask's url_for to dynamically generate the form action URL.
<form method="POST" action="{{ url_for('generate_api') }}">
|
|
||
| <div class="form-group"> | ||
| <label for="apigee_org">Apigee Organization (APIGEE_ORG)</label> | ||
| <input type="text" name="apigee_org" id="apigee_org" value="PROJECT_ID" required> |
There was a problem hiding this comment.
Using value="PROJECT_ID" pre-fills the input field with a literal placeholder string. If the user submits the form without modifying this field, the application will attempt to use the literal string "PROJECT_ID" as the Apigee organization, leading to API errors. Using the placeholder attribute instead of value ensures the field remains empty by default, allowing the required attribute to prevent accidental submissions of placeholder values.
<input type="text" name="apigee_org" id="apigee_org" placeholder="PROJECT_ID" required>
|
|
||
| <div class="form-group"> | ||
| <label for="service_account">Service Account (For gcloud Impersonation)</label> | ||
| <input type="text" name="service_account" id="service_account" value="SERVICE_ACCOUNT" required> |
There was a problem hiding this comment.
Using value="SERVICE_ACCOUNT" pre-fills the input field with a literal placeholder string. If the user submits the form without modifying this field, the application will attempt to use the literal string "SERVICE_ACCOUNT" as the service account name, which will fail during gcloud impersonation. Using the placeholder attribute instead of value ensures the field remains empty by default, allowing the required attribute to prevent accidental submissions of placeholder values.
<input type="text" name="service_account" id="service_account" placeholder="SERVICE_ACCOUNT" required>
| <a href="{{ url_for('generate_api') }}" class="back-btn">← Back to Step 1</a> | ||
| <h2>Apigee to ALM</h2> | ||
|
|
||
| <form method="POST" action="/deploy"> |
There was a problem hiding this comment.
Using hardcoded paths like action="/deploy" can break if the application is hosted under a subdirectory or behind a reverse proxy with path-based routing. It is highly recommended to use Flask's url_for to dynamically generate the form action URL.
<form method="POST" action="{{ url_for('deploy_page') }}">
Description
Added templates folder to support app.py for rendering UI
Testing
Compliance & Style
Post-Approval Actions