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
bd0f694f
Commit
bd0f694f
authored
Mar 04, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactoring and jshint fix for datasourceFactory func
parent
c018b4bd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
src/app/services/datasourceSrv.js
+10
-4
No files found.
src/app/services/datasourceSrv.js
View file @
bd0f694f
...
@@ -12,18 +12,21 @@ function (angular, _, config) {
...
@@ -12,18 +12,21 @@ function (angular, _, config) {
module
.
service
(
'datasourceSrv'
,
function
(
$q
,
filterSrv
,
$http
,
GraphiteDatasource
,
InfluxDatasource
)
{
module
.
service
(
'datasourceSrv'
,
function
(
$q
,
filterSrv
,
$http
,
GraphiteDatasource
,
InfluxDatasource
)
{
this
.
init
=
function
()
{
var
defaultDatasource
=
_
.
findWhere
(
_
.
values
(
config
.
datasources
),
{
default
:
true
}
);
var
defaultDatasource
=
_
.
findWhere
(
_
.
values
(
config
.
datasources
),
{
default
:
true
}
);
this
.
default
=
this
.
datasourceFactory
(
defaultDatasource
);
this
.
default
=
datasourceFactory
(
defaultDatasource
)
;
}
;
function
datasourceFactory
(
ds
)
{
this
.
datasourceFactory
=
function
(
ds
)
{
switch
(
ds
.
type
)
{
switch
(
ds
.
type
)
{
case
'graphite'
:
case
'graphite'
:
return
new
GraphiteDatasource
(
ds
);
return
new
GraphiteDatasource
(
ds
);
case
'influxdb'
:
case
'influxdb'
:
return
new
InfluxDatasource
(
ds
);
return
new
InfluxDatasource
(
ds
);
}
}
}
}
;
this
.
get
=
function
(
name
)
{
this
.
get
=
function
(
name
)
{
if
(
!
name
)
{
return
this
.
default
;
}
if
(
!
name
)
{
return
this
.
default
;
}
...
@@ -33,7 +36,7 @@ function (angular, _, config) {
...
@@ -33,7 +36,7 @@ function (angular, _, config) {
return
null
;
return
null
;
}
}
return
datasourceFactory
(
ds
);
return
this
.
datasourceFactory
(
ds
);
};
};
this
.
listOptions
=
function
()
{
this
.
listOptions
=
function
()
{
...
@@ -44,5 +47,7 @@ function (angular, _, config) {
...
@@ -44,5 +47,7 @@ function (angular, _, config) {
};
};
});
});
};
};
this
.
init
();
});
});
});
});
\ No newline at end of file
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