Browse Source

Add case-insensitive sort for variables.

Chris Ross 7 years ago
parent
commit
4a93766143

+ 2 - 0
public/app/features/templating/editor_ctrl.ts

@@ -23,6 +23,8 @@ export class VariableEditorCtrl {
       { value: 2, text: 'Alphabetical (desc)' },
       { value: 3, text: 'Numerical (asc)' },
       { value: 4, text: 'Numerical (desc)' },
+      { value: 5, text: 'Alphabetical (case-insensitive, asc)' },
+      { value: 6, text: 'Alphabetical (case-insensitive, desc)' },
     ];
 
     $scope.hideOptions = [{ value: 0, text: '' }, { value: 1, text: 'Label' }, { value: 2, text: 'Variable' }];

+ 2 - 0
public/app/features/templating/query_variable.ts

@@ -197,6 +197,8 @@ export class QueryVariable implements Variable {
           return parseInt(matches[1], 10);
         }
       });
+    } else if (sortType === 3) {
+      options = _.sortBy(options, opt => { return _.toLower(opt.text); });
     }
 
     if (reverseSort) {