config_ctrl.ts 1.2 KB

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