From 4422f17235141ff1a841c8b26a829e8672e44925 Mon Sep 17 00:00:00 2001 From: Daniel Smith <56164590+DanielRyanSmith@users.noreply.github.com> Date: Wed, 22 May 2024 13:57:06 -0700 Subject: [PATCH] OT Extension: display warning dialog if intent thread URL not found (#3900) * Display warning dialog if intent thread not found * wording change * lowercase "S" * lint-fix --- .../elements/chromedash-feature-detail.js | 6 +-- .../elements/chromedash-ot-prereqs-dialog.js | 43 +++++++++++++------ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/client-src/elements/chromedash-feature-detail.js b/client-src/elements/chromedash-feature-detail.js index c6f74feab24..09e62682deb 100644 --- a/client-src/elements/chromedash-feature-detail.js +++ b/client-src/elements/chromedash-feature-detail.js @@ -255,6 +255,7 @@ class ChromedashFeatureDetail extends LitElement { } openFinalizeExtensionDialog( this.feature.id, + extensionStage, extensionStage.id, extensionStage.desktop_last, dialogTypes.FINALIZE_EXTENSION @@ -701,7 +702,7 @@ class ChromedashFeatureDetail extends LitElement { @click=${() => openFinalizeExtensionDialog( this.feature.id, - extensionStage.id, + extensionStage, extensionStage.desktop_last, dialogTypes.FINALIZE_EXTENSION )} @@ -809,12 +810,11 @@ class ChromedashFeatureDetail extends LitElement { `; // Display the creation request button if user has edit access. } else if (canSeeOTControls) { - const stageId = feStage.id; return html` Request Trial Creation`; } diff --git a/client-src/elements/chromedash-ot-prereqs-dialog.js b/client-src/elements/chromedash-ot-prereqs-dialog.js index b6d331ad480..23269fb2b43 100644 --- a/client-src/elements/chromedash-ot-prereqs-dialog.js +++ b/client-src/elements/chromedash-ot-prereqs-dialog.js @@ -14,21 +14,21 @@ export const dialogTypes = { FINALIZE_EXTENSION: 4, }; -export async function openPrereqsDialog(featureId, stageId, dialogType) { +export async function openPrereqsDialog(featureId, stage, dialogType) { if ( !dialogEl || currentFeatureId !== featureId || - currentStageId !== stageId + currentStageId !== stage.id ) { dialogEl = document.createElement('chromedash-ot-prereqs-dialog'); dialogEl.featureId = featureId; - dialogEl.stageId = stageId; + dialogEl.stage = stage; dialogEl.dialogType = dialogType; document.body.appendChild(dialogEl); await dialogEl.updateComplete; } currentFeatureId = featureId; - currentStageId = stageId; + currentStageId = stage.id; dialogEl.show(); } @@ -44,18 +44,18 @@ export async function openInfoDialog(dialogType) { export async function openFinalizeExtensionDialog( featureId, - stageId, + stage, milestone, dialogType ) { if ( !dialogEl || currentFeatureId !== featureId || - currentStageId !== stageId + currentStageId !== stage.id ) { dialogEl = document.createElement('chromedash-ot-prereqs-dialog'); dialogEl.featureId = featureId; - dialogEl.stageId = stageId; + dialogEl.stage = stage; dialogEl.dialogType = dialogType; dialogEl.milestone = milestone; document.body.appendChild(dialogEl); @@ -63,7 +63,7 @@ export async function openFinalizeExtensionDialog( } dialogEl.dialogType = dialogType; currentFeatureId = featureId; - currentStageId = stageId; + currentStageId = stage.id; dialogEl.show(); } @@ -71,7 +71,7 @@ class ChromedashOTPrereqsDialog extends LitElement { static get properties() { return { featureId: {type: Number}, - stageId: {type: Number}, + stage: {type: Object}, milestone: {type: Number}, dialogType: {type: Number}, }; @@ -80,7 +80,7 @@ class ChromedashOTPrereqsDialog extends LitElement { constructor() { super(); this.featureId = 0; - this.stageId = 0; + this.stage = {}; this.milestone = 0; this.dialogType = 0; } @@ -126,7 +126,7 @@ class ChromedashOTPrereqsDialog extends LitElement { submitTrialExtension() { window.csClient - .extendOriginTrial(this.featureId, this.stageId) + .extendOriginTrial(this.featureId, this.stage.id) .then(() => { showToastMessage('Extension processed!'); setTimeout(() => { @@ -140,7 +140,22 @@ class ChromedashOTPrereqsDialog extends LitElement { }); } + renderThreadMissingDialog() { + return html` +

+ LGTMs have been detected for this trial extension, but + no intent thread link has been detected or provided. + All extension proposals must be discussed publicly on blink-dev. Please + add the value to the "Intent to Extend Experiment link" field by + selecting "Edit fields" button on your feature's "Origin Trial" section. +

+
`; + } + renderFinalizeExtensionDialog() { + if (!this.stage.intent_thread_url) { + return this.renderThreadMissingDialog(); + } return html`

LGTMs have been detected for this trial extension. This origin trial @@ -162,7 +177,7 @@ class ChromedashOTPrereqsDialog extends LitElement { size="small" @click=${() => location.assign( - `/guide/stage/${this.featureId}/${INTENT_STAGES.INTENT_EXTEND_ORIGIN_TRIAL[0]}/${this.stageId}` + `/guide/stage/${this.featureId}/${INTENT_STAGES.INTENT_EXTEND_ORIGIN_TRIAL[0]}/${this.stage.id}` )} >Change milestone @@ -189,7 +204,7 @@ class ChromedashOTPrereqsDialog extends LitElement { variant="primary" @click=${() => location.assign( - `/ot_extension_request/${this.featureId}/${this.stageId}` + `/ot_extension_request/${this.featureId}/${this.stage.id}` )} size="small" >Proceed location.assign( - `/ot_creation_request/${this.featureId}/${this.stageId}` + `/ot_creation_request/${this.featureId}/${this.stage.id}` )} size="small" >Proceed