Bug 90361

Summary: Web Inspector: Make DirectoryContentView sortable
Product: WebKit Reporter: Taiju Tsuiki <tzik>
Component: Web Inspector (Deprecated)Assignee: Taiju Tsuiki <tzik>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, vsevik, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 89961    
Bug Blocks: 68203    
Attachments:
Description Flags
Patch
none
Patch none

Description Taiju Tsuiki 2012-07-02 00:32:37 PDT
DirectoryContentView should have sortable columns.
Comment 1 Taiju Tsuiki 2012-07-02 00:39:50 PDT
Created attachment 150371 [details]
Patch
Comment 2 Vsevolod Vlasov 2012-07-02 02:28:25 PDT
Comment on attachment 150371 [details]
Patch

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

Please make sure directories are correctly sorted.

> Source/WebCore/inspector/front-end/DirectoryContentView.js:139
> +        if (x._entry.isDirectory)

This means directories order would be undefined. We should sort them by name instead.

> Source/WebCore/inspector/front-end/DirectoryContentView.js:146
> +        return (x._metadata ? x._metadata.size || 0 : 0) - (y._metadata ? y._metadata.size || 0 : 0);

Is size defined for directories?

> Source/WebCore/inspector/front-end/DirectoryContentView.js:151
> +        return (x._metadata ? x._metadata.modificationTime : 0) - (y._metadata ? y._metadata.modificationTime : 0);

Is modification time defined for directories?
Comment 3 Taiju Tsuiki 2012-07-02 03:24:43 PDT
Comment on attachment 150371 [details]
Patch

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

>> Source/WebCore/inspector/front-end/DirectoryContentView.js:139
>> +        if (x._entry.isDirectory)
> 
> This means directories order would be undefined. We should sort them by name instead.

I meant, all directories have same type.
Should we also sort other same-mimetype files by name?

>> Source/WebCore/inspector/front-end/DirectoryContentView.js:146
>> +        return (x._metadata ? x._metadata.size || 0 : 0) - (y._metadata ? y._metadata.size || 0 : 0);
> 
> Is size defined for directories?

No, it doesn't have size, currently.
Should we assign dummy value to directory size? It seems make thing simpler.

>> Source/WebCore/inspector/front-end/DirectoryContentView.js:151
>> +        return (x._metadata ? x._metadata.modificationTime : 0) - (y._metadata ? y._metadata.modificationTime : 0);
> 
> Is modification time defined for directories?

Yes, directories have modification time. It'll be updated when its content is created or removed.
Comment 4 Vsevolod Vlasov 2012-07-02 04:36:44 PDT
(In reply to comment #3)
> (From update of attachment 150371 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=150371&action=review
> 
> >> Source/WebCore/inspector/front-end/DirectoryContentView.js:139
> >> +        if (x._entry.isDirectory)
> > 
> > This means directories order would be undefined. We should sort them by name instead.
> 
> I meant, all directories have same type.
> Should we also sort other same-mimetype files by name?
> 
> >> Source/WebCore/inspector/front-end/DirectoryContentView.js:146
> >> +        return (x._metadata ? x._metadata.size || 0 : 0) - (y._metadata ? y._metadata.size || 0 : 0);
> > 
> > Is size defined for directories?
> 
> No, it doesn't have size, currently.
> Should we assign dummy value to directory size? It seems make thing simpler.
> 
> >> Source/WebCore/inspector/front-end/DirectoryContentView.js:151
> >> +        return (x._metadata ? x._metadata.modificationTime : 0) - (y._metadata ? y._metadata.modificationTime : 0);
> > 
> > Is modification time defined for directories?
> 
> Yes, directories have modification time. It'll be updated when its content is created or removed.
I think there two basic requirements:
 - directories should always precede files
 - "equal" entries should be sorted by name
You might want to use some file manager for the reference.
Comment 5 Taiju Tsuiki 2012-07-02 22:10:34 PDT
Created attachment 150533 [details]
Patch
Comment 6 Taiju Tsuiki 2012-07-02 22:20:19 PDT
Comment on attachment 150371 [details]
Patch

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

>>>> Source/WebCore/inspector/front-end/DirectoryContentView.js:139
>>>> +        if (x._entry.isDirectory)
>>> 
>>> This means directories order would be undefined. We should sort them by name instead.
>> 
>> I meant, all directories have same type.
>> Should we also sort other same-mimetype files by name?
> 
> I think there two basic requirements:
>  - directories should always precede files
>  - "equal" entries should be sorted by name
> You might want to use some file manager for the reference.

Updated.

The ordering is differ for each file manager. That looks ubuntu style.
Comment 7 WebKit Review Bot 2012-07-03 02:17:40 PDT
Comment on attachment 150533 [details]
Patch

Clearing flags on attachment: 150533

Committed r121748: <http://trac.webkit.org/changeset/121748>
Comment 8 WebKit Review Bot 2012-07-03 02:17:46 PDT
All reviewed patches have been landed.  Closing bug.