Add extension requests to OT requests admin page (#3420)

This commit is contained in:
Daniel Smith 2023-10-17 17:40:20 -07:00 коммит произвёл GitHub
Родитель a4a8d0c348
Коммит 2469c9afc8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 37 добавлений и 5 удалений

Просмотреть файл

@ -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
@ -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,
}

Просмотреть файл

@ -25,10 +25,10 @@
</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>
@ -64,6 +64,21 @@
{{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 %}