Bug 1266411 - Alphabetically sort devices in each type. r=jryans
authorJaideep Bhoosreddy <jaideepb@buffalo.edu>
Thu, 02 Jun 2016 11:41:00 -0400
changeset 339364 e3d9990ca6ecb7e9e811f13d36d473b7272c3562
parent 339363 8d3252104e46fc29104825c402fb74ba9b66a3e5
child 339365 f12a69ba912259a1e1aaf26cf5f116a8c5948a7e
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [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",