config_ctrl.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import angular from 'angular';
  3. import _ from 'lodash';
  4. export class CloudWatchConfigCtrl {
  5. static templateUrl = 'partials/config.html';
  6. current: any;
  7. accessKeyExist: boolean = false;
  8. secretKeyExist: boolean = false;
  9. /** @ngInject */
  10. constructor($scope) {
  11. this.current.jsonData.timeField = this.current.jsonData.timeField || '@timestamp';
  12. this.current.jsonData.authType = this.current.jsonData.authType || 'credentials';
  13. for (let key of this.current.encryptedFields) {
  14. if (key === "accessKey") {
  15. this.accessKeyExist = true;
  16. }
  17. if (key === "secretKey") {
  18. this.secretKeyExist = true;
  19. }
  20. }
  21. }
  22. resetAccessKey() {
  23. this.accessKeyExist = false;
  24. }
  25. resetSecretKey() {
  26. this.secretKeyExist = false;
  27. }
  28. authTypes = [
  29. {name: 'Access & secret key', value: 'keys'},
  30. {name: 'Credentials file', value: 'credentials'},
  31. {name: 'ARN', value: 'arn'},
  32. ];
  33. indexPatternTypes = [
  34. {name: 'No pattern', value: undefined},
  35. {name: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH'},
  36. {name: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD'},
  37. {name: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW'},
  38. {name: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM'},
  39. {name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY'},
  40. ];
  41. }