Skip to content

Commit

Permalink
OT Extension: display warning dialog if intent thread URL not found (#…
Browse files Browse the repository at this point in the history
…3900)

* Display warning dialog if intent thread not found

* wording change

* lowercase "S"

* lint-fix
  • Loading branch information
DanielRyanSmith committed May 22, 2024
1 parent 1497345 commit 4422f17
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
6 changes: 3 additions & 3 deletions client-src/elements/chromedash-feature-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ class ChromedashFeatureDetail extends LitElement {
}
openFinalizeExtensionDialog(
this.feature.id,
extensionStage,
extensionStage.id,
extensionStage.desktop_last,
dialogTypes.FINALIZE_EXTENSION
Expand Down Expand Up @@ -701,7 +702,7 @@ class ChromedashFeatureDetail extends LitElement {
@click=${() =>
openFinalizeExtensionDialog(
this.feature.id,
extensionStage.id,
extensionStage,
extensionStage.desktop_last,
dialogTypes.FINALIZE_EXTENSION
)}
Expand Down Expand Up @@ -809,12 +810,11 @@ class ChromedashFeatureDetail extends LitElement {
</sl-tooltip>`;
// Display the creation request button if user has edit access.
} else if (canSeeOTControls) {
const stageId = feStage.id;
return html` <sl-button
size="small"
variant="primary"
@click="${() =>
openPrereqsDialog(this.feature.id, stageId, dialogTypes.CREATION)}"
openPrereqsDialog(this.feature.id, feStage, dialogTypes.CREATION)}"
>Request Trial Creation</sl-button
>`;
}
Expand Down
43 changes: 29 additions & 14 deletions client-src/elements/chromedash-ot-prereqs-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -44,34 +44,34 @@ 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);
await dialogEl.updateComplete;
}
dialogEl.dialogType = dialogType;
currentFeatureId = featureId;
currentStageId = stageId;
currentStageId = stage.id;
dialogEl.show();
}

class ChromedashOTPrereqsDialog extends LitElement {
static get properties() {
return {
featureId: {type: Number},
stageId: {type: Number},
stage: {type: Object},
milestone: {type: Number},
dialogType: {type: Number},
};
Expand All @@ -80,7 +80,7 @@ class ChromedashOTPrereqsDialog extends LitElement {
constructor() {
super();
this.featureId = 0;
this.stageId = 0;
this.stage = {};
this.milestone = 0;
this.dialogType = 0;
}
Expand Down Expand Up @@ -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(() => {
Expand All @@ -140,7 +140,22 @@ class ChromedashOTPrereqsDialog extends LitElement {
});
}

renderThreadMissingDialog() {
return html`<sl-dialog label="Intent thread not found">
<p>
LGTMs have been detected for this trial extension, but
<strong>no intent thread link has been detected or provided</strong>.
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.
</p>
</sl-dialog>`;
}

renderFinalizeExtensionDialog() {
if (!this.stage.intent_thread_url) {
return this.renderThreadMissingDialog();
}
return html` <sl-dialog label="Finalize trial extension">
<p>
LGTMs have been detected for this trial extension. This origin trial
Expand All @@ -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</sl-button
>
Expand All @@ -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</sl-button
Expand Down Expand Up @@ -264,7 +279,7 @@ class ChromedashOTPrereqsDialog extends LitElement {
variant="primary"
@click=${() =>
location.assign(
`/ot_creation_request/${this.featureId}/${this.stageId}`
`/ot_creation_request/${this.featureId}/${this.stage.id}`
)}
size="small"
>Proceed</sl-button
Expand Down

0 comments on commit 4422f17

Please sign in to comment.