dataSourcesMocks.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { DataSourceSettings } from '@grafana/data';
  2. export const getMockDataSources = (amount: number) => {
  3. const dataSources = [];
  4. for (let i = 0; i < amount; i++) {
  5. dataSources.push({
  6. access: '',
  7. basicAuth: false,
  8. database: `database-${i}`,
  9. id: i,
  10. isDefault: false,
  11. jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' },
  12. name: `dataSource-${i}`,
  13. orgId: 1,
  14. readOnly: false,
  15. type: 'cloudwatch',
  16. typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png',
  17. url: '',
  18. user: '',
  19. });
  20. }
  21. return dataSources as DataSourceSettings[];
  22. };
  23. export const getMockDataSource = (): DataSourceSettings => {
  24. return {
  25. access: '',
  26. basicAuth: false,
  27. basicAuthUser: '',
  28. withCredentials: false,
  29. database: '',
  30. id: 13,
  31. uid: 'x',
  32. isDefault: false,
  33. jsonData: { authType: 'credentials', defaultRegion: 'eu-west-2' },
  34. name: 'gdev-cloudwatch',
  35. typeName: 'Cloudwatch',
  36. orgId: 1,
  37. readOnly: false,
  38. type: 'cloudwatch',
  39. typeLogoUrl: 'public/app/plugins/datasource/cloudwatch/img/amazon-web-services.png',
  40. url: '',
  41. user: '',
  42. secureJsonFields: {},
  43. };
  44. };