index.ts 717 B

1234567891011121314151617181920
  1. import { registerEchoBackend, featureEnabled, config } from '@grafana/runtime';
  2. import { contextSrv } from 'app/core/services/context_srv';
  3. import { initAnalyticsDrawer } from './AnalyticsDrawer/AnalyticsDashNav';
  4. import { MetaAnalyticsBackend } from './MetaAnalyticsBackend';
  5. import { initPresenceIndicators } from './PresenceIndicators';
  6. export const initMetaAnalytics = () => {
  7. if (featureEnabled('analytics')) {
  8. registerEchoBackend(new MetaAnalyticsBackend({ url: '/api/ma/events' }));
  9. const user = contextSrv.user;
  10. if (user.isSignedIn) {
  11. initPresenceIndicators();
  12. initAnalyticsDrawer();
  13. }
  14. } else if (config.featureToggles.featureHighlights) {
  15. initAnalyticsDrawer();
  16. }
  17. };