Sorting table columns when they have a size notation suffix results in incorrect sorts.

Bug #1013475 reported by John Postlethwait
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Tihomir Trifonov

Bug Description

Repro:

Create 3 volumes in the instances and volumes page, with the disk sizes of 3, 50, and 7 GB respectively.
Click on the "Size" column when all three are available.

Expected:

The rows are sorted in this order: 3GB, 7GB, and 50 GB.

Actual:

They are sorted by the first digit. EG: 3GB, 50GB, 7GB

See: http://i.imgur.com/IUBpi.png

Changed in horizon:
assignee: nobody → Nebula (nebula)
status: New → Confirmed
Devin Carlen (devcamcar)
Changed in horizon:
importance: Undecided → Low
milestone: none → folsom-3
Changed in horizon:
assignee: Nebula (nebula) → Tihomir Trifonov (ttrifonov)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/10137

Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/10137
Committed: http://github.com/openstack/horizon/commit/ba27042d65c1bf47556cfecfbe492dab9dc88b3b
Submitter: Jenkins
Branch: master

commit ba27042d65c1bf47556cfecfbe492dab9dc88b3b
Author: Tihomir Trifonov <email address hidden>
Date: Mon Jul 23 18:59:51 2012 +0300

    Added custom parser for tablesorter.js

    A custom parser is needed for sorting of
    custom type columns like the 'Size' columns.
    The 'KB', 'MB', 'GB'... values break the sorter
    logic and need to be parsed manually.

    The custom parser works on all 'Size'/'RAM'/'Memory'
    columns. It works also on flavor-info columns like:

        `m1.tiny | 512MB RAM | 1 VCPU | 0 Disk`

    The custom parser sorts these lines based on the RAM value.

    Note: as seen in horizon.tables.js file, an workaround was
    added as there is one more <th> in the <thead> (incl. the table_caption)
    than the <td>'s in <tbody>. Thus the custom parser needs
    to be added to [i-1] header, while the header itself needs [i],
    as the parser is processed in <tbody>, while headers are processed
    including the table_caption... This might be a problem at some time,
    although currently it works...

    Fixes bug 1013475

    Change-Id: I793ae330c33fde4e625f96e55fdda3748c84b8c3

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: folsom-3 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.