2020-01-06 09:56:34 -06:00
|
|
|
import { defaultsDeep } from 'lodash';
|
2022-12-29 07:48:22 -06:00
|
|
|
import { ComponentType } from 'react';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2022-12-29 07:48:22 -06:00
|
|
|
import { PanelPluginMeta, PluginMeta, PluginType, PanelPlugin, PanelProps } from '../../src';
|
2018-09-26 08:12:06 -05:00
|
|
|
|
2019-04-29 11:14:39 -05:00
|
|
|
export const getMockPlugins = (amount: number): PluginMeta[] => {
|
2022-12-29 07:48:22 -06:00
|
|
|
const plugins: PluginMeta[] = [];
|
2018-09-26 08:12:06 -05:00
|
|
|
|
|
|
|
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',
|
2022-12-29 07:48:22 -06:00
|
|
|
links: [{ name: 'one link', url: 'one link' }],
|
2018-09-26 08:12:06 -05:00
|
|
|
logos: { small: 'small/logo', large: 'large/logo' },
|
2022-12-29 07:48:22 -06:00
|
|
|
screenshots: [{ path: `screenshot/${i}`, name: 'test' }],
|
2018-09-26 08:12:06 -05:00
|
|
|
updated: '2018-09-26',
|
|
|
|
version: '1',
|
|
|
|
},
|
|
|
|
latestVersion: `1.${i}`,
|
|
|
|
name: `pretty cool plugin-${i}`,
|
|
|
|
pinned: false,
|
2022-12-29 07:48:22 -06:00
|
|
|
state: undefined,
|
|
|
|
type: PluginType.panel,
|
|
|
|
module: '',
|
|
|
|
baseUrl: '',
|
2018-09-26 08:12:06 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-03-14 04:51:44 -05:00
|
|
|
return plugins;
|
2018-09-26 08:12:06 -05:00
|
|
|
};
|
|
|
|
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
export function getPanelPlugin(
|
2019-05-01 00:36:46 -05:00
|
|
|
options: Partial<PanelPluginMeta>,
|
|
|
|
reactPanel?: ComponentType<PanelProps>,
|
|
|
|
angularPanel?: any
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
): PanelPlugin {
|
|
|
|
const plugin = new PanelPlugin(reactPanel!);
|
2019-05-01 00:36:46 -05:00
|
|
|
plugin.angularPanelCtrl = angularPanel;
|
|
|
|
plugin.meta = {
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
id: options.id!,
|
2019-04-12 06:46:42 -05:00
|
|
|
type: PluginType.panel,
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
name: options.id!,
|
2018-11-13 00:54:02 -06:00
|
|
|
sort: options.sort || 1,
|
2018-11-13 01:09:12 -06:00
|
|
|
info: {
|
|
|
|
author: {
|
|
|
|
name: options.id + 'name',
|
|
|
|
},
|
|
|
|
description: '',
|
|
|
|
links: [],
|
|
|
|
logos: {
|
|
|
|
large: '',
|
|
|
|
small: '',
|
|
|
|
},
|
|
|
|
screenshots: [],
|
|
|
|
updated: '',
|
2023-10-11 06:24:18 -05:00
|
|
|
version: '1',
|
2018-11-13 00:54:02 -06:00
|
|
|
},
|
2018-11-13 01:09:12 -06:00
|
|
|
hideFromList: options.hideFromList === true,
|
2022-11-21 08:31:01 -06:00
|
|
|
module: options.module ?? '',
|
2018-11-13 00:54:02 -06:00
|
|
|
baseUrl: '',
|
2023-07-12 06:37:26 -05:00
|
|
|
skipDataQuery: options.skipDataQuery,
|
2018-11-13 00:54:02 -06:00
|
|
|
};
|
2019-05-01 00:36:46 -05:00
|
|
|
return plugin;
|
Chore: Fix all Typescript strict null errors (#26204)
* Chore: Fix typescript strict null errors
* Added new limit
* Fixed ts issue
* fixed tests
* trying to fix type inference
* Fixing more ts errors
* Revert tsconfig option
* Fix
* Fixed code
* More fixes
* fix tests
* Updated snapshot
* Chore: More ts strict null fixes
* More fixes in some really messed up azure config components
* More fixes, current count: 441
* 419
* More fixes
* Fixed invalid initial state in explore
* Fixing tests
* Fixed tests
* Explore fix
* More fixes
* Progress
* Sub 300
* Now at 218
* Progress
* Update
* Progress
* Updated tests
* at 159
* fixed tests
* Progress
* YAy blow 100! at 94
* 10,9,8,7,6,5,4,3,2,1... lift off
* Fixed tests
* Fixed more type errors
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2020-07-10 05:46:59 -05:00
|
|
|
}
|
2018-11-13 00:54:02 -06:00
|
|
|
|
2020-01-06 09:56:34 -06:00
|
|
|
export function getMockPlugin(overrides?: Partial<PluginMeta>): PluginMeta {
|
|
|
|
const defaults: PluginMeta = {
|
2018-09-26 08:12:06 -05:00
|
|
|
defaultNavUrl: 'some/url',
|
|
|
|
enabled: false,
|
|
|
|
hasUpdate: false,
|
|
|
|
id: '1',
|
|
|
|
info: {
|
|
|
|
author: {
|
|
|
|
name: 'Grafana Labs',
|
|
|
|
url: 'url/to/GrafanaLabs',
|
|
|
|
},
|
|
|
|
description: 'pretty decent plugin',
|
2018-12-18 07:40:54 -06:00
|
|
|
links: [{ name: 'project', url: 'one link' }],
|
2018-09-26 08:12:06 -05:00
|
|
|
logos: { small: 'small/logo', large: 'large/logo' },
|
2020-01-06 09:56:34 -06:00
|
|
|
screenshots: [{ path: `screenshot`, name: 'test' }],
|
2018-09-26 08:12:06 -05:00
|
|
|
updated: '2018-09-26',
|
|
|
|
version: '1',
|
|
|
|
},
|
|
|
|
latestVersion: '1',
|
|
|
|
name: 'pretty cool plugin 1',
|
2019-04-12 06:46:42 -05:00
|
|
|
baseUrl: 'path/to/plugin',
|
2018-09-26 08:12:06 -05:00
|
|
|
pinned: false,
|
2019-04-12 06:46:42 -05:00
|
|
|
type: PluginType.panel,
|
|
|
|
module: 'path/to/module',
|
2020-01-06 09:56:34 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
return defaultsDeep(overrides || {}, defaults) as PluginMeta;
|
|
|
|
}
|