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
8ea43517
Commit
8ea43517
authored
Apr 03, 2014
by
Nikolay Bryskin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import from non-default dashboard support
parent
34a18514
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
src/app/controllers/graphiteImport.js
+15
-2
src/app/partials/import.html
+10
-1
No files found.
src/app/controllers/graphiteImport.js
View file @
8ea43517
...
...
@@ -12,12 +12,25 @@ function (angular, app, _) {
$scope
.
init
=
function
()
{
console
.
log
(
'hej!'
);
$scope
.
datasources
=
datasourceSrv
.
listOptions
();
$scope
.
setDatasource
(
datasourceSrv
.
default
.
value
);
};
$scope
.
setDatasource
=
function
(
datasource
)
{
$scope
.
datasource
=
datasourceSrv
.
get
(
datasource
);
if
(
!
$scope
.
datasource
)
{
$scope
.
error
=
"Cannot find datasource "
+
datasource
;
return
;
}
};
$scope
.
listAll
=
function
(
query
)
{
delete
$scope
.
error
;
datasourceSrv
.
default
.
listDashboards
(
query
)
$scope
.
datasource
.
listDashboards
(
query
)
.
then
(
function
(
results
)
{
$scope
.
dashboards
=
results
;
})
...
...
@@ -29,7 +42,7 @@ function (angular, app, _) {
$scope
.
import
=
function
(
dashName
)
{
delete
$scope
.
error
;
datasourceSrv
.
default
.
loadDashboard
(
dashName
)
$scope
.
datasource
.
loadDashboard
(
dashName
)
.
then
(
function
(
results
)
{
if
(
!
results
.
data
||
!
results
.
data
.
state
)
{
throw
{
message
:
'no dashboard state received from graphite'
};
...
...
src/app/partials/import.html
View file @
8ea43517
<div
ng-controller=
"GraphiteImportCtrl"
ng-init=
"init()"
>
<div
ng-controller=
"GraphiteImportCtrl"
ng-init=
"init()"
style=
"height: 400px"
>
<h5>
Import dashboards from graphite web
</h5>
<div
class=
"editor-row"
>
<div
class=
"section"
>
<div
class=
"btn-group"
>
<button
class=
"btn btn-info dropdown-toggle"
data-toggle=
"dropdown"
bs-tooltip=
"'Datasource'"
>
{{datasource.name}}
<span
class=
"caret"
></span></button>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li
ng-repeat=
"datasource in datasources"
role=
"menuitem"
>
<a
ng-click=
"setDatasource(datasource.value);"
>
{{datasource.name}}
</a>
</li>
</ul>
</div>
<button
ng-click=
"listAll()"
class=
"btn btn-primary"
>
List all dashboards
</button>
</div>
</div>
...
...
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