Skip to content

Commit

Permalink
Remove two-way binnding for triage mode (web-platform-tests#3341)
Browse files Browse the repository at this point in the history
* Remove two-way binnding for triage mode

* Use downward data-binding [[]]

---------

Co-authored-by: Kyle Ju <[email protected]>
  • Loading branch information
KyleJu and Kyle Ju authored Jun 6, 2023
1 parent b84b538 commit 24f02dc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
16 changes: 14 additions & 2 deletions webapp/components/github-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class GitHubLogin extends PolymerElement {
<template is="dom-if" if="[[user]]">
<div class="logged-in">
<template is="dom-if" if="[[showTriage]]">
<paper-toggle-button checked="{{isTriageMode}}" aria-label="Toggle Triage Mode"></paper-toggle-button>
<paper-toggle-button on-click="handleTriageToggle" checked="{{isTriageMode}}" aria-label="Toggle Triage Mode"></paper-toggle-button>
Triage Mode
</template>
<iron-icon class="github-icon" src="/static/github.svg"></iron-icon>
Expand Down Expand Up @@ -80,7 +80,6 @@ class GitHubLogin extends PolymerElement {
},
isTriageMode: {
type: Boolean,
notify: true,
},
showTriage: {
type: Boolean,
Expand All @@ -101,6 +100,19 @@ class GitHubLogin extends PolymerElement {
window.location = url;
}

handleTriageToggle() {
this._fireEvent('triagemode', { val: this.isTriageMode });
}

_fireEvent(eventName, detail) {
const event = new CustomEvent(eventName, {
bubbles: true,
composed: true,
detail,
});
this.dispatchEvent(event);
}

openHelpDialog() {
this.$.dialog.open();
}
Expand Down
3 changes: 1 addition & 2 deletions webapp/components/wpt-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class WPTHeader extends WPTFlags(PolymerElement) {
<a href="/">web-platform-tests dashboard</a>
</h1>
<template is="dom-if" if="[[githubLogin]]">
<github-login user="[[user]]" is-triage-mode="{{isTriageMode}}"></github-login>
<github-login user="[[user]]" is-triage-mode="[[isTriageMode]]"></github-login>
</template>
</div>
Expand Down Expand Up @@ -91,7 +91,6 @@ class WPTHeader extends WPTFlags(PolymerElement) {
user: String,
isTriageMode: {
type: Boolean,
notify: true,
}
};
}
Expand Down
7 changes: 6 additions & 1 deletion webapp/views/wpt-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class WPTApp extends PathInfo(WPTFlags(TestRunsUIBase)) {
<app-location route="{{route}}" url-space-regex="^/(results)/"></app-location>
<app-route route="{{route}}" pattern="/:page" data="{{routeData}}" tail="{{subroute}}"></app-route>
<wpt-header path="[[encodedPath]]" query="[[query]]" user="[[user]]" is-triage-mode="{{isTriageMode}}"></wpt-header>
<wpt-header path="[[encodedPath]]" query="[[query]]" user="[[user]]" is-triage-mode="[[isTriageMode]]"></wpt-header>
<section class="search">
<div class="path">
Expand Down Expand Up @@ -292,6 +292,7 @@ class WPTApp extends PathInfo(WPTFlags(TestRunsUIBase)) {
testSearch.addEventListener('commit', this.handleSearchCommit.bind(this));
testSearch.addEventListener('autocomplete', this.handleSearchAutocomplete.bind(this));
document.addEventListener('keydown', this.handleKeyDown.bind(this));
this.addEventListener('triagemode', this.handleTriageToggle.bind(this));
}

disconnectedCallback() {
Expand Down Expand Up @@ -378,6 +379,10 @@ class WPTApp extends PathInfo(WPTFlags(TestRunsUIBase)) {
this.dismissToast(e);
}

handleTriageToggle(e) {
this.isTriageMode = e.detail.val;
}

computeEditable(queryParams) {
if (queryParams.run_id || 'max-count' in queryParams) {
return false;
Expand Down

0 comments on commit 24f02dc

Please sign in to comment.