pluginMocks.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { Plugin, PanelPlugin } from 'app/types';
  2. export const getMockPlugins = (amount: number): Plugin[] => {
  3. const plugins = [];
  4. for (let i = 0; i <= amount; i++) {
  5. plugins.push({
  6. defaultNavUrl: 'some/url',
  7. enabled: false,
  8. hasUpdate: false,
  9. id: `${i}`,
  10. info: {
  11. author: {
  12. name: 'Grafana Labs',
  13. url: 'url/to/GrafanaLabs',
  14. },
  15. description: 'pretty decent plugin',
  16. links: ['one link'],
  17. logos: { small: 'small/logo', large: 'large/logo' },
  18. screenshots: [{ path: `screenshot/${i}` }],
  19. updated: '2018-09-26',
  20. version: '1',
  21. },
  22. latestVersion: `1.${i}`,
  23. name: `pretty cool plugin-${i}`,
  24. pinned: false,
  25. state: '',
  26. type: '',
  27. module: {},
  28. });
  29. }
  30. return plugins;
  31. };
  32. export const getPanelPlugin = (options: { id: string; sort?: number; hideFromList?: boolean }): PanelPlugin => {
  33. return {
  34. id: options.id,
  35. name: options.id,
  36. sort: options.sort || 1,
  37. info: {
  38. author: {
  39. name: options.id + 'name',
  40. },
  41. description: '',
  42. links: [],
  43. logos: {
  44. large: '',
  45. small: '',
  46. },
  47. screenshots: [],
  48. updated: '',
  49. version: '',
  50. },
  51. hideFromList: options.hideFromList === true,
  52. module: '',
  53. baseUrl: '',
  54. };
  55. };
  56. export const getMockPlugin = () => {
  57. return {
  58. defaultNavUrl: 'some/url',
  59. enabled: false,
  60. hasUpdate: false,
  61. id: '1',
  62. info: {
  63. author: {
  64. name: 'Grafana Labs',
  65. url: 'url/to/GrafanaLabs',
  66. },
  67. description: 'pretty decent plugin',
  68. links: [{ name: 'project', url: 'one link' }],
  69. logos: { small: 'small/logo', large: 'large/logo' },
  70. screenshots: [{ path: `screenshot` }],
  71. updated: '2018-09-26',
  72. version: '1',
  73. },
  74. latestVersion: '1',
  75. name: 'pretty cool plugin 1',
  76. pinned: false,
  77. state: '',
  78. type: '',
  79. module: {},
  80. };
  81. };