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
efca9e90
Commit
efca9e90
authored
Apr 07, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mixed_typeahead' of
https://github.com/mtanda/grafana
into mtanda-mixed_typeahead
parents
1cd632cc
988ed069
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
public/app/features/panel/metrics_ds_selector.ts
+19
-16
No files found.
public/app/features/panel/metrics_ds_selector.ts
View file @
efca9e90
...
...
@@ -17,7 +17,7 @@ var template = `
</label>
<metric-segment segment="ctrl.dsSegment"
get-options="ctrl.getOptions()"
get-options="ctrl.getOptions(
true
)"
on-change="ctrl.datasourceChanged()"></metric-segment>
</div>
...
...
@@ -28,15 +28,9 @@ var template = `
</button>
<div class="dropdown" ng-if="ctrl.current.meta.mixed">
<button class="btn btn-inverse dropdown-toggle gf-form-btn" data-toggle="dropdown">
Add Query <span class="fa fa-caret-down"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="datasource in ctrl.datasources" role="menuitem" ng-hide="datasource.meta.builtIn">
<a ng-click="ctrl.addDataQuery(datasource);">{{datasource.name}}</a>
</li>
</ul>
<metric-segment segment="ctrl.mixedDsSegment"
get-options="ctrl.getOptions(false)"
on-change="ctrl.mixedDatasourceChanged()"></metric-segment>
</div>
</div>
</div>
...
...
@@ -46,6 +40,7 @@ var template = `
export
class
MetricsDsSelectorCtrl
{
dsSegment
:
any
;
mixedDsSegment
:
any
;
dsName
:
string
;
panelCtrl
:
any
;
datasources
:
any
[];
...
...
@@ -68,10 +63,13 @@ export class MetricsDsSelectorCtrl {
}
this
.
dsSegment
=
uiSegmentSrv
.
newSegment
({
value
:
this
.
current
.
name
,
selectMode
:
true
});
this
.
mixedDsSegment
=
uiSegmentSrv
.
newSegment
({
value
:
'Add query'
,
selectMode
:
true
});
}
getOptions
()
{
return
Promise
.
resolve
(
this
.
datasources
.
map
(
value
=>
{
getOptions
(
includeBuiltin
)
{
return
Promise
.
resolve
(
this
.
datasources
.
filter
(
value
=>
{
return
includeBuiltin
||
!
value
.
meta
.
builtIn
;
}).
map
(
value
=>
{
return
this
.
uiSegmentSrv
.
newSegment
(
value
.
name
);
}));
}
...
...
@@ -84,13 +82,18 @@ export class MetricsDsSelectorCtrl {
}
}
addDataQuery
(
datasource
)
{
mixedDatasourceChanged
(
)
{
var
target
:
any
=
{
isNew
:
true
};
if
(
datasource
)
{
target
.
datasource
=
datasource
.
name
;
var
ds
=
_
.
find
(
this
.
datasources
,
{
name
:
this
.
mixedDsSegment
.
value
});
if
(
ds
)
{
target
.
datasource
=
ds
.
name
;
this
.
panelCtrl
.
panel
.
targets
.
push
(
target
);
this
.
mixedDsSegment
.
value
=
''
;
}
}
addDataQuery
()
{
var
target
:
any
=
{
isNew
:
true
};
this
.
panelCtrl
.
panel
.
targets
.
push
(
target
);
}
}
...
...
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