Bug 191566 - Web Inspector: add drag+drop for importing Audits and Recordings
Summary: Web Inspector: add drag+drop for importing Audits and Recordings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: WebInspectorAuditTab
Blocks: WebInspectorCanvasTab
  Show dependency treegraph
 
Reported: 2018-11-12 15:01 PST by Devin Rousso
Modified: 2018-11-14 14:03 PST (History)
5 users (show)

See Also:


Attachments
Patch (30.60 KB, patch)
2018-11-12 15:12 PST, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (33.77 KB, patch)
2018-11-14 01:36 PST, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2018-11-12 15:01:25 PST
We already allow users to import Audits and Recordings, so we should make it even easier by allowing drag and drop.
Comment 1 Devin Rousso 2018-11-12 15:12:37 PST
Created attachment 354597 [details]
Patch
Comment 2 Joseph Pecoraro 2018-11-13 17:55:19 PST
Comment on attachment 354597 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=354597&action=review

> Source/WebInspectorUI/UserInterface/Base/FileUtilities.js:26
> +WI.FileUtilities = class FileUtilities {

I don't really like this, but I don't have a good argument against it. The file is already named `FileUtilities` and the methods "saveDataToFile" was clear to me. You can keep it but I'd like to get an idea of when we would want a collection class like this.

> Source/WebInspectorUI/UserInterface/Base/FileUtilities.js:85
> +    static getText(file, callback)

How do we not have tests for these? Maybe thats okay, we can get to it later.

> Source/WebInspectorUI/UserInterface/Views/AuditTabContentView.js:126
> +        WI.FileUtilities.getText(event.dataTransfer.files[0], (data, filename) => {

What if someone drops multiple files? We seem to only get the first.

> Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js:254
> +    _handleImportButtonNavigationItemClicked(event) {

Style: brace on newline.

> Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js:257
> +        WI.FileUtilities.import((data, filename) => {
> +            WI.auditManager.processImportedFile(data, filename);
> +        });

r- the CanvasOverview should not tell the audit manager to import.

Seems this should just be `WI.canvasManager.processImportedFile(...)`.

> Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js:50
> +        let importButtonNavigationItem = new WI.ButtonNavigationItem("audit-import", WI.UIString("Import"), "Images/Import.svg", 15, 15);

CanvasSidebar with "audit-import" on the button navigation item? Seems wrong.
Comment 3 Devin Rousso 2018-11-14 00:56:09 PST
Comment on attachment 354597 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=354597&action=review

>> Source/WebInspectorUI/UserInterface/Base/FileUtilities.js:26
>> +WI.FileUtilities = class FileUtilities {
> 
> I don't really like this, but I don't have a good argument against it. The file is already named `FileUtilities` and the methods "saveDataToFile" was clear to me. You can keep it but I'd like to get an idea of when we would want a collection class like this.

I personally find all these "random" functions attached to `WI` to be very confusing, not so much as to what they do, but where I'd find them (e.g. which file).  An example of why this is nice would be to look at Utilities.js, where you have to do a string search for a prototype function because no editor is smart enough to figure out that the additions we add are defined in this file.  Adding `WI.FileUtilities` makes it explicitly clear which file to look in for this (it also matches `WI.ImageUtilities`).

>> Source/WebInspectorUI/UserInterface/Views/CanvasOverviewContentView.js:257
>> +        });
> 
> r- the CanvasOverview should not tell the audit manager to import.
> 
> Seems this should just be `WI.canvasManager.processImportedFile(...)`.

copypasta :P

>> Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js:50
>> +        let importButtonNavigationItem = new WI.ButtonNavigationItem("audit-import", WI.UIString("Import"), "Images/Import.svg", 15, 15);
> 
> CanvasSidebar with "audit-import" on the button navigation item? Seems wrong.

copypasta :P
Comment 4 Devin Rousso 2018-11-14 01:36:04 PST
Created attachment 354783 [details]
Patch
Comment 5 Joseph Pecoraro 2018-11-14 13:28:49 PST
Comment on attachment 354783 [details]
Patch

r=me
Comment 6 WebKit Commit Bot 2018-11-14 14:01:12 PST
Comment on attachment 354783 [details]
Patch

Clearing flags on attachment: 354783

Committed r238198: <https://trac.webkit.org/changeset/238198>
Comment 7 WebKit Commit Bot 2018-11-14 14:01:14 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2018-11-14 14:03:31 PST
<rdar://problem/46074573>