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
2e2de38b
Commit
2e2de38b
authored
Aug 13, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mock things
parent
a79c4342
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
11 deletions
+30
-11
public/app/plugins/panel/heatmap/rendering.ts
+1
-1
public/app/plugins/panel/heatmap/specs/renderer.jest.ts
+29
-10
No files found.
public/app/plugins/panel/heatmap/rendering.ts
View file @
2e2de38b
...
...
@@ -456,7 +456,6 @@ export class Link {
this
.
chartHeight
=
this
.
height
-
this
.
margin
.
top
-
this
.
margin
.
bottom
;
this
.
chartTop
=
this
.
margin
.
top
;
this
.
chartBottom
=
this
.
chartTop
+
this
.
chartHeight
;
if
(
this
.
panel
.
dataFormat
===
'tsbuckets'
)
{
this
.
addYAxisFromBuckets
();
}
else
{
...
...
@@ -550,6 +549,7 @@ export class Link {
.
style
(
'opacity'
,
this
.
getCardOpacity
.
bind
(
this
));
let
$cards
=
this
.
$heatmap
.
find
(
'.heatmap-card'
);
console
.
log
(
$cards
);
$cards
.
on
(
'mouseenter'
,
event
=>
{
this
.
tooltip
.
mouseOverBucket
=
true
;
...
...
public/app/plugins/panel/heatmap/specs/renderer.jest.ts
View file @
2e2de38b
...
...
@@ -8,17 +8,24 @@ import TimeSeries from 'app/core/time_series2';
import
moment
from
'moment'
;
// import { Emitter } from 'app/core/core';
import
rendering
from
'../rendering'
;
// import * as d3 from 'd3';
import
{
convertToHeatMap
,
convertToCards
,
histogramToHeatmap
,
calculateBucketSize
}
from
'../heatmap_data_converter'
;
jest
.
mock
(
'app/core/core'
,
()
=>
({
appEvents
:
{
on
:
()
=>
{},
},
contextSrv
:
{
user
:
{
lightTheme
:
false
,
},
},
}));
describe
(
'grafanaHeatmap'
,
function
()
{
// beforeEach(angularMocks.module('grafana.core'));
let
scope
=
<
any
>
{};
let
render
;
function
heatmapScenario
(
desc
,
func
,
elementWidth
=
500
)
{
describe
(
desc
,
function
()
{
...
...
@@ -154,11 +161,20 @@ describe('grafanaHeatmap', function() {
ctrl
.
data
=
ctx
.
data
;
ctx
.
element
=
{
find
:
()
=>
({
on
:
()
=>
{}
}),
find
:
()
=>
({
on
:
()
=>
{},
css
:
()
=>
189
,
width
:
()
=>
189
,
height
:
()
=>
200
,
find
:
()
=>
({
on
:
()
=>
{},
}),
}),
on
:
()
=>
{},
};
rendering
(
scope
,
ctx
.
element
,
[],
ctrl
);
ctrl
.
events
.
emit
(
'render'
);
render
=
rendering
(
scope
,
ctx
.
element
,
[],
ctrl
);
render
.
render
();
render
.
ctrl
.
renderingCompleted
();
});
};
...
...
@@ -172,6 +188,9 @@ describe('grafanaHeatmap', function() {
});
it
(
'should draw correct Y axis'
,
function
()
{
console
.
log
(
'Runnign first test'
);
// console.log(render.ctrl.data);
console
.
log
(
render
.
scope
.
yScale
);
var
yTicks
=
getTicks
(
ctx
.
element
,
'.axis-y'
);
expect
(
yTicks
).
toEqual
([
'1'
,
'2'
,
'3'
]);
});
...
...
@@ -317,13 +336,13 @@ describe('grafanaHeatmap', function() {
});
function
getTicks
(
element
,
axisSelector
)
{
return
element
.
find
(
axisSelector
)
.
find
(
'text'
)
.
map
(
function
()
{
return
this
.
textContent
;
})
.
get
();
//
return element
//
.find(axisSelector)
//
.find('text')
//
.map(function() {
//
return this.textContent;
//
})
//
.get();
}
function
formatTime
(
timeStr
)
{
...
...
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