CiscoDevNet / yang-explorer

An open-source Yang Browser and RPC Builder Application
Apache License 2.0
438 stars 177 forks source link

Sort the pull down menu alphabetically #58

Closed bclaise closed 7 years ago

bclaise commented 7 years ago

From the ietf-interface, interfaces, interface, type: I want to set the interface type. The values are https://www.iana.org/assignments/ianaiftype-mib/ianaiftype-mib I can't see to find the ethernetCsmacd. Can you please sort the entries alphabetically.

Thanks, B.

rustogi commented 7 years ago

@bclaise

Can you try patching this simple change to confirm it sorts as you expect.

diff --git a/server/explorer/plugins/cxml.py b/server/explorer/plugins/cxml.py
index 7f4945d..aab2f70 100644
--- a/server/explorer/plugins/cxml.py
+++ b/server/explorer/plugins/cxml.py
@@ -407,7 +407,7 @@ class Cxml:
                 ids = value.split(':')
                 value_stmts.append(self.module_prefixes[ids[0]][0] + ':' + ids[1])
             if stmts:
-                return '|'.join(value_stmts)
+                return '|'.join(sorted(value_stmts))
         return ''

     def type_choice_values(self, s):

Here is a sorted screenshot.

screen shot 2017-05-13 at 11 50 07 pm