Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
dd5814b5
Unverified
Commit
dd5814b5
authored
May 04, 2020
by
Ryan McKinley
Committed by
GitHub
May 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Runtime: expose angular injector (#24262)
parent
1eb52465
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
packages/grafana-runtime/src/services/index.ts
+1
-0
packages/grafana-runtime/src/services/legacyAngularInjector.ts
+23
-0
public/app/routes/GrafanaCtrl.ts
+5
-2
No files found.
packages/grafana-runtime/src/services/index.ts
View file @
dd5814b5
...
...
@@ -4,3 +4,4 @@ export * from './dataSourceSrv';
export
*
from
'./LocationSrv'
;
export
*
from
'./EchoSrv'
;
export
*
from
'./templateSrv'
;
export
*
from
'./legacyAngularInjector'
;
packages/grafana-runtime/src/services/legacyAngularInjector.ts
0 → 100644
View file @
dd5814b5
import
{
auto
}
from
'angular'
;
let
singleton
:
auto
.
IInjectorService
;
/**
* Used during startup by Grafana to temporarily expose the angular injector to
* pure javascript plugins using {@link getLegacyAngularInjector}.
*
* @internal
*/
export
const
setLegacyAngularInjector
=
(
instance
:
auto
.
IInjectorService
)
=>
{
singleton
=
instance
;
};
/**
* WARNING: this function provides a temporary way for plugins to access anything in the
* angular injector. While the migration from angular to react continues, there are a few
* options that do not yet have good alternatives. Note that use of this function will
* be removed in the future.
*
* @beta
*/
export
const
getLegacyAngularInjector
=
():
auto
.
IInjectorService
=>
singleton
;
public/app/routes/GrafanaCtrl.ts
View file @
dd5814b5
...
...
@@ -6,7 +6,7 @@ import Drop from 'tether-drop';
// Utils and servies
import
{
colors
}
from
'@grafana/ui'
;
import
{
getTemplateSrv
,
setBackendSrv
,
setDataSourceSrv
}
from
'@grafana/runtime'
;
import
{
getTemplateSrv
,
setBackendSrv
,
setDataSourceSrv
,
setLegacyAngularInjector
}
from
'@grafana/runtime'
;
import
config
from
'app/core/config'
;
import
coreModule
from
'app/core/core_module'
;
import
{
profiler
}
from
'app/core/profiler'
;
...
...
@@ -31,6 +31,7 @@ import { DashboardSrv, setDashboardSrv } from 'app/features/dashboard/services/D
import
{
ILocationService
,
ITimeoutService
,
IRootScopeService
,
IAngularEvent
}
from
'angular'
;
import
{
AppEvent
,
AppEvents
,
locationUtil
}
from
'@grafana/data'
;
import
{
backendSrv
}
from
'app/core/services/backend_srv'
;
import
{
auto
}
from
'angular'
;
export
type
GrafanaRootScope
=
IRootScopeService
&
AppEventEmitter
&
AppEventConsumer
&
{
colors
:
string
[]
};
...
...
@@ -47,7 +48,8 @@ export class GrafanaCtrl {
datasourceSrv
:
DatasourceSrv
,
keybindingSrv
:
KeybindingSrv
,
dashboardSrv
:
DashboardSrv
,
angularLoader
:
AngularLoader
angularLoader
:
AngularLoader
,
$injector
:
auto
.
IInjectorService
)
{
// make angular loader service available to react components
setAngularLoader
(
angularLoader
);
...
...
@@ -57,6 +59,7 @@ export class GrafanaCtrl {
setLinkSrv
(
linkSrv
);
setKeybindingSrv
(
keybindingSrv
);
setDashboardSrv
(
dashboardSrv
);
setLegacyAngularInjector
(
$injector
);
locationUtil
.
initialize
({
getConfig
:
()
=>
config
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment