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
f1591955
Commit
f1591955
authored
May 17, 2018
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explore: fixes #11953
parent
0841e67d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletions
+66
-1
public/app/features/panel/metrics_panel_ctrl.ts
+1
-1
public/app/features/panel/specs/metrics_panel_ctrl.jest.ts
+65
-0
No files found.
public/app/features/panel/metrics_panel_ctrl.ts
View file @
f1591955
...
...
@@ -312,7 +312,7 @@ class MetricsPanelCtrl extends PanelCtrl {
getAdditionalMenuItems
()
{
const
items
=
[];
if
(
this
.
datasource
.
supportsExplore
)
{
if
(
this
.
datasource
&&
this
.
datasource
.
supportsExplore
)
{
items
.
push
({
text
:
'Explore'
,
click
:
'ctrl.explore();'
,
...
...
public/app/features/panel/specs/metrics_panel_ctrl.jest.ts
0 → 100644
View file @
f1591955
jest
.
mock
(
'app/core/core'
,
()
=>
({}));
import
{
MetricsPanelCtrl
}
from
'../metrics_panel_ctrl'
;
import
q
from
'q'
;
import
{
PanelModel
}
from
'app/features/dashboard/panel_model'
;
describe
(
'MetricsPanelCtrl'
,
()
=>
{
let
ctrl
;
beforeEach
(()
=>
{
ctrl
=
setupController
();
});
describe
(
'when getting additional menu items'
,
()
=>
{
let
additionalItems
;
describe
(
'and has no datasource set'
,
()
=>
{
beforeEach
(()
=>
{
additionalItems
=
ctrl
.
getAdditionalMenuItems
();
});
it
(
'should not return any items'
,
()
=>
{
expect
(
additionalItems
.
length
).
toBe
(
0
);
});
});
describe
(
'and has datasource set that supports explore'
,
()
=>
{
beforeEach
(()
=>
{
ctrl
.
datasource
=
{
supportsExplore
:
true
};
additionalItems
=
ctrl
.
getAdditionalMenuItems
();
});
it
(
'should not return any items'
,
()
=>
{
expect
(
additionalItems
.
length
).
toBe
(
1
);
});
});
});
});
function
setupController
()
{
const
injectorStub
=
{
get
:
type
=>
{
switch
(
type
)
{
case
'$q'
:
{
return
q
;
}
default
:
{
return
jest
.
fn
();
}
}
},
};
const
scope
=
{
panel
:
{
events
:
[]
},
appEvent
:
jest
.
fn
(),
onAppEvent
:
jest
.
fn
(),
$on
:
jest
.
fn
(),
colors
:
[],
};
MetricsPanelCtrl
.
prototype
.
panel
=
new
PanelModel
({
type
:
'test'
});
return
new
MetricsPanelCtrl
(
scope
,
injectorStub
);
}
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