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
2dba2f4a
Commit
2dba2f4a
authored
Dec 09, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'with_credentials' of
https://github.com/mtanda/grafana
into mtanda-with_credentials
parents
70542fb7
cd742979
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
5 deletions
+39
-5
pkg/api/datasources.go
+1
-0
pkg/api/dtos/models.go
+1
-0
pkg/api/frontendsettings.go
+3
-0
pkg/models/datasource.go
+3
-0
pkg/services/sqlstore/datasource.go
+2
-0
pkg/services/sqlstore/migrations/datasource_mig.go
+5
-0
pkg/services/sqlstore/migrator/migrations.go
+4
-0
public/app/features/org/partials/datasourceHttpConfig.html
+12
-3
public/app/plugins/datasource/elasticsearch/datasource.js
+4
-1
public/app/plugins/datasource/prometheus/datasource.js
+4
-1
No files found.
pkg/api/datasources.go
View file @
2dba2f4a
...
...
@@ -65,6 +65,7 @@ func GetDataSourceById(c *middleware.Context) Response {
BasicAuth
:
ds
.
BasicAuth
,
BasicAuthUser
:
ds
.
BasicAuthUser
,
BasicAuthPassword
:
ds
.
BasicAuthPassword
,
WithCredentials
:
ds
.
WithCredentials
,
IsDefault
:
ds
.
IsDefault
,
JsonData
:
ds
.
JsonData
,
})
...
...
pkg/api/dtos/models.go
View file @
2dba2f4a
...
...
@@ -61,6 +61,7 @@ type DataSource struct {
BasicAuth
bool
`json:"basicAuth"`
BasicAuthUser
string
`json:"basicAuthUser"`
BasicAuthPassword
string
`json:"basicAuthPassword"`
WithCredentials
bool
`json:"withCredentials"`
IsDefault
bool
`json:"isDefault"`
JsonData
map
[
string
]
interface
{}
`json:"jsonData"`
}
...
...
pkg/api/frontendsettings.go
View file @
2dba2f4a
...
...
@@ -62,6 +62,9 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
if
ds
.
BasicAuth
{
dsMap
[
"basicAuth"
]
=
util
.
GetBasicAuthHeader
(
ds
.
BasicAuthUser
,
ds
.
BasicAuthPassword
)
}
if
ds
.
WithCredentials
{
dsMap
[
"withCredentials"
]
=
ds
.
WithCredentials
}
if
ds
.
Type
==
m
.
DS_INFLUXDB_08
{
dsMap
[
"username"
]
=
ds
.
User
...
...
pkg/models/datasource.go
View file @
2dba2f4a
...
...
@@ -40,6 +40,7 @@ type DataSource struct {
BasicAuth
bool
BasicAuthUser
string
BasicAuthPassword
string
WithCredentials
bool
IsDefault
bool
JsonData
map
[
string
]
interface
{}
...
...
@@ -83,6 +84,7 @@ type AddDataSourceCommand struct {
BasicAuth
bool
`json:"basicAuth"`
BasicAuthUser
string
`json:"basicAuthUser"`
BasicAuthPassword
string
`json:"basicAuthPassword"`
WithCredentials
bool
`json:"withCredentials"`
IsDefault
bool
`json:"isDefault"`
JsonData
map
[
string
]
interface
{}
`json:"jsonData"`
...
...
@@ -103,6 +105,7 @@ type UpdateDataSourceCommand struct {
BasicAuth
bool
`json:"basicAuth"`
BasicAuthUser
string
`json:"basicAuthUser"`
BasicAuthPassword
string
`json:"basicAuthPassword"`
WithCredentials
bool
`json:"withCredentials"`
IsDefault
bool
`json:"isDefault"`
JsonData
map
[
string
]
interface
{}
`json:"jsonData"`
...
...
pkg/services/sqlstore/datasource.go
View file @
2dba2f4a
...
...
@@ -114,12 +114,14 @@ func UpdateDataSource(cmd *m.UpdateDataSourceCommand) error {
BasicAuth
:
cmd
.
BasicAuth
,
BasicAuthUser
:
cmd
.
BasicAuthUser
,
BasicAuthPassword
:
cmd
.
BasicAuthPassword
,
WithCredentials
:
cmd
.
WithCredentials
,
JsonData
:
cmd
.
JsonData
,
Updated
:
time
.
Now
(),
}
sess
.
UseBool
(
"is_default"
)
sess
.
UseBool
(
"basic_auth"
)
sess
.
UseBool
(
"with_credentials"
)
_
,
err
:=
sess
.
Where
(
"id=? and org_id=?"
,
ds
.
Id
,
ds
.
OrgId
)
.
Update
(
ds
)
if
err
!=
nil
{
...
...
pkg/services/sqlstore/migrations/datasource_mig.go
View file @
2dba2f4a
...
...
@@ -96,4 +96,9 @@ func addDataSourceMigration(mg *Migrator) {
}))
mg
.
AddMigration
(
"Drop old table data_source_v1 #2"
,
NewDropTableMigration
(
"data_source_v1"
))
// add column to activate withCredentials option
mg
.
AddMigration
(
"Add column with_credentials"
,
NewAddColumnMigration
(
tableV2
,
&
Column
{
Name
:
"with_credentials"
,
Type
:
DB_Bool
,
Nullable
:
false
,
Default
:
"0"
,
}))
}
pkg/services/sqlstore/migrator/migrations.go
View file @
2dba2f4a
...
...
@@ -64,6 +64,10 @@ type AddColumnMigration struct {
column
*
Column
}
func
NewAddColumnMigration
(
table
Table
,
col
*
Column
)
*
AddColumnMigration
{
return
&
AddColumnMigration
{
tableName
:
table
.
Name
,
column
:
col
}
}
func
(
m
*
AddColumnMigration
)
Table
(
tableName
string
)
*
AddColumnMigration
{
m
.
tableName
=
tableName
return
m
...
...
public/app/features/org/partials/datasourceHttpConfig.html
View file @
2dba2f4a
...
...
@@ -17,7 +17,7 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form last"
>
<div
ng-if=
"!current.withCredentials"
class=
"tight-form last"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
Basic Auth
...
...
@@ -40,5 +40,14 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
ng-if=
"!current.basicAuth"
class=
"tight-form last"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
With Creds
</li>
<li
class=
"tight-form-item"
>
<editor-checkbox
text=
"Enable"
model=
"current.withCredentials"
></editor-checkbox>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
public/app/plugins/datasource/elasticsearch/datasource.js
View file @
2dba2f4a
...
...
@@ -19,6 +19,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
function
ElasticDatasource
(
datasource
)
{
this
.
type
=
'elasticsearch'
;
this
.
basicAuth
=
datasource
.
basicAuth
;
this
.
withCredentials
=
datasource
.
withCredentials
;
this
.
url
=
datasource
.
url
;
this
.
name
=
datasource
.
name
;
this
.
index
=
datasource
.
index
;
...
...
@@ -38,8 +39,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
data
:
data
};
if
(
this
.
basicAuth
)
{
if
(
this
.
basicAuth
||
this
.
withCredentials
)
{
options
.
withCredentials
=
true
;
}
if
(
this
.
basicAuth
)
{
options
.
headers
=
{
"Authorization"
:
this
.
basicAuth
};
...
...
public/app/plugins/datasource/prometheus/datasource.js
View file @
2dba2f4a
...
...
@@ -23,6 +23,7 @@ function (angular, _, moment, dateMath) {
this
.
url
=
datasource
.
url
;
this
.
directUrl
=
datasource
.
directUrl
;
this
.
basicAuth
=
datasource
.
basicAuth
;
this
.
withCredentials
=
datasource
.
withCredentials
;
this
.
lastErrors
=
{};
}
...
...
@@ -32,8 +33,10 @@ function (angular, _, moment, dateMath) {
method
:
method
};
if
(
this
.
basicAuth
)
{
if
(
this
.
basicAuth
||
this
.
withCredentials
)
{
options
.
withCredentials
=
true
;
}
if
(
this
.
basicAuth
)
{
options
.
headers
=
{
"Authorization"
:
this
.
basicAuth
};
...
...
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