Bug 152626 - Web Inspector: Timelines view doesn't remember how I like to sort things
Summary: Web Inspector: Timelines view doesn't remember how I like to sort things
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:
Blocks:
 
Reported: 2015-12-31 14:44 PST by Saam Barati
Modified: 2016-01-06 15:00 PST (History)
9 users (show)

See Also:


Attachments
Patch (19.91 KB, patch)
2015-12-31 21:25 PST, Devin Rousso
bburg: review+
Details | Formatted Diff | Diff
Patch (13.87 KB, patch)
2016-01-04 17:11 PST, Devin Rousso
joepeck: review+
Details | Formatted Diff | Diff
Patch (13.77 KB, patch)
2016-01-04 21: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 Saam Barati 2015-12-31 14:44:57 PST
I like to sort things by "Total Time". But, every time I open/close or just refresh the inspector, it defaults to sorting things by "Start Time".
It would be nice if this preference was remembered.
Comment 1 Radar WebKit Bug Importer 2015-12-31 14:45:11 PST
<rdar://problem/24029666>
Comment 2 Devin Rousso 2015-12-31 21:25:32 PST
Created attachment 268068 [details]
Patch
Comment 3 Devin Rousso 2015-12-31 21:26:11 PST
Oh crap sorry @Matt I didn't notice that this was assigned to you.  My bad.
Comment 4 Matt Baker 2015-12-31 22:30:50 PST
No problem.
Comment 5 BJ Burg 2016-01-01 19:47:43 PST
Comment on attachment 268068 [details]
Patch

r=me

In general I would prefer to give each data grid a well-known id, and let it handle the details of saving to a setting. However, there are no other uses for such an identifier (CSS id comes to mind), so this approach is fine for the time being.
Comment 6 Joseph Pecoraro 2016-01-04 13:46:31 PST
Comment on attachment 268068 [details]
Patch

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

Some comments above. I don't think any immediate concerns though, but long term they should be addressed.

> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:809
> -        var dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, flatValues);
> +        let dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, flatValues, "console-message-view-sort");

This one may be a bit too general. Each `console.table` will have a new Setting with the same conflicting identifier, which would cause conflicts. Not to mention each console.table saving some value to persistent storage if the user changes the sort.

Might be best to not include a setting here, or having it just be a Temporary / In Memory Only Setting. (Maybe a new WebInspector.Setting subclass).

> Source/WebInspectorUI/UserInterface/Views/DatabaseTableContentView.js:89
> -            this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
> +            this._dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values, "database-table-content-view-sort");

Same here. Unless we wanted to make the identifier more specific, "database-table-content-view-sort-{table-name}". But still, this might be overkill.
Comment 7 Devin Rousso 2016-01-04 17:11:20 PST
Created attachment 268251 [details]
Patch

So I reverted some of the changes to make it so that the setting object is "optional", in that the DataGrid will still work without it.
Comment 8 Joseph Pecoraro 2016-01-04 18:35:50 PST
Comment on attachment 268251 [details]
Patch

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

r=me!

> Source/WebInspectorUI/UserInterface/Views/DataGrid.js:238
> +        if (this.sortColumnIdentifier) {
> +            let newSortHeaderCellElement = this._headerTableCellElements.get(this.sortColumnIdentifier);

Since the getter now does nothing these two lines can just access the instance variable directly (_sortColumnIdentifier).
Comment 9 Devin Rousso 2016-01-04 21:36:48 PST
Created attachment 268267 [details]
Patch

(In reply to comment #8)
> > Source/WebInspectorUI/UserInterface/Views/DataGrid.js:238
> > +        if (this.sortColumnIdentifier) {
> > +            let newSortHeaderCellElement = this._headerTableCellElements.get(this.sortColumnIdentifier);
> 
> Since the getter now does nothing these two lines can just access the
> instance variable directly (_sortColumnIdentifier).

Oops.  Fixed it.
Comment 10 WebKit Commit Bot 2016-01-04 22:36:00 PST
Comment on attachment 268267 [details]
Patch

Clearing flags on attachment: 268267

Committed r194574: <http://trac.webkit.org/changeset/194574>
Comment 11 WebKit Commit Bot 2016-01-04 22:36:03 PST
All reviewed patches have been landed.  Closing bug.
Comment 12 Timothy Hatcher 2016-01-06 10:33:06 PST
Comment on attachment 268267 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js:166
>          this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;

You remember the column, but not the sort order. It would be good to remember both.
Comment 13 Devin Rousso 2016-01-06 15:00:17 PST
Comment on attachment 268267 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js:166
>>          this._dataGrid.sortOrder = WebInspector.DataGrid.SortOrder.Ascending;
> 
> You remember the column, but not the sort order. It would be good to remember both.

Just made another bug for this: https://bugs.webkit.org/show_bug.cgi?id=152811