~lucio.torre/graphite/add-flot

« back to all changes in this revision

Viewing changes to webapp/content/js/composer_widgets.js

  • Committer: Chris Davis
  • Date: 2010-08-11 19:47:31 UTC
  • Revision ID: chrismd@gmail.com-20100811194731-ag39t1brm6v1i3v0
fixed timeShift() in functions menu to quote the offset argument

Show diffs side-by-side

added added

removed removed

Lines of Context:
493
493
                  {text: 'Offset', handler: this.applyFuncToEachWithInput('offset', 'Please enter the value to offset Y-values by')},
494
494
                  {text: 'Derivative', handler: this.applyFuncToEach('derivative')},
495
495
                  {text: 'Integral', handler: this.applyFuncToEach('integral')},
496
 
                  {text: 'Non-negative Derivative', handler: this.applyFuncToEachWithInput('nonNegativeDerivative', "Please enter a maximum value if this metric is a wrapping counter (or just leave this blank)",true)},
 
496
                  {text: 'Non-negative Derivative', handler: this.applyFuncToEachWithInput('nonNegativeDerivative', "Please enter a maximum value if this metric is a wrapping counter (or just leave this blank)", {allowBlank: true})},
497
497
                  {text: 'Log', handler: this.applyFuncToEachWithInput('log', 'Please enter a base')},
498
 
                  {text: 'timeShift', handler: this.applyFuncToEachWithInput('timeShift', 'Shift this metric ___ back in time')}
 
498
                  {text: 'timeShift', handler: this.applyFuncToEachWithInput('timeShift', 'Shift this metric ___ back in time (examples: 10min, 7d, 2w)', {quote: true})}
499
499
                ]
500
500
              }, {
501
501
                text: 'Calculate',
525
525
              }, {
526
526
                text: 'Special',
527
527
                menu: [
528
 
                  {text: 'Set Legend Name', handler: this.applyFuncToEachWithInput('alias', 'Enter a legend label for this graph target')},
 
528
                  {text: 'Set Legend Name', handler: this.applyFuncToEachWithInput('alias', 'Enter a legend label for this graph target', {quote: true})},
529
529
                  {text: 'Aggregate By Sum', handler: this.applyFuncToEach('cumulative')},
530
530
                  {text: 'Draw non-zero As Infinite', handler: this.applyFuncToEach('drawAsInfinite')},
531
531
                  {text: 'Line Width', handler: this.applyFuncToEachWithInput('lineWidth', 'Please enter a line width for this graph target')},
643
643
    return applyFunc;
644
644
  },
645
645
 
646
 
  applyFuncToEachWithInput: function (funcName, question, allowBlank) {
 
646
  applyFuncToEachWithInput: function (funcName, question, options) {
 
647
    if (options == null) {
 
648
      options = {};
 
649
    }
 
650
 
647
651
    function applyFunc() {
648
652
      Ext.MessageBox.prompt(
649
653
        "Input Required", //title
650
654
        question, //message
651
655
        function (button, inputValue) { //handler
652
 
          if (button == 'ok' && (allowBlank || inputValue != '')) {
653
 
            if (funcName == 'alias' && inputValue != '') { //SPECIAL CASE HACK
 
656
          if (button == 'ok' && (options.allowBlank || inputValue != '')) {
 
657
            if (options.quote) {
654
658
              inputValue = '"' + inputValue + '"';
655
659
            }
656
660
            this.applyFuncToEach(funcName, inputValue)();