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
8722ee8a
Commit
8722ee8a
authored
Feb 13, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Worked on playlist update for Grafana 2.0, added dashboard search to playliststart view, #1460
parent
1a440361
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
69 deletions
+91
-69
pkg/api/admin_settings.go
+1
-0
src/app/features/dashboard/playlistCtrl.js
+20
-11
src/app/features/dashboard/playlistSrv.js
+6
-2
src/app/partials/playlist.html
+64
-32
src/app/services/userSrv.js
+0
-24
No files found.
pkg/api/admin_settings.go
View file @
8722ee8a
...
@@ -20,6 +20,7 @@ func AdminGetSettings(c *middleware.Context) {
...
@@ -20,6 +20,7 @@ func AdminGetSettings(c *middleware.Context) {
if
strings
.
Contains
(
keyName
,
"secret"
)
||
strings
.
Contains
(
keyName
,
"password"
)
{
if
strings
.
Contains
(
keyName
,
"secret"
)
||
strings
.
Contains
(
keyName
,
"password"
)
{
value
=
"************"
value
=
"************"
}
}
jsonSec
[
keyName
]
=
value
jsonSec
[
keyName
]
=
value
}
}
}
}
...
...
src/app/features/dashboard/playlistCtrl.js
View file @
8722ee8a
...
@@ -8,29 +8,38 @@ function (angular, _, config) {
...
@@ -8,29 +8,38 @@ function (angular, _, config) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'PlaylistCtrl'
,
function
(
$scope
,
playlistSrv
)
{
module
.
controller
(
'PlaylistCtrl'
,
function
(
$scope
,
playlistSrv
,
datasourceSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
$scope
.
playlist
=
[];
$scope
.
timespan
=
config
.
playlist_timespan
;
$scope
.
timespan
=
config
.
playlist_timespan
;
$scope
.
loadFavorites
();
$scope
.
db
=
datasourceSrv
.
getGrafanaDB
();
$scope
.
search
();
};
};
$scope
.
loadFavorites
=
function
()
{
$scope
.
search
=
function
()
{
$scope
.
favDashboards
=
playlistSrv
.
getFavorites
().
dashboards
;
var
query
=
{
starred
:
true
,
limit
:
10
}
;
_
.
each
(
$scope
.
favDashboards
,
function
(
dashboard
)
{
if
(
$scope
.
searchQuery
)
{
dashboard
.
include
=
true
;
query
.
query
=
$scope
.
searchQuery
;
query
.
starred
=
false
;
}
$scope
.
db
.
searchDashboards
(
query
).
then
(
function
(
results
)
{
$scope
.
searchHits
=
results
.
dashboards
;
});
});
};
};
$scope
.
removeAsFavorite
=
function
(
dashboard
)
{
$scope
.
addDashboard
=
function
(
dashboard
)
{
playlistSrv
.
removeAsFavorite
(
dashboard
);
$scope
.
playlist
.
push
(
dashboard
);
$scope
.
loadFavorites
();
};
$scope
.
removeDashboard
=
function
(
dashboard
)
{
$scope
.
playlist
=
_
.
without
(
$scope
.
playlist
,
dashboard
);
};
};
$scope
.
start
=
function
()
{
$scope
.
start
=
function
()
{
var
included
=
_
.
where
(
$scope
.
favDashboards
,
{
include
:
true
});
playlistSrv
.
start
(
$scope
.
playlist
,
$scope
.
timespan
);
playlistSrv
.
start
(
included
,
$scope
.
timespan
);
};
};
});
});
...
...
src/app/features/dashboard/playlistSrv.js
View file @
8722ee8a
...
@@ -61,6 +61,8 @@ function (angular, _, kbn, store) {
...
@@ -61,6 +61,8 @@ function (angular, _, kbn, store) {
};
};
this
.
start
=
function
(
dashboards
,
timespan
)
{
this
.
start
=
function
(
dashboards
,
timespan
)
{
this
.
stop
();
var
interval
=
kbn
.
interval_to_ms
(
timespan
);
var
interval
=
kbn
.
interval_to_ms
(
timespan
);
var
index
=
0
;
var
index
=
0
;
...
@@ -69,8 +71,10 @@ function (angular, _, kbn, store) {
...
@@ -69,8 +71,10 @@ function (angular, _, kbn, store) {
timerInstance
=
setInterval
(
function
()
{
timerInstance
=
setInterval
(
function
()
{
$rootScope
.
$apply
(
function
()
{
$rootScope
.
$apply
(
function
()
{
angular
.
element
(
window
).
unbind
(
'resize'
);
angular
.
element
(
window
).
unbind
(
'resize'
);
$location
.
search
({});
var
dash
=
dashboards
[
index
%
dashboards
.
length
];
$location
.
path
(
dashboards
[
index
%
dashboards
.
length
].
url
);
var
relativeUrl
=
dash
.
url
.
substring
(
$location
.
absUrl
().
length
-
$location
.
url
().
length
);
$location
.
url
(
relativeUrl
);
index
++
;
index
++
;
});
});
},
interval
);
},
interval
);
...
...
src/app/partials/playlist.html
View file @
8722ee8a
...
@@ -12,56 +12,88 @@
...
@@ -12,56 +12,88 @@
</div>
</div>
<div
class=
"gf-box-body"
>
<div
class=
"gf-box-body"
>
<div
class=
"row"
style=
"margin-bottom: 10px;"
>
<div
class=
"span6"
>
<div
style=
"display: inline-block"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
>
Search
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-xlarge last"
ng-model=
"searchQuery"
placeholder=
"query or empty for starred"
ng-change=
"search()"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
<div
class=
"span6"
>
<h5>
Playlist dashboards
</h5>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"row"
>
<div
class=
"section"
>
<div
class=
"span6"
>
<div
class=
"editor-option"
>
<table
class=
"grafana-options-table"
>
<table
class=
"table table-striped span4"
>
<tr
ng-repeat=
"dashboard in searchHits"
>
<tr>
<th>
Dashboard
</th>
<th>
Include
</th>
<th
style=
"white-space: nowrap;"
>
Remove as favorite
</th>
</tr>
<tr
ng-repeat=
"dashboard in favDashboards"
>
<td
style=
"white-space: nowrap;"
>
<td
style=
"white-space: nowrap;"
>
{{dashboard.title}}
{{dashboard.title}}
</td>
</td>
<td
style=
"text-align: center"
>
<td
style=
"text-align: center"
>
<input
id=
"dash-{{$index}}"
class=
"cr1"
type=
"checkbox"
ng-model=
"dashboard.include"
ng-checked=
"dashboard.include"
/>
<button
class=
"btn btn-inverse btn-mini pull-right"
ng-click=
"addDashboard(dashboard)"
>
<label
for=
"dash-{{$index}}"
class=
"cr1"
></label>
<i
class=
"fa fa-arrow-right"
></i>
</button>
</td>
</tr>
<tr
ng-hide=
"searchHits.length"
>
<td
colspan=
"3"
>
<i
class=
"fa fa-warning"
></i>
No dashboards found
</td>
</tr>
</table>
</div>
<div
class=
"span6"
>
<table
class=
"grafana-options-table"
>
<tr
ng-repeat=
"dashboard in playlist"
>
<td
style=
"white-space: nowrap;"
>
{{dashboard.title}}
</td>
</td>
<td
style=
"text-align: center"
>
<td
style=
"text-align: center"
>
<i
class=
"fa fa-remove pointer"
ng-click=
"removeAsFavorite(dashboard)"
></i>
<button
class=
"btn btn-inverse btn-mini pull-right"
ng-click=
"removeDashboard(dashboard)"
>
<i
class=
"fa fa-remove"
></i>
</button>
</td>
</td>
</tr>
</tr>
<tr
ng-hide=
"favDashboard
s.length"
>
<tr
ng-hide=
"searchHit
s.length"
>
<td
colspan=
"3"
>
<td
colspan=
"3"
>
<i
class=
"fa fa-warning"
></i>
No dashboards marked as favorites
<i
class=
"fa fa-warning"
></i>
No dashboards found
</td>
</td>
</tr>
</tr>
</table>
</table>
</div>
</div>
<div
class=
"editor-option"
>
<div
class=
"span4"
>
<span><i
class=
"fa fa-question-circle"
></i>
dashboards available in the playlist are only the ones marked as favorites (stored in local browser storage).
to mark a dashboard as favorite, use save icon in the menu and in the dropdown select mark as favorite
<br/><br/>
</span>
</div>
</div>
</div>
<div
class=
"editor-option"
>
<label>
<br>
Timespan between change
<br>
</label>
<div
class=
"pull-left"
>
<input
type=
"text"
class=
"input-small"
ng-model=
"timespan"
/>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
>
Timespan between dashboard change
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-small"
ng-model=
"timespan"
/>
</li>
<li>
<button
class=
"btn btn-success tight-form-btn"
ng-click=
"start();dismiss();"
><i
class=
"fa fa-play"
></i>
Start
</button>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
</div>
</div>
<
div
class=
"clearfix"
><
/div>
<br>
<button
class=
"btn btn-success pull-right"
ng-click=
"start();dismiss();"
><i
class=
"fa fa-play"
></i>
Start
</button>
<br>
</div>
</div>
</div>
</div>
src/app/services/userSrv.js
deleted
100644 → 0
View file @
1a440361
define
([
'angular'
,
'lodash'
,
],
function
(
angular
,
_
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
module
.
service
(
'userSrv'
,
function
()
{
function
User
()
{
if
(
window
.
grafanaBootData
.
user
)
{
_
.
extend
(
this
,
window
.
grafanaBootData
.
user
);
}
}
this
.
getSignedInUser
=
function
()
{
return
new
User
();
};
});
});
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