Bug 200134 - results.webkit.org: Add switch to filter results by expectation
Summary: results.webkit.org: Add switch to filter results by expectation
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
Keywords: InRadar
Depends on:
Reported: 2019-07-25 12:53 PDT by Jonathan Bedard
Modified: 2019-07-29 09:27 PDT (History)
6 users (show)

See Also:

Patch (9.50 KB, patch)
2019-07-25 13:02 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (9.60 KB, patch)
2019-07-26 12:50 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (9.55 KB, patch)
2019-07-26 13:55 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2019-07-25 12:53:08 PDT
Users of the results database should be able to filter results by whether or not a negative expectation is expected or not. In an effort to support this, we also need to re-write the descriptions in the Legend so that they the descriptions match what the timeline is displaying.
Comment 1 Jonathan Bedard 2019-07-25 13:02:53 PDT
Created attachment 374899 [details]
Comment 2 Aakash Jain 2019-07-26 11:20:47 PDT
Zhifei, can you please review this one?
Comment 3 Zhifei Fang 2019-07-26 11:53:15 PDT
Comment on attachment 374899 [details]

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;
                    willFilterExpected = false;
                if (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 class="item">
                <div class="dot failed"></div>
                ${LegnedLabel(updateLabelsEs, plural ? 'Some tests unexpectedly failed' : 'Unexpectedly failed', plural ? 'Some tests failed' : 'Test failed')}
            <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 class="item">
                <div class="dot crash"></div>
                ${LegnedLabel(updateLabelsEs, plural ? 'Some tests unexpectedly crashed' : 'Unexpectedly crashed', plural ? 'Some tests crashed' : 'Test crashed')}

    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>
    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
Comment 4 Jonathan Bedard 2019-07-26 12:50:59 PDT
Created attachment 374982 [details]
Comment 5 Zhifei Fang 2019-07-26 13:35:10 PDT
r=me, will need aakashjain to make it real.
Comment 6 Aakash Jain 2019-07-26 13:35:47 PDT
Comment 7 Jonathan Bedard 2019-07-26 13:55:42 PDT
Created attachment 374988 [details]
Comment 8 WebKit Commit Bot 2019-07-26 14:23:39 PDT
Comment on attachment 374988 [details]

Clearing flags on attachment: 374988

Committed r247877: <https://trac.webkit.org/changeset/247877>
Comment 9 WebKit Commit Bot 2019-07-26 14:23:40 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2019-07-29 09:27:28 PDT