Bug 1266411 - Alphabetically sort devices in each type. r=jryans
authorJaideep Bhoosreddy <jaideepb@buffalo.edu>
Thu, 02 Jun 2016 11:41:00 -0400
changeset 341377 e3d9990ca6ecb7e9e811f13d36d473b7272c3562
parent 341376 8d3252104e46fc29104825c402fb74ba9b66a3e5
child 341378 f12a69ba912259a1e1aaf26cf5f116a8c5948a7e
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1266411
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1266411 - Alphabetically sort devices in each type. r=jryans
devtools/client/responsive.html/components/device-modal.js
--- a/devtools/client/responsive.html/components/device-modal.js
+++ b/devtools/client/responsive.html/components/device-modal.js
@@ -78,16 +78,22 @@ module.exports = createClass({
     } = this.props;
 
     let modalClass = "device-modal container";
 
     if (!devices.isModalOpen) {
       modalClass += " hidden";
     }
 
+    const sortedDevices = {};
+    for (let type of devices.types) {
+      sortedDevices[type] = Object.assign([], devices[type])
+        .sort((a, b) => a.name.localeCompare(b.name));
+    }
+
     return dom.div(
       {
         className: modalClass,
       },
       dom.button({
         id: "device-close-button",
         className: "toolbar-button devtools-button",
         onClick: () => onUpdateDeviceModalOpen(false),
@@ -103,17 +109,17 @@ module.exports = createClass({
               key: type,
             },
             dom.header(
               {
                 className: "device-header",
               },
               type
             ),
-            devices[type].map(device => {
+            sortedDevices[type].map(device => {
               return dom.label(
                 {
                   className: "device-label",
                   key: device.name,
                 },
                 dom.input({
                   className: "device-input-checkbox",
                   type: "checkbox",