Commit 33ef71d8 by Ryan McKinley Committed by GitHub

AddDatasource: Improve plugin categories (#28584)

* add IoT category to datasources

* add more enterprise plugins

* add more enterprise plugins
parent 0d803613
......@@ -28,8 +28,8 @@ const plugins: DataSourcePluginMeta[] = [
describe('buildCategories', () => {
const categories = buildCategories(plugins);
it('should group plugins into categories', () => {
expect(categories.length).toBe(7);
it('should group plugins into categories and remove empty categories', () => {
expect(categories.length).toBe(4);
expect(categories[0].title).toBe('Time series databases');
expect(categories[0].plugins.length).toBe(2);
expect(categories[1].title).toBe('Logging & document databases');
......@@ -40,17 +40,17 @@ describe('buildCategories', () => {
});
it('should add phantom plugin for Grafana cloud', () => {
expect(categories[4].title).toBe('Cloud');
expect(categories[4].plugins.length).toBe(2);
expect(categories[4].plugins[1].id).toBe('gcloud');
expect(categories[2].title).toBe('Cloud');
expect(categories[2].plugins.length).toBe(2);
expect(categories[2].plugins[1].id).toBe('gcloud');
});
it('should set module to phantom on phantom plugins', () => {
expect(categories[5].plugins[0].module).toBe('phantom');
expect(categories[3].plugins[0].module).toBe('phantom');
});
it('should add enterprise phantom plugins', () => {
expect(categories[5].title).toBe('Enterprise plugins');
expect(categories[5].plugins.length).toBe(7);
expect(categories[3].title).toBe('Enterprise plugins');
expect(categories[3].plugins.length).toBe(10);
});
});
......@@ -9,6 +9,7 @@ export function buildCategories(plugins: DataSourcePluginMeta[]): DataSourcePlug
{ id: 'sql', title: 'SQL', plugins: [] },
{ id: 'cloud', title: 'Cloud', plugins: [] },
{ id: 'enterprise', title: 'Enterprise plugins', plugins: [] },
{ id: 'iot', title: 'Industrial & IoT', plugins: [] },
{ id: 'other', title: 'Others', plugins: [] },
].filter(item => item);
......@@ -23,7 +24,7 @@ export function buildCategories(plugins: DataSourcePluginMeta[]): DataSourcePlug
for (const plugin of plugins) {
// Force category for enterprise plugins
if (enterprisePlugins.find(item => item.id === plugin.id)) {
if (plugin.enterprise || enterprisePlugins.find(item => item.id === plugin.id)) {
plugin.category = 'enterprise';
}
......@@ -58,7 +59,8 @@ export function buildCategories(plugins: DataSourcePluginMeta[]): DataSourcePlug
sortPlugins(category.plugins);
}
return categories;
// Only show categories with plugins
return categories.filter(c => c.plugins.length > 0);
}
function sortPlugins(plugins: DataSourcePluginMeta[]) {
......@@ -125,6 +127,24 @@ function getEnterprisePhantomPlugins(): DataSourcePluginMeta[] {
imgUrl: 'public/img/plugins/newrelic.svg',
}),
getPhantomPlugin({
id: 'grafana-mongodb-datasource',
description: 'MongoDB integration & data source',
name: 'MongoDB',
imgUrl: 'public/img/plugins/mongodb.svg',
}),
getPhantomPlugin({
id: 'grafana-snowflake-datasource',
description: 'Snowflake integration & data source',
name: 'Snowflake',
imgUrl: 'public/img/plugins/snowflake.svg',
}),
getPhantomPlugin({
id: 'grafana-wavefront-datasource',
description: 'Wavefront integration & data source',
name: 'Wavefront',
imgUrl: 'public/img/plugins/wavefront.svg',
}),
getPhantomPlugin({
id: 'dlopes7-appdynamics-datasource',
description: 'AppDynamics integration & data source',
name: 'AppDynamics',
......
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="64" viewBox="0 0 32 32" height="64"><path fill="#599636" d="m15.9.087.854 1.604c.192.296.4.558.645.802.715.715 1.394 1.464 2.004 2.266 1.447 1.9 2.423 4.01 3.12 6.292.418 1.394.645 2.824.662 4.27.07 4.323-1.412 8.035-4.4 11.12-.488.488-1.01.94-1.57 1.342-.296 0-.436-.227-.558-.436-.227-.383-.366-.82-.436-1.255-.105-.523-.174-1.046-.14-1.586v-.244c-.024-.052-.285-24.052-.181-24.175z"></path><path fill="#6cac48" d="m15.9.034c-.035-.07-.07-.017-.105.017.017.35-.105.662-.296.96-.21.296-.488.523-.767.767-1.55 1.342-2.77 2.963-3.747 4.776-1.3 2.44-1.97 5.055-2.16 7.808-.087.993.314 4.497.627 5.508.854 2.684 2.388 4.933 4.375 6.885.488.47 1.01.906 1.55 1.325.157 0 .174-.14.21-.244a4.78 4.78 0 0 0 .157-.68l.35-2.614z"></path><path fill="#c2bfbf" d="m16.754 28.845c.035-.4.227-.732.436-1.063-.21-.087-.366-.26-.488-.453-.105-.174-.192-.383-.26-.575-.244-.732-.296-1.5-.366-2.248v-.453c-.087.07-.105.662-.105.75a17.37 17.37 0 0 1 -.314 2.353c-.052.314-.087.627-.28.906 0 .035 0 .07.017.122.314.924.4 1.865.453 2.824v.35c0 .418-.017.33.33.47.14.052.296.07.436.174.105 0 .122-.087.122-.157l-.052-.575v-1.604c-.017-.28.035-.558.07-.82z"></path></svg>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="svg2" height="222" width="191" xmlns="http://www.w3.org/2000/svg">
<metadata id="metadata18">
image/svg+xml
</metadata>
<defs id="defs16"></defs>
<path id="path6" d="M182 0.46373C170.918 2.39999 159.914 5.89729 149 8.62654C145.354 9.53816 139.451 10.0056 137.179 13.419C134.754 17.0627 136 23.8287 136 28L136 64L136 106C136 112.44 135.468 119.58 144.001 118.822C155.372 117.812 166.963 113.169 178 110.374C181.587 109.466 187.777 109.096 189.972 105.697C192.305 102.085 191 95.1227 191 91L191 53L191 17C191 12.8454 192.269 6.12177 190.397 2.3179C188.924 -0.673584 184.677 -0.00404358 182 0.46373z" style="fill:#02b7f1; stroke:none;"></path>
<path id="path8" d="M190 0L191 1L190 0z" style="fill:#000000; stroke:none;"></path>
<path id="path10" d="M116.985 31.5725C105.211 32.3619 92.4533 37.5101 81 40.3735C77.3017 41.298 71.2553 41.7382 69.0278 45.2785C67.0902 48.3581 68 53.5281 68 57L68 86L68 125C68.0003 129.288 66.9782 136.223 73.0193 136.471C76.8942 136.631 81.2721 134.805 85 133.873L110 127.627C113.698 126.702 119.745 126.262 121.972 122.721C124.037 119.439 123 113.708 123 110L123 79L123 42C122.992 37.4057 123.278 31.1506 116.985 31.5725M46 34.4645C34.9204 36.3499 23.9035 39.9007 13 42.6265C9.41573 43.5226 3.2187 43.9109 1.02778 47.3032C-1.30483 50.9149 0 57.8774 0 62L0 99L0 141C0 145.948 -1.21604 153.905 6.00463 153.427C17.535 152.664 29.8315 147.501 41 144.63C44.4466 143.743 50.6704 143.351 52.9722 140.297C55.3862 137.094 54 129.804 54 126L54 87L54 47C54 40.1866 55.1481 32.9078 46 34.4645M183 122.468C171.598 124.273 160.2 128.073 149 130.873C145.078 131.854 139.428 132.292 137.179 136.144C135.113 139.682 136 145.072 136 149C136 159.273 135.401 169.748 136.044 180C136.315 184.315 138.172 187.915 143.004 187.641C154.74 186.977 167.585 181.48 179 178.627C182.436 177.768 188.702 177.374 190.397 173.721C192.002 170.261 191 164.731 191 161L191 137C191 133.438 191.853 128.483 190.397 125.148C189.063 122.095 185.871 122.014 183 122.468M114.999 139.53C103.616 141.512 92.2218 145.321 81 148.127C77.3383 149.042 70.5937 149.427 68.7423 153.279C66.7215 157.482 68 164.437 68 169L68 206C68 211.121 66.4894 219.829 74.0046 219.591C78.6714 219.443 83.53 217.36 88 216.151C95.6272 214.088 103.335 212.29 111 210.373C114.778 209.429 120.658 208.965 122.397 204.867C124.349 200.264 123 192.93 123 188L123 151C122.998 145.015 123.026 138.132 114.999 139.53M46.9992 156.483C35.3055 158.054 23.4488 162.264 12 165.127C8.43957 166.017 2.31564 166.407 0.603395 170.228C-0.976197 173.752 0 179.218 0 183L0 212C0.00222793 216.95 -0.477411 222.229 6.00463 221.807C17.7909 221.04 30.5271 215.742 42 212.873C45.5604 211.983 51.6844 211.593 53.3966 207.772C55.0831 204.01 54 198.045 54 194C54 183.407 55.5512 171.471 53.8519 161.019C53.2314 157.203 50.6337 155.995 46.9992 156.483z" style="fill:#02b7f1; stroke:none;"></path>
<path id="path12" d="M0 221L1 222L0 221z" style="fill:#000000; stroke:none;"></path>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment