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
4f8b2ad2
Commit
4f8b2ad2
authored
Aug 25, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
began work on filtering overhaul
parent
03353cb6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
50 deletions
+70
-50
src/app/panels/filtering/editor.html
+0
-0
src/app/panels/filtering/module.html
+30
-32
src/app/services/annotationsSrv.js
+2
-4
src/app/services/dashboard/dashboardSrv.js
+19
-12
src/test/specs/dashboardSrv-specs.js
+19
-2
No files found.
src/app/panels/filtering/editor.html
0 → 100644
View file @
4f8b2ad2
src/app/panels/filtering/module.html
View file @
4f8b2ad2
<div
ng-controller=
'filtering'
ng-init=
"init()"
>
<div
class=
'filtering-container'
>
<div
ng-repeat=
"filter in filter.templateParameters"
class=
"small filter-panel-filter"
>
<div>
<i
class=
"filter-action pointer icon-remove"
bs-tooltip=
"'Remove'"
ng-click=
"remove(filter)"
></i>
<i
class=
"filter-action pointer icon-edit"
ng-hide=
"filter.editing"
bs-tooltip=
"'Edit'"
ng-click=
"filter.editing = true"
></i>
</div>
<div
ng-hide=
"filter.editing"
style=
"margin-right: 45px;"
>
<ul
class=
"unstyled"
>
<li
ng-if=
"filter.name"
class=
"dropdown"
>
{{filter.name}} :
...
...
@@ -22,29 +14,35 @@
</ul>
</li>
</ul>
</div>
</div>
<form
ng-show=
"filter.editing"
>
<ul
class=
"unstyled"
>
<li>
<strong>
name
</strong>
:
<br/>
<input
type=
'text'
ng-model=
"filter.name"
>
</li>
<li>
<strong>
filter.query
</strong>
:
<br/>
<input
type=
'text'
ng-model=
"filter.query"
>
</li>
<li>
<label
for=
"includeAll"
>
Include all:
</label>
<input
id=
"includeAll"
type=
'checkbox'
ng-model=
"filter.includeAll"
>
</li>
</ul>
<div>
<input
type=
"submit"
value=
"Update"
ng-click=
"applyFilter(filter)"
class=
"filter-apply btn btn-success btn-mini"
bs-tooltip=
"'Update and refresh'"
/>
<button
ng-click=
"filter.editing=undefined"
class=
"filter-apply btn btn-mini"
bs-tooltip=
"'Save without refresh'"
>
Close
</button>
</div>
</form>
</div>
<i
class=
"pointer icon-plus-sign add-filter-action"
ng-click=
"add()"
bs-tooltip=
"'Add metric filter / param'"
data-placement=
"right"
></i>
</div>
<div
class=
"submenu-control-edit"
>
<i
class=
"icon-cog pointer"
config-modal=
"app/panels/filtering/editor.html"
bs-tooltip=
"'Edit'"
></i>
</div>
</div>
<!-- <form ng-show="filter.editing"> -->
<!-- <ul class="unstyled"> -->
<!-- <li> -->
<!-- <strong>name</strong>:<br/> -->
<!-- <input type='text' ng-model="filter.name"> -->
<!-- </li> -->
<!-- <li> -->
<!-- <strong>filter.query</strong>:<br/> -->
<!-- <input type='text' ng-model="filter.query"> -->
<!-- </li> -->
<!-- <li> -->
<!-- <label for="includeAll">Include all:</label> -->
<!-- <input id="includeAll" type='checkbox' ng-model="filter.includeAll"> -->
<!-- </li> -->
<!-- </ul> -->
<!-- <div> -->
<!-- <input type="submit" value="Update" ng-click="applyFilter(filter)" class="filter-apply btn btn-success btn-mini" bs-tooltip="'Update and refresh'"/> -->
<!-- <button ng-click="filter.editing=undefined" class="filter-apply btn btn-mini" bs-tooltip="'Save without refresh'">Close</button> -->
<!-- </div> -->
<!-- </form> -->
<!-- </div> -->
<!-- <i class="pointer icon-plus-sign add-filter-action" ng-click="add()" bs-tooltip="'Add metric filter / param'" data-placement="right"></i> -->
<!-- </div> -->
</div>
src/app/services/annotationsSrv.js
View file @
4f8b2ad2
...
...
@@ -9,7 +9,6 @@ define([
module
.
service
(
'annotationsSrv'
,
function
(
datasourceSrv
,
$q
,
alertSrv
,
$rootScope
)
{
var
promiseCached
;
var
annotationPanel
;
var
list
=
[];
var
timezone
;
...
...
@@ -23,8 +22,7 @@ define([
};
this
.
getAnnotations
=
function
(
filterSrv
,
rangeUnparsed
,
dashboard
)
{
annotationPanel
=
_
.
findWhere
(
dashboard
.
pulldowns
,
{
type
:
'annotations'
});
if
(
!
annotationPanel
.
enable
)
{
if
(
!
dashboard
.
annotations
.
enable
)
{
return
$q
.
when
(
null
);
}
...
...
@@ -33,7 +31,7 @@ define([
}
timezone
=
dashboard
.
timezone
;
var
annotations
=
_
.
where
(
annotationPanel
.
annotations
,
{
enable
:
true
});
var
annotations
=
_
.
where
(
dashboard
.
annotations
.
list
,
{
enable
:
true
});
var
promises
=
_
.
map
(
annotations
,
function
(
annotation
)
{
var
datasource
=
datasourceSrv
.
get
(
annotation
.
datasource
);
...
...
src/app/services/dashboard/dashboardSrv.js
View file @
4f8b2ad2
...
...
@@ -27,10 +27,10 @@ function (angular, $, kbn, _, moment) {
this
.
timezone
=
data
.
timezone
||
'browser'
;
this
.
editable
=
data
.
editble
||
true
;
this
.
rows
=
data
.
rows
||
[];
this
.
pulldowns
=
data
.
pulldowns
||
[];
this
.
nav
=
data
.
nav
||
[];
this
.
time
=
data
.
time
||
{
from
:
'now-6h'
,
to
:
'now'
};
this
.
templating
=
data
.
templating
||
{
list
:
[]
};
this
.
templating
=
data
.
templating
||
{
list
:
[],
enable
:
false
};
this
.
annotations
=
data
.
annotations
||
{
list
:
[],
enable
:
false
};
this
.
refresh
=
data
.
refresh
;
this
.
version
=
data
.
version
||
0
;
...
...
@@ -38,14 +38,6 @@ function (angular, $, kbn, _, moment) {
this
.
nav
.
push
({
type
:
'timepicker'
});
}
if
(
!
_
.
findWhere
(
this
.
pulldowns
,
{
type
:
'filtering'
}))
{
this
.
pulldowns
.
push
({
type
:
'filtering'
,
enable
:
false
});
}
if
(
!
_
.
findWhere
(
this
.
pulldowns
,
{
type
:
'annotations'
}))
{
this
.
pulldowns
.
push
({
type
:
'annotations'
,
enable
:
false
});
}
this
.
updateSchema
(
data
);
}
...
...
@@ -147,9 +139,9 @@ function (angular, $, kbn, _, moment) {
p
.
updateSchema
=
function
(
old
)
{
var
oldVersion
=
this
.
version
;
var
panelUpgrades
=
[];
this
.
version
=
4
;
this
.
version
=
5
;
if
(
oldVersion
===
4
)
{
if
(
oldVersion
===
5
)
{
return
;
}
...
...
@@ -224,6 +216,21 @@ function (angular, $, kbn, _, moment) {
});
}
if
(
oldVersion
<
5
)
{
// move pulldowns to new schema
var
filtering
=
_
.
findWhere
(
old
.
pulldowns
,
{
type
:
'filtering'
});
var
annotations
=
_
.
findWhere
(
old
.
pulldowns
,
{
type
:
'annotations'
});
if
(
filtering
)
{
this
.
templating
.
enable
=
filtering
.
enable
;
}
if
(
annotations
)
{
this
.
annotations
=
{
list
:
annotations
.
annotations
,
enable
:
annotations
.
enable
};
}
}
if
(
panelUpgrades
.
length
===
0
)
{
return
;
}
...
...
src/test/specs/dashboardSrv-specs.js
View file @
4f8b2ad2
...
...
@@ -18,7 +18,6 @@ define([
it
(
'should have default properties'
,
function
()
{
expect
(
model
.
rows
.
length
).
to
.
be
(
0
);
expect
(
model
.
nav
.
length
).
to
.
be
(
1
);
expect
(
model
.
pulldowns
.
length
).
to
.
be
(
2
);
});
});
...
...
@@ -91,6 +90,17 @@ define([
beforeEach
(
inject
(
function
(
dashboardSrv
)
{
model
=
dashboardSrv
.
create
({
services
:
{
filter
:
{
time
:
{
from
:
'now-1d'
,
to
:
'now'
},
list
:
[
1
]
}},
pulldowns
:
[
{
type
:
'filtering'
,
enable
:
true
},
{
type
:
'annotations'
,
enable
:
true
,
annotations
:
[{
name
:
'old'
}]
}
],
rows
:
[
{
panels
:
[
...
...
@@ -140,8 +150,15 @@ define([
expect
(
graph
.
seriesOverrides
[
0
].
yaxis
).
to
.
be
(
2
);
});
it
(
'should move pulldowns to new schema'
,
function
()
{
expect
(
model
.
templating
.
enable
).
to
.
be
(
true
);
expect
(
model
.
annotations
.
enable
).
to
.
be
(
true
);
expect
(
model
.
annotations
.
list
[
0
].
name
).
to
.
be
(
'old'
);
});
it
(
'dashboard schema version should be set to latest'
,
function
()
{
expect
(
model
.
version
).
to
.
be
(
4
);
expect
(
model
.
version
).
to
.
be
(
5
);
});
});
...
...
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