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
a3f1a1c6
Commit
a3f1a1c6
authored
Nov 12, 2018
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: panel-header: Remove the TimeData type
parent
8117a755
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
31 deletions
+22
-31
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+13
-13
public/app/features/dashboard/utils/panel.ts
+8
-4
public/app/features/panel/metrics_panel_ctrl.ts
+1
-7
public/app/types/index.ts
+0
-2
public/app/types/series.ts
+0
-5
No files found.
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
a3f1a1c6
...
...
@@ -14,7 +14,7 @@ import { applyPanelTimeOverrides, getResolution, calculateInterval } from 'app/f
// Types
import
{
PanelModel
}
from
'../panel_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
Time
Data
,
PanelProps
}
from
'app/types'
;
import
{
Time
Range
,
PanelProps
}
from
'app/types'
;
export
interface
Props
{
panel
:
PanelModel
;
...
...
@@ -25,7 +25,8 @@ export interface Props {
export
interface
State
{
refreshCounter
:
number
;
renderCounter
:
number
;
timeData
:
TimeData
;
timeInfo
:
string
;
timeRange
:
TimeRange
;
interval
:
{
interval
:
string
;
intervalMs
:
number
;
...
...
@@ -41,10 +42,8 @@ export class PanelChrome extends PureComponent<Props, State> {
this
.
state
=
{
refreshCounter
:
0
,
renderCounter
:
0
,
timeData
:
{
timeInfo
:
''
,
timeRange
:
this
.
timeSrv
.
timeRange
(),
},
timeInfo
:
''
,
timeRange
:
this
.
timeSrv
.
timeRange
(),
interval
:
{
interval
:
undefined
,
intervalMs
:
undefined
,
...
...
@@ -67,9 +66,10 @@ export class PanelChrome extends PureComponent<Props, State> {
if
(
!
this
.
isVisible
)
{
return
;
}
const
currTimeData
=
this
.
state
.
timeData
;
const
{
timeRange
}
=
this
.
state
;
const
{
panel
}
=
this
.
props
;
const
timeData
=
applyPanelTimeOverrides
(
panel
,
currTimeData
);
const
timeData
=
applyPanelTimeOverrides
(
panel
,
timeRange
);
const
resolution
=
getResolution
(
panel
);
const
interval
=
calculateInterval
(
panel
,
panel
.
datasource
,
timeData
.
timeRange
,
resolution
);
...
...
@@ -77,8 +77,8 @@ export class PanelChrome extends PureComponent<Props, State> {
this
.
setState
(
prevState
=>
({
...
prevState
,
refreshCounter
:
this
.
state
.
refreshCounter
+
1
,
timeData
,
interval
,
...
timeData
,
}));
};
...
...
@@ -96,7 +96,7 @@ export class PanelChrome extends PureComponent<Props, State> {
render
()
{
const
{
panel
,
dashboard
}
=
this
.
props
;
const
{
refreshCounter
,
time
Data
,
renderCounter
}
=
this
.
state
;
const
{
refreshCounter
,
time
Range
,
timeInfo
,
renderCounter
}
=
this
.
state
;
const
{
datasource
,
targets
}
=
panel
;
const
PanelComponent
=
this
.
props
.
component
;
...
...
@@ -104,12 +104,12 @@ export class PanelChrome extends PureComponent<Props, State> {
console
.
log
(
'panelChrome render'
);
return
(
<
div
className=
"panel-container"
>
<
PanelHeader
panel=
{
panel
}
dashboard=
{
dashboard
}
timeInfo=
{
time
Data
.
time
Info
}
/>
<
PanelHeader
panel=
{
panel
}
dashboard=
{
dashboard
}
timeInfo=
{
timeInfo
}
/>
<
div
className=
"panel-content"
>
<
DataPanel
datasource=
{
datasource
}
queries=
{
targets
}
timeRange=
{
time
Data
.
time
Range
}
timeRange=
{
timeRange
}
isVisible=
{
this
.
isVisible
}
refreshCounter=
{
refreshCounter
}
>
...
...
@@ -119,7 +119,7 @@ export class PanelChrome extends PureComponent<Props, State> {
<
PanelComponent
loading=
{
loading
}
timeSeries=
{
timeSeries
}
timeRange=
{
time
Data
.
time
Range
}
timeRange=
{
timeRange
}
options=
{
panel
.
getOptions
()
}
renderCounter=
{
renderCounter
}
/>
...
...
public/app/features/dashboard/utils/panel.ts
View file @
a3f1a1c6
...
...
@@ -4,7 +4,6 @@ import store from 'app/core/store';
// Models
import
{
DashboardModel
}
from
'app/features/dashboard/dashboard_model'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
import
{
TimeData
}
from
'app/types'
;
import
{
TimeRange
}
from
'app/types/series'
;
// Utils
...
...
@@ -101,9 +100,14 @@ export const toggleLegend = (panel: PanelModel) => {
refreshPanel
(
panel
);
};
export
const
applyPanelTimeOverrides
=
(
panel
:
PanelModel
,
timeData
:
TimeData
):
TimeData
=>
{
const
{
timeRange
}
=
timeData
;
const
newTimeData
=
{
...
timeData
};
export
const
applyPanelTimeOverrides
=
(
panel
:
PanelModel
,
timeRange
:
TimeRange
):
{
timeInfo
:
string
;
timeRange
:
TimeRange
}
=>
{
const
newTimeData
=
{
timeInfo
:
''
,
timeRange
:
timeRange
,
};
if
(
panel
.
timeFrom
)
{
const
timeFromInterpolated
=
templateSrv
.
replace
(
panel
.
timeFrom
,
panel
.
scopedVars
);
...
...
public/app/features/panel/metrics_panel_ctrl.ts
View file @
a3f1a1c6
...
...
@@ -10,7 +10,6 @@ import {
calculateInterval
as
calculateIntervalUtil
,
getResolution
,
}
from
'app/features/dashboard/utils/panel'
;
import
{
TimeData
}
from
'app/types'
;
class
MetricsPanelCtrl
extends
PanelCtrl
{
scope
:
any
;
...
...
@@ -154,12 +153,7 @@ class MetricsPanelCtrl extends PanelCtrl {
}
applyPanelTimeOverrides
()
{
const
timeData
:
TimeData
=
{
timeInfo
:
''
,
timeRange
:
this
.
range
,
};
const
newTimeData
=
applyPanelTimeOverridesUtil
(
this
.
panel
,
timeData
);
const
newTimeData
=
applyPanelTimeOverridesUtil
(
this
.
panel
,
this
.
range
);
this
.
timeInfo
=
newTimeData
.
timeInfo
;
this
.
range
=
newTimeData
.
timeRange
;
}
...
...
public/app/types/index.ts
View file @
a3f1a1c6
...
...
@@ -9,7 +9,6 @@ import { ApiKey, ApiKeysState, NewApiKey } from './apiKeys';
import
{
Invitee
,
OrgUser
,
User
,
UsersState
,
UserState
}
from
'./user'
;
import
{
DataSource
,
DataSourcesState
}
from
'./datasources'
;
import
{
TimeData
,
TimeRange
,
LoadingState
,
TimeSeries
,
...
...
@@ -67,7 +66,6 @@ export {
OrgUser
,
User
,
UsersState
,
TimeData
,
TimeRange
,
LoadingState
,
PanelProps
,
...
...
public/app/types/series.ts
View file @
a3f1a1c6
...
...
@@ -18,11 +18,6 @@ export interface TimeRange {
raw
:
RawTimeRange
;
}
export
interface
TimeData
{
timeRange
:
TimeRange
;
timeInfo
:
string
;
}
export
type
TimeSeriesValue
=
string
|
number
|
null
;
export
type
TimeSeriesPoints
=
TimeSeriesValue
[][];
...
...
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