| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import { Plugin, PanelPluginMeta, PanelDataFormat } from 'app/types';
- import { PluginType } from '@grafana/ui';
- export const getMockPlugins = (amount: number): Plugin[] => {
- const plugins = [];
- for (let i = 0; i <= amount; i++) {
- plugins.push({
- defaultNavUrl: 'some/url',
- enabled: false,
- hasUpdate: false,
- id: `${i}`,
- info: {
- author: {
- name: 'Grafana Labs',
- url: 'url/to/GrafanaLabs',
- },
- description: 'pretty decent plugin',
- links: ['one link'],
- logos: { small: 'small/logo', large: 'large/logo' },
- screenshots: [{ path: `screenshot/${i}` }],
- updated: '2018-09-26',
- version: '1',
- },
- latestVersion: `1.${i}`,
- name: `pretty cool plugin-${i}`,
- pinned: false,
- state: '',
- type: '',
- module: {},
- });
- }
- return plugins;
- };
- export const getPanelPlugin = (options: Partial<PanelPluginMeta>): PanelPluginMeta => {
- return {
- id: options.id,
- type: PluginType.panel,
- name: options.id,
- sort: options.sort || 1,
- dataFormats: [PanelDataFormat.TimeSeries],
- info: {
- author: {
- name: options.id + 'name',
- },
- description: '',
- links: [],
- logos: {
- large: '',
- small: '',
- },
- screenshots: [],
- updated: '',
- version: '',
- },
- hideFromList: options.hideFromList === true,
- module: '',
- baseUrl: '',
- vizPlugin: options.vizPlugin,
- angularPlugin: options.angularPlugin,
- };
- };
- export const getMockPlugin = () => {
- return {
- defaultNavUrl: 'some/url',
- enabled: false,
- hasUpdate: false,
- id: '1',
- info: {
- author: {
- name: 'Grafana Labs',
- url: 'url/to/GrafanaLabs',
- },
- description: 'pretty decent plugin',
- links: [{ name: 'project', url: 'one link' }],
- logos: { small: 'small/logo', large: 'large/logo' },
- screenshots: [{ path: `screenshot` }],
- updated: '2018-09-26',
- version: '1',
- },
- latestVersion: '1',
- name: 'pretty cool plugin 1',
- baseUrl: 'path/to/plugin',
- pinned: false,
- type: PluginType.panel,
- module: 'path/to/module',
- } as Plugin;
- };
|