Skip to content

Commit

Permalink
Add extension requests to OT requests admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRyanSmith committed Oct 16, 2023
1 parent 71965c7 commit 6b46772
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
23 changes: 20 additions & 3 deletions pages/ot_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from api.converters import stage_to_json_dict
from internals.core_enums import OT_EXTENSION_STAGE_TYPES
from internals.core_models import Stage

from framework import basehandlers
Expand All @@ -28,11 +29,27 @@ class OriginTrialsRequests(basehandlers.FlaskHandler):
def get_template_data(self, **kwargs):
stages_with_requests = Stage.query(
Stage.ot_action_requested == True).fetch()
stages = []
creation_stages = []
extension_stages = []
for stage in stages_with_requests:
stage_dict = stage_to_json_dict(stage)
# Add the request note that is not typically visible to non-admins.
if stage.ot_request_note:
stage_dict['ot_request_note'] = stage.ot_request_note
stages.append(stage_dict)
return {'stages': stages}
# Group up creation and extension requests.
if stage_dict['stage_type'] in OT_EXTENSION_STAGE_TYPES:
# Information will be needed from the original OT stage.
ot_stage = Stage.get_by_id(stage_dict['ot_stage_id'])
ot_stage_dict = stage_to_json_dict(ot_stage)
# Supply both the OT stage and the extension stage.
extension_stages.append({
'ot_stage': ot_stage_dict,
'extension_stage': stage_dict,
})
else:
creation_stages.append(stage_dict)

return {
'creation_stages': creation_stages,
'extension_stages': extension_stages,
}
19 changes: 17 additions & 2 deletions templates/admin/features/ot_requests.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ <h2>Copy row directly into "Trials - Validated" spreadsheet (
</div>
</div>

{% for stage in stages %}
{% for stage in creation_stages %}
<section>
<h3>
Request for: {{stage.ot_display_name}}
Creation request for: {{stage.ot_display_name}}
<span class="tooltip copy-text" style="float:right" title="Copy text to clipboard">
<a href="#" data-tooltip>
<iron-icon icon="chromestatus:content_copy" id="copy-body-{{loop.index}}"></iron-icon>
Expand Down Expand Up @@ -64,6 +64,21 @@ <h4>Additional comments:</h4>
{{stage.ot_request_note}}
</section>
{% endfor %}
{% for stage_info in extension_stages %}
<section>
<h3>
Extension request for: {{stage_info.ot_stage.ot_display_name}}
</h3>
<p>Origin trial ID: {{stage_info.ot_stage.origin_trial_id}}</p>
<br>
<p>Intent to Extend Experiment: {{stage_info.extension_stage.intent_thread_url}}</p>
<br>
<p>New end milestone: {{stage_info.extension_stage.desktop_last}}</p>
<br>
<p>Additional comments: {{stage_info.extension_stage.ot_request_note}}</p>
<br>
</section>
{% endfor %}
{% endblock %}

{% block js %}
Expand Down

0 comments on commit 6b46772

Please sign in to comment.