config_ctrl.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import _ from 'lodash';
  3. export class ElasticConfigCtrl {
  4. static templateUrl = 'public/app/plugins/datasource/elasticsearch/partials/config.html';
  5. current: any;
  6. /** @ngInject */
  7. constructor($scope) {
  8. this.current.jsonData.timeField = this.current.jsonData.timeField || '@timestamp';
  9. }
  10. indexPatternTypes = [
  11. {name: 'No pattern', value: undefined},
  12. {name: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH'},
  13. {name: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD'},
  14. {name: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW'},
  15. {name: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM'},
  16. {name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY'},
  17. ];
  18. esVersions = [
  19. {name: '2.x', value: 2},
  20. {name: '5.x', value: 5},
  21. ];
  22. indexPatternTypeChanged() {
  23. var def = _.find(this.indexPatternTypes, {value: this.current.jsonData.interval});
  24. this.current.database = def.example || 'es-index-name';
  25. }
  26. }