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
be6f68f3
Commit
be6f68f3
authored
Oct 25, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for annotation promise clearing, bug introduced last week when merging react panels step1
parent
df7915f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
14 deletions
+29
-14
public/app/features/annotations/annotations_srv.ts
+18
-11
public/app/features/dashboard/dashboard_ctrl.ts
+10
-2
public/app/features/panel/solo_panel_ctrl.ts
+1
-1
No files found.
public/app/features/annotations/annotations_srv.ts
View file @
be6f68f3
import
'./editor_ctrl'
;
// Libaries
import
angular
from
'angular'
;
import
_
from
'lodash'
;
// Components
import
'./editor_ctrl'
;
import
coreModule
from
'app/core/core_module'
;
// Utils & Services
import
{
makeRegions
,
dedupAnnotations
}
from
'./events_processing'
;
// Types
import
{
DashboardModel
}
from
'../dashboard/dashboard_model'
;
export
class
AnnotationsSrv
{
globalAnnotationsPromise
:
any
;
alertStatesPromise
:
any
;
datasourcePromises
:
any
;
/** @ngInject */
constructor
(
private
$rootScope
,
private
$q
,
private
datasourceSrv
,
private
backendSrv
,
private
timeSrv
)
{
$rootScope
.
onAppEvent
(
'refresh'
,
this
.
clearCache
.
bind
(
this
),
$rootScope
);
$rootScope
.
onAppEvent
(
'dashboard-initialized'
,
this
.
clearCache
.
bind
(
this
),
$rootScope
);
}
clearCache
()
{
this
.
globalAnnotation
sPromise
=
null
;
this
.
alertStatesPromise
=
null
;
this
.
datasourcePromises
=
null
;
constructor
(
private
$rootScope
,
private
$q
,
private
datasourceSrv
,
private
backendSrv
,
private
timeSrv
)
{
}
init
(
dashboard
:
DashboardModel
)
{
// clear promises on refresh events
dashboard
.
on
(
'refresh'
,
()
=>
{
this
.
globalAnnotationsPromise
=
null
;
this
.
alertState
sPromise
=
null
;
this
.
datasourcePromises
=
null
;
})
;
}
getAnnotations
(
options
)
{
...
...
public/app/features/dashboard/dashboard_ctrl.ts
View file @
be6f68f3
// Utils
import
config
from
'app/core/config'
;
import
appEvents
from
'app/core/app_events'
;
import
coreModule
from
'app/core/core_module'
;
// Services
import
{
AnnotationsSrv
}
from
'../annotations/annotations_srv'
;
// Types
import
{
DashboardModel
}
from
'./dashboard_model'
;
import
{
PanelModel
}
from
'./panel_model'
;
...
...
@@ -21,6 +27,7 @@ export class DashboardCtrl {
private
dashboardSrv
,
private
unsavedChangesSrv
,
private
dashboardViewStateSrv
,
private
annotationsSrv
:
AnnotationsSrv
,
public
playlistSrv
)
{
// temp hack due to way dashboards are loaded
...
...
@@ -49,6 +56,7 @@ export class DashboardCtrl {
// init services
this
.
timeSrv
.
init
(
dashboard
);
this
.
alertingSrv
.
init
(
dashboard
,
data
.
alerts
);
this
.
annotationsSrv
.
init
(
dashboard
);
// template values service needs to initialize completely before
// the rest of the dashboard can load
...
...
@@ -72,7 +80,7 @@ export class DashboardCtrl {
this
.
keybindingSrv
.
setupDashboardBindings
(
this
.
$scope
,
dashboard
);
this
.
setWindowTitleAndTheme
();
this
.
$scope
.
appEven
t
(
'dashboard-initialized'
,
dashboard
);
appEvents
.
emi
t
(
'dashboard-initialized'
,
dashboard
);
})
.
catch
(
this
.
onInitFailed
.
bind
(
this
,
'Dashboard init failed'
,
true
));
}
...
...
public/app/features/panel/solo_panel_ctrl.ts
View file @
be6f68f3
...
...
@@ -14,7 +14,7 @@ export class SoloPanelCtrl {
const
params
=
$location
.
search
();
panelId
=
parseInt
(
params
.
panelId
,
10
);
$scope
.
onAppEvent
(
'dashboard-initialized'
,
$scope
.
initPanelScope
);
appEvents
.
on
(
'dashboard-initialized'
,
$scope
.
initPanelScope
);
// if no uid, redirect to new route based on slug
if
(
!
(
$routeParams
.
type
===
'script'
||
$routeParams
.
type
===
'snapshot'
)
&&
!
$routeParams
.
uid
)
{
...
...
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