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
61f6bd2c
Commit
61f6bd2c
authored
Oct 15, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph: added typehead dropdown menu combination for the series override selection
parent
fe620d8e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
5 deletions
+98
-5
src/app/directives/all.js
+1
-0
src/app/directives/dropdown.typeahead.js
+94
-0
src/app/panels/graph/styleEditor.html
+3
-4
src/vendor/jquery/jquery.flot.fillbelow.js
+0
-1
No files found.
src/app/directives/all.js
View file @
61f6bd2c
...
...
@@ -18,5 +18,6 @@ define([
'./templateParamSelector'
,
'./graphiteSegment'
,
'./grafanaVersionCheck'
,
'./dropdown.typeahead'
,
'./influxdbFuncEditor'
],
function
()
{});
src/app/directives/dropdown.typeahead.js
0 → 100644
View file @
61f6bd2c
define
([
'angular'
,
'app'
,
'lodash'
,
'jquery'
,
],
function
(
angular
,
app
,
_
,
$
)
{
'use strict'
;
angular
.
module
(
'grafana.directives'
)
.
directive
(
'dropdownTypeahead'
,
function
(
$compile
)
{
var
inputTemplate
=
'<input type="text"'
+
' class="grafana-target-segment-input input-medium grafana-target-segment-input"'
+
' spellcheck="false" style="display:none"></input>'
;
var
buttonTemplate
=
'<a class="grafana-target-segment grafana-target-function dropdown-toggle"'
+
' tabindex="1" gf-dropdown="menuItems" data-toggle="dropdown"'
+
' data-placement="top"><i class="icon-plus"></i></a>'
;
return
{
scope
:
{
"menuItems"
:
"=dropdownTypeahead"
,
"dropdownTypeaheadOnSelect"
:
"&dropdownTypeaheadOnSelect"
},
link
:
function
(
$scope
,
elem
)
{
var
$input
=
$
(
inputTemplate
);
var
$button
=
$
(
buttonTemplate
);
$input
.
appendTo
(
elem
);
$button
.
appendTo
(
elem
);
var
typeaheadValues
=
_
.
reduce
(
$scope
.
menuItems
,
function
(
memo
,
value
)
{
_
.
each
(
value
.
submenu
,
function
(
item
)
{
memo
.
push
(
value
.
text
+
' '
+
item
.
text
);
});
return
memo
;
},
[]);
$input
.
attr
(
'data-provide'
,
'typeahead'
);
$input
.
typeahead
({
source
:
typeaheadValues
,
minLength
:
1
,
items
:
10
,
updater
:
function
(
value
)
{
var
result
=
{};
_
.
each
(
$scope
.
menuItems
,
function
(
menuItem
,
optionIndex
)
{
_
.
each
(
menuItem
.
submenu
,
function
(
submenuItem
,
valueIndex
)
{
if
(
value
===
(
menuItem
.
text
+
' '
+
submenuItem
.
text
))
{
result
.
$item
=
submenuItem
;
result
.
$optionIndex
=
optionIndex
;
result
.
$valueIndex
=
valueIndex
;
}
});
});
if
(
result
.
$item
)
{
$scope
.
$apply
(
function
()
{
$scope
.
dropdownTypeaheadOnSelect
(
result
);
});
}
$input
.
trigger
(
'blur'
);
return
''
;
}
});
$button
.
click
(
function
()
{
$button
.
hide
();
$input
.
show
();
$input
.
focus
();
});
$input
.
keyup
(
function
()
{
elem
.
toggleClass
(
'open'
,
$input
.
val
()
===
''
);
});
$input
.
blur
(
function
()
{
$input
.
hide
();
$input
.
val
(
''
);
$button
.
show
();
$button
.
focus
();
// clicking the function dropdown menu wont
// work if you remove class at once
setTimeout
(
function
()
{
elem
.
removeClass
(
'open'
);
},
200
);
});
$compile
(
elem
.
contents
())(
$scope
);
}
};
});
});
src/app/panels/graph/styleEditor.html
View file @
61f6bd2c
...
...
@@ -88,11 +88,10 @@
<i
class=
"pointer icon-remove"
ng-click=
"removeOverride(option)"
></i>
{{option.name}}: {{option.value}}
</li>
<li
class=
"dropdown"
>
<a
class=
"dropdown-toggle grafana-target-segment"
data-toggle=
"dropdown"
gf-dropdown=
"overrideMenu"
bs-tooltip=
"'set option to override'"
data-placement=
"top"
>
<i
class=
"icon-plus"
></i>
</a>
<li
class=
"dropdown"
dropdown-typeahead=
"overrideMenu"
dropdown-typeahead-on-select=
"setOverride($optionIndex, $valueIndex)"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
...
...
src/vendor/jquery/jquery.flot.fillbelow.js
View file @
61f6bd2c
...
...
@@ -12,7 +12,6 @@
var
i
;
debugger
;
for
(
i
=
0
;
i
<
allseries
.
length
;
++
i
)
{
if
(
allseries
[
i
].
id
===
series
.
fillBelowTo
)
{
return
allseries
[
i
];
...
...
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