⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.4
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
grafana
/
public
/
app
/
core
/
context
/
View File Name :
GrafanaContext.ts
import React, { useCallback, useContext } from 'react'; import { GrafanaConfig } from '@grafana/data'; import { LocationService, locationService, BackendSrv } from '@grafana/runtime'; import { AppChromeService } from '../components/AppChrome/AppChromeService'; import { NewFrontendAssetsChecker } from '../services/NewFrontendAssetsChecker'; import { KeybindingSrv } from '../services/keybindingSrv'; export interface GrafanaContextType { backend: BackendSrv; location: LocationService; config: GrafanaConfig; chrome: AppChromeService; keybindings: KeybindingSrv; newAssetsChecker: NewFrontendAssetsChecker; } export const GrafanaContext = React.createContext
(undefined); export function useGrafana(): GrafanaContextType { const context = useContext(GrafanaContext); if (!context) { throw new Error('No GrafanaContext found'); } return context; } // Implementation of useReturnToPrevious that's made available through // @grafana/runtime export function useReturnToPreviousInternal() { const { chrome } = useGrafana(); return useCallback( (title: string, href?: string) => { const { pathname, search } = locationService.getLocation(); chrome.setReturnToPrevious({ title: title, href: href ?? pathname + search, }); }, [chrome] ); }