浏览代码

Add case-insensitive sort for variables.

Chris Ross 7 年之前
父节点
当前提交
4a93766143
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 2 0
      public/app/features/templating/editor_ctrl.ts
  2. 2 0
      public/app/features/templating/query_variable.ts

+ 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) {