Summary: | results.webkit.org: Add switch to filter results by expectation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jonathan Bedard <jbedard> | ||||||||
Component: | Tools / Tests | Assignee: | Jonathan Bedard <jbedard> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | aakash_jain, commit-queue, dewei_zhu, ryanhaddad, tsavell, zhifei_fang | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Jonathan Bedard
2019-07-25 12:53:08 PDT
Created attachment 374899 [details]
Patch
Zhifei, can you please review this one? Comment on attachment 374899 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374899&action=review > Tools/resultsdbpy/resultsdbpy/view/static/js/timeline.js:612 > + const successLabel = REF.createRef({ You can make all this ref and <div class="label" ref="${...}"></div> to a function, so that you don't need to repeatedly create the ref. You can use an event to let sub component update its state: function LegnedLabel(event, willFilterExpected, filterExpectedText, filterUnexpectedText) { const ref = REF.createRef({ state: willFilterExpected, onStateUpdate: (element, state) => { if (state) element.innerText = filterExpectedText; else element.innerText = filterUnExpectedText; } }); event.action((willFilterExpected) => ref.setState(willFilterExpected)); return '<div class="label" ref="${ref}"></div>'; } then in legend function Legend(callback=null, plural=false) { let updateLabelsEs = new EventStream(); const swtch = REF.createRef({ onElementMount: (element) => { element.onchange = () => { if (element.checked) willFilterExpected = true; else willFilterExpected = false; updateLabelsEs.add(willFilterExpected); if (callback) callback(); }; }, }); let result = `<br> <div class="lengend timeline"> <div class="item"> <div class="dot success"></div> ${LegnedLabel(updateLabelsEs, plural ? 'No unexpected results' : 'Result expected', plural ? 'All tests passed' : 'Test passed')} </div> <div class="item"> <div class="dot failed"></div> ${LegnedLabel(updateLabelsEs, plural ? 'Some tests unexpectedly failed' : 'Unexpectedly failed', plural ? 'Some tests failed' : 'Test failed')} </div> <div class="item"> <div class="dot timeout"></div> ${LegnedLabel(updateLabelsEs, plural ? 'Some tests unexpectedly timed out' : 'Unexpectedly timed out', plural ? 'Some tests timed out' : 'Test timed out')} </div> <div class="item"> <div class="dot crash"></div> ${LegnedLabel(updateLabelsEs, plural ? 'Some tests unexpectedly crashed' : 'Unexpectedly crashed', plural ? 'Some tests crashed' : 'Test crashed')} </div> <br> </div>`; if (callback) result += `<div class="input" style="width:400px"> <label>Filter expected results</label> <label class="switch"> <input type="checkbox"${willFilterExpected ? ' checked': ''} ref="${swtch}"> <span class="slider"></span> </label> </div>`; return `<div class="content">${result}</div><br>`; } > Tools/resultsdbpy/resultsdbpy/view/static/js/timeline.js:616 > + element.innerHTML = plural ? 'No unexpected results' : 'Result expected'; Use innerText, since we don't need to render any HTML here. > Tools/resultsdbpy/resultsdbpy/view/static/js/timeline.js:659 > + callback(); We need to check if callback is null before call it Created attachment 374982 [details]
Patch
r=me, will need aakashjain to make it real. rs=me Created attachment 374988 [details]
Patch
Comment on attachment 374988 [details] Patch Clearing flags on attachment: 374988 Committed r247877: <https://trac.webkit.org/changeset/247877> All reviewed patches have been landed. Closing bug. |