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
81c42fc9
Unverified
Commit
81c42fc9
authored
Aug 09, 2019
by
Dominik Prokop
Committed by
GitHub
Aug 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataLinks: respect timezone when displaying datapoint's timestamp in graph context menu (#18461)
parent
d54851f8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
4 deletions
+17
-4
public/app/core/angular_wrappers.ts
+1
-0
public/app/plugins/panel/graph/GraphContextMenu.tsx
+9
-3
public/app/plugins/panel/graph/GraphContextMenuCtrl.ts
+1
-0
public/app/plugins/panel/graph/module.ts
+5
-1
public/app/plugins/panel/graph/template.ts
+1
-0
No files found.
public/app/core/angular_wrappers.ts
View file @
81c42fc9
...
@@ -77,6 +77,7 @@ export function registerAngularDirectives() {
...
@@ -77,6 +77,7 @@ export function registerAngularDirectives() {
'items'
,
'items'
,
[
'onClose'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
[
'onClose'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
[
'getContextMenuSource'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
[
'getContextMenuSource'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
[
'formatSourceDate'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
]);
]);
// We keep the drilldown terminology here because of as using data-* directive
// We keep the drilldown terminology here because of as using data-* directive
...
...
public/app/plugins/panel/graph/GraphContextMenu.tsx
View file @
81c42fc9
import
React
,
{
useContext
}
from
'react'
;
import
React
,
{
useContext
}
from
'react'
;
import
{
FlotDataPoint
}
from
'./GraphContextMenuCtrl'
;
import
{
FlotDataPoint
}
from
'./GraphContextMenuCtrl'
;
import
{
ContextMenu
,
ContextMenuProps
,
SeriesIcon
,
ThemeContext
}
from
'@grafana/ui'
;
import
{
ContextMenu
,
ContextMenuProps
,
SeriesIcon
,
ThemeContext
}
from
'@grafana/ui'
;
import
{
dateTime
}
from
'@grafana/data'
;
import
{
DateTimeInput
}
from
'@grafana/data'
;
import
{
css
}
from
'emotion'
;
import
{
css
}
from
'emotion'
;
type
GraphContextMenuProps
=
ContextMenuProps
&
{
type
GraphContextMenuProps
=
ContextMenuProps
&
{
getContextMenuSource
:
()
=>
FlotDataPoint
|
null
;
getContextMenuSource
:
()
=>
FlotDataPoint
|
null
;
formatSourceDate
:
(
date
:
DateTimeInput
,
format
?:
string
)
=>
string
;
};
};
export
const
GraphContextMenu
:
React
.
FC
<
GraphContextMenuProps
>
=
({
getContextMenuSource
,
items
,
...
otherProps
})
=>
{
export
const
GraphContextMenu
:
React
.
FC
<
GraphContextMenuProps
>
=
({
getContextMenuSource
,
formatSourceDate
,
items
,
...
otherProps
})
=>
{
const
theme
=
useContext
(
ThemeContext
);
const
theme
=
useContext
(
ThemeContext
);
const
source
=
getContextMenuSource
();
const
source
=
getContextMenuSource
();
...
@@ -35,7 +41,7 @@ export const GraphContextMenu: React.FC<GraphContextMenuProps> = ({ getContextMe
...
@@ -35,7 +41,7 @@ export const GraphContextMenu: React.FC<GraphContextMenuProps> = ({ getContextMe
font-size: ${theme.typography.size.sm};
font-size: ${theme.typography.size.sm};
`
}
`
}
>
>
<
strong
>
{
dateTime
(
source
.
datapoint
[
0
]).
format
(
timeFormat
)
}
</
strong
>
<
strong
>
{
formatSourceDate
(
source
.
datapoint
[
0
],
timeFormat
)
}
</
strong
>
<
div
>
<
div
>
<
SeriesIcon
color=
{
source
.
series
.
color
}
/>
<
SeriesIcon
color=
{
source
.
series
.
color
}
/>
<
span
<
span
...
...
public/app/plugins/panel/graph/GraphContextMenuCtrl.ts
View file @
81c42fc9
...
@@ -65,6 +65,7 @@ export class GraphContextMenuCtrl {
...
@@ -65,6 +65,7 @@ export class GraphContextMenuCtrl {
setSource
=
(
source
:
FlotDataPoint
|
null
)
=>
{
setSource
=
(
source
:
FlotDataPoint
|
null
)
=>
{
this
.
source
=
source
;
this
.
source
=
source
;
};
};
getSource
=
()
=>
{
getSource
=
()
=>
{
return
this
.
source
;
return
this
.
source
;
};
};
...
...
public/app/plugins/panel/graph/module.ts
View file @
81c42fc9
...
@@ -11,7 +11,7 @@ import { DataProcessor } from './data_processor';
...
@@ -11,7 +11,7 @@ import { DataProcessor } from './data_processor';
import
{
axesEditorComponent
}
from
'./axes_editor'
;
import
{
axesEditorComponent
}
from
'./axes_editor'
;
import
config
from
'app/core/config'
;
import
config
from
'app/core/config'
;
import
TimeSeries
from
'app/core/time_series2'
;
import
TimeSeries
from
'app/core/time_series2'
;
import
{
DataFrame
,
DataLink
}
from
'@grafana/data'
;
import
{
DataFrame
,
DataLink
,
DateTimeInput
}
from
'@grafana/data'
;
import
{
getColorFromHexRgbOrName
,
LegacyResponseData
,
VariableSuggestion
}
from
'@grafana/ui'
;
import
{
getColorFromHexRgbOrName
,
LegacyResponseData
,
VariableSuggestion
}
from
'@grafana/ui'
;
import
{
getProcessedDataFrames
}
from
'app/features/dashboard/state/PanelQueryState'
;
import
{
getProcessedDataFrames
}
from
'app/features/dashboard/state/PanelQueryState'
;
import
{
PanelQueryRunnerFormat
}
from
'app/features/dashboard/state/PanelQueryRunner'
;
import
{
PanelQueryRunnerFormat
}
from
'app/features/dashboard/state/PanelQueryRunner'
;
...
@@ -340,6 +340,10 @@ class GraphCtrl extends MetricsPanelCtrl {
...
@@ -340,6 +340,10 @@ class GraphCtrl extends MetricsPanelCtrl {
onContextMenuClose
=
()
=>
{
onContextMenuClose
=
()
=>
{
this
.
contextMenuCtrl
.
toggleMenu
();
this
.
contextMenuCtrl
.
toggleMenu
();
};
};
formatDate
=
(
date
:
DateTimeInput
,
format
?:
string
)
=>
{
return
this
.
dashboard
.
formatDate
.
apply
(
this
.
dashboard
,
[
date
,
format
]);
};
}
}
export
{
GraphCtrl
,
GraphCtrl
as
PanelCtrl
};
export
{
GraphCtrl
,
GraphCtrl
as
PanelCtrl
};
public/app/plugins/panel/graph/template.ts
View file @
81c42fc9
...
@@ -11,6 +11,7 @@ const template = `
...
@@ -11,6 +11,7 @@ const template = `
items="ctrl.contextMenuCtrl.menuItems"
items="ctrl.contextMenuCtrl.menuItems"
onClose="ctrl.onContextMenuClose"
onClose="ctrl.onContextMenuClose"
getContextMenuSource="ctrl.contextMenuCtrl.getSource"
getContextMenuSource="ctrl.contextMenuCtrl.getSource"
formatSourceDate="ctrl.formatDate"
x="ctrl.contextMenuCtrl.position.x"
x="ctrl.contextMenuCtrl.position.x"
y="ctrl.contextMenuCtrl.position.y"
y="ctrl.contextMenuCtrl.position.y"
></graph-context-menu>
></graph-context-menu>
...
...
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