steps.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { getBackendSrv } from 'app/core/services/backend_srv';
  2. import store from 'app/core/store';
  3. import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
  4. import { SetupStep } from './types';
  5. const step1TutorialTitle = 'Grafana fundamentals';
  6. const step2TutorialTitle = 'Create users and teams';
  7. const keyPrefix = 'getting.started.';
  8. const step1Key = `${keyPrefix}${step1TutorialTitle.replace(' ', '-').trim().toLowerCase()}`;
  9. const step2Key = `${keyPrefix}${step2TutorialTitle.replace(' ', '-').trim().toLowerCase()}`;
  10. export const getSteps = (): SetupStep[] => [
  11. {
  12. heading: 'Welcome to Grafana',
  13. subheading: 'The steps below will guide you to quickly finish setting up your Grafana installation.',
  14. title: 'Basic',
  15. info: 'The steps below will guide you to quickly finish setting up your Grafana installation.',
  16. done: false,
  17. cards: [
  18. {
  19. type: 'tutorial',
  20. heading: 'Data source and dashboards',
  21. title: step1TutorialTitle,
  22. info: 'Set up and understand Grafana if you have no prior experience. This tutorial guides you through the entire process and covers the “Data source” and “Dashboards” steps to the right.',
  23. href: 'https://grafana.com/tutorials/grafana-fundamentals',
  24. icon: 'grafana',
  25. check: () => Promise.resolve(store.get(step1Key)),
  26. key: step1Key,
  27. done: false,
  28. },
  29. {
  30. type: 'docs',
  31. title: 'Add your first data source',
  32. heading: 'data sources',
  33. icon: 'database',
  34. learnHref: 'https://grafana.com/docs/grafana/latest/features/datasources/add-a-data-source',
  35. href: 'datasources/new',
  36. check: () => {
  37. return new Promise((resolve) => {
  38. resolve(
  39. getDatasourceSrv()
  40. .getMetricSources()
  41. .filter((item) => {
  42. return item.meta.builtIn !== true;
  43. }).length > 0
  44. );
  45. });
  46. },
  47. done: false,
  48. },
  49. {
  50. type: 'docs',
  51. heading: 'dashboards',
  52. title: 'Create your first dashboard',
  53. icon: 'apps',
  54. href: 'dashboard/new',
  55. learnHref: 'https://grafana.com/docs/grafana/latest/guides/getting_started/#create-a-dashboard',
  56. check: async () => {
  57. const result = await getBackendSrv().search({ limit: 1 });
  58. return result.length > 0;
  59. },
  60. done: false,
  61. },
  62. ],
  63. },
  64. {
  65. heading: 'Setup complete!',
  66. subheading:
  67. 'All necessary steps to use Grafana are done. Now tackle advanced steps or make the best use of this home dashboard – it is, after all, a fully customizable dashboard – and remove this panel.',
  68. title: 'Advanced',
  69. info: ' Manage your users and teams and add plugins. These steps are optional',
  70. done: false,
  71. cards: [
  72. {
  73. type: 'tutorial',
  74. heading: 'Users',
  75. title: 'Create users and teams',
  76. info: 'Learn to organize your users in teams and manage resource access and roles.',
  77. href: 'https://grafana.com/tutorials/create-users-and-teams',
  78. icon: 'users-alt',
  79. key: step2Key,
  80. check: () => Promise.resolve(store.get(step2Key)),
  81. done: false,
  82. },
  83. {
  84. type: 'docs',
  85. heading: 'plugins',
  86. title: 'Find and install plugins',
  87. learnHref: 'https://grafana.com/docs/grafana/latest/plugins/installation',
  88. href: 'plugins',
  89. icon: 'plug',
  90. check: async () => {
  91. const plugins = await getBackendSrv().get('/api/plugins', { embedded: 0, core: 0 });
  92. return Promise.resolve(plugins.length > 0);
  93. },
  94. done: false,
  95. },
  96. ],
  97. },
  98. ];