Permalink
Browse files

fix

  • Loading branch information...
Genki Sugawara
Genki Sugawara committed Nov 3, 2012
1 parent 135295e commit dccb695e16c33ddf7be7eedcc323fb2bec125e5c
Showing with 11 additions and 1 deletion.
  1. +11 −1 ec2ui/content/ec2ui/dialog_attach_eni.js
@@ -7,13 +7,23 @@ var ec2_DialogAttachENI = {
var instances = ec2ui_session.model.getInstances();
var list = document.getElementById('ec2ui.attacheni.instanceIds');
+ var labels = [];
+ var h_name_id = {};
for (var i = 0; i < instances.length; i++) {
var instance = instances[i];
if (instance.subnetId != eni.subnetId) { continue; }
var label = (instance.name || '(no name)') + '@' + instance.id;
- list.appendItem(label, instance.id);
+ labels.push(label);
+ h_name_id[label] = instance.id;
+ }
+
+ labels.sort();
+
+ for (var i = 0; i < labels.length; i++) {
+ var label = labels[i];
+ list.appendItem(label, h_name_id[label]);
}
return true;

0 comments on commit dccb695

Please sign in to comment.