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
f274195d
Commit
f274195d
authored
Nov 13, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: refactoring interval and time override handling
parent
d49e857b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
28 deletions
+12
-28
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+10
-25
public/app/features/dashboard/time_srv.ts
+1
-2
public/app/features/dashboard/utils/panel.ts
+1
-1
No files found.
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
f274195d
...
...
@@ -9,7 +9,7 @@ import { PanelHeader } from './PanelHeader/PanelHeader';
import
{
DataPanel
}
from
'./DataPanel'
;
// Utils
import
{
applyPanelTimeOverrides
,
getResolution
,
calculateInterval
}
from
'app/features/dashboard/utils/panel'
;
import
{
applyPanelTimeOverrides
}
from
'app/features/dashboard/utils/panel'
;
// Types
import
{
PanelModel
}
from
'../panel_model'
;
...
...
@@ -25,12 +25,8 @@ export interface Props {
export
interface
State
{
refreshCounter
:
number
;
renderCounter
:
number
;
timeInfo
:
string
;
timeRange
:
TimeRange
;
interval
:
{
interval
:
string
;
intervalMs
:
number
;
};
timeInfo
?:
string
;
timeRange
?:
TimeRange
;
}
export
class
PanelChrome
extends
PureComponent
<
Props
,
State
>
{
...
...
@@ -42,12 +38,6 @@ export class PanelChrome extends PureComponent<Props, State> {
this
.
state
=
{
refreshCounter
:
0
,
renderCounter
:
0
,
timeInfo
:
''
,
timeRange
:
this
.
timeSrv
.
timeRange
(),
interval
:
{
interval
:
undefined
,
intervalMs
:
undefined
,
},
};
}
...
...
@@ -68,25 +58,20 @@ export class PanelChrome extends PureComponent<Props, State> {
}
const
{
panel
}
=
this
.
props
;
const
timeRange
=
this
.
timeSrv
.
timeRange
();
const
timeData
=
applyPanelTimeOverrides
(
panel
,
timeRange
);
const
resolution
=
getResolution
(
panel
);
const
interval
=
calculateInterval
(
panel
,
panel
.
datasource
,
timeData
.
timeRange
,
resolution
);
const
timeData
=
applyPanelTimeOverrides
(
panel
,
this
.
timeSrv
.
timeRange
());
this
.
setState
(
prevState
=>
({
...
prevState
,
this
.
setState
({
refreshCounter
:
this
.
state
.
refreshCounter
+
1
,
interval
,
...
timeData
,
})
)
;
timeRange
:
timeData
.
timeRange
,
timeInfo
:
timeData
.
timeInfo
,
});
};
onRender
=
()
=>
{
console
.
log
(
'onRender'
);
this
.
setState
(
prevState
=>
({
...
prevState
,
this
.
setState
({
renderCounter
:
this
.
state
.
renderCounter
+
1
,
})
)
;
});
};
get
isVisible
()
{
...
...
public/app/features/dashboard/time_srv.ts
View file @
f274195d
...
...
@@ -20,7 +20,7 @@ export class TimeSrv {
private
autoRefreshBlocked
:
boolean
;
/** @ngInject */
constructor
(
private
$rootScope
,
private
$timeout
,
private
$location
,
private
timer
,
private
contextSrv
)
{
constructor
(
$rootScope
,
private
$timeout
,
private
$location
,
private
timer
,
private
contextSrv
)
{
// default time
this
.
time
=
{
from
:
'6h'
,
to
:
'now'
};
...
...
@@ -189,7 +189,6 @@ export class TimeSrv {
this
.
$location
.
search
(
urlParams
);
}
this
.
$rootScope
.
appEvent
(
'time-range-changed'
,
this
.
time
);
this
.
$timeout
(
this
.
refreshDashboard
.
bind
(
this
),
0
);
}
...
...
public/app/features/dashboard/utils/panel.ts
View file @
f274195d
// Store
// Store
import
store
from
'app/core/store'
;
// Models
...
...
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