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
f8a4661d
Commit
f8a4661d
authored
May 26, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
1060eeb1
dd494e64
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
9 deletions
+38
-9
pkg/api/api.go
+1
-0
pkg/api/dataproxy.go
+7
-0
pkg/api/user.go
+18
-0
public/app/core/services/backend_srv.js
+5
-0
public/app/features/panel/partials/soloPanel.html
+4
-8
vendor/phantomjs/render.js
+3
-1
No files found.
pkg/api/api.go
View file @
f8a4661d
...
...
@@ -115,6 +115,7 @@ func Register(r *macaron.Macaron) {
r
.
Get
(
"/:id"
,
wrap
(
GetUserById
))
r
.
Get
(
"/:id/orgs"
,
wrap
(
GetUserOrgList
))
r
.
Put
(
"/:id"
,
bind
(
m
.
UpdateUserCommand
{}),
wrap
(
UpdateUser
))
r
.
Post
(
"/:id/using/:orgId"
,
wrap
(
UpdateUserActiveOrg
))
},
reqGrafanaAdmin
)
// org information available to all users.
...
...
pkg/api/dataproxy.go
View file @
f8a4661d
...
...
@@ -55,6 +55,13 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht
req
.
Header
.
Add
(
"Authorization"
,
util
.
GetBasicAuthHeader
(
ds
.
BasicAuthUser
,
ds
.
BasicAuthPassword
))
}
dsAuth
:=
req
.
Header
.
Get
(
"X-DS-Authorization"
)
if
len
(
dsAuth
)
>
0
{
req
.
Header
.
Del
(
"X-DS-Authorization"
)
req
.
Header
.
Del
(
"Authorization"
)
req
.
Header
.
Add
(
"Authorization"
,
dsAuth
)
}
// clear cookie headers
req
.
Header
.
Del
(
"Cookie"
)
req
.
Header
.
Del
(
"Set-Cookie"
)
...
...
pkg/api/user.go
View file @
f8a4661d
...
...
@@ -40,6 +40,24 @@ func UpdateUser(c *middleware.Context, cmd m.UpdateUserCommand) Response {
return
handleUpdateUser
(
cmd
)
}
//POST /api/users/:id/using/:orgId
func
UpdateUserActiveOrg
(
c
*
middleware
.
Context
)
Response
{
userId
:=
c
.
ParamsInt64
(
":id"
)
orgId
:=
c
.
ParamsInt64
(
":orgId"
)
if
!
validateUsingOrg
(
userId
,
orgId
)
{
return
ApiError
(
401
,
"Not a valid organization"
,
nil
)
}
cmd
:=
m
.
SetUsingOrgCommand
{
UserId
:
userId
,
OrgId
:
orgId
}
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
return
ApiError
(
500
,
"Failed change active organization"
,
err
)
}
return
ApiSuccess
(
"Active organization changed"
)
}
func
handleUpdateUser
(
cmd
m
.
UpdateUserCommand
)
Response
{
if
len
(
cmd
.
Login
)
==
0
{
cmd
.
Login
=
cmd
.
Email
...
...
public/app/core/services/backend_srv.js
View file @
f8a4661d
...
...
@@ -96,6 +96,11 @@ function (angular, _, coreModule, config) {
var
requestIsLocal
=
options
.
url
.
indexOf
(
'/'
)
===
0
;
var
firstAttempt
=
options
.
retry
===
0
;
if
(
requestIsLocal
&&
options
.
headers
&&
options
.
headers
.
Authorization
)
{
options
.
headers
[
'X-DS-Authorization'
]
=
options
.
headers
.
Authorization
;
delete
options
.
headers
.
Authorization
;
}
return
$http
(
options
).
then
(
null
,
function
(
err
)
{
// handle unauthorized for backend requests
if
(
requestIsLocal
&&
firstAttempt
&&
err
.
status
===
401
)
{
...
...
public/app/features/panel/partials/soloPanel.html
View file @
f8a4661d
<div
class=
"main"
>
<div
class=
"row-fluid"
>
<div
class=
"span12"
>
<div
class=
"panel nospace"
ng-if=
"panel"
style=
"width: 100%"
>
<plugin-component
type=
"panel"
>
</plugin-component>
</div>
</div>
<div
class=
"panel nospace"
ng-if=
"panel"
style=
"width: 100%"
>
<plugin-component
type=
"panel"
>
</plugin-component>
</div>
<div
class=
"clearfix"
></div>
vendor/phantomjs/render.js
View file @
f8a4661d
...
...
@@ -39,7 +39,8 @@
var
canvas
=
page
.
evaluate
(
function
()
{
if
(
!
window
.
angular
)
{
return
false
;
}
var
body
=
window
.
angular
.
element
(
document
.
body
);
if
(
!
body
.
scope
)
{
return
false
;
}
if
(
!
body
.
injector
)
{
return
false
;
}
if
(
!
body
.
injector
())
{
return
false
;
}
var
rootScope
=
body
.
injector
().
get
(
'$rootScope'
);
if
(
!
rootScope
)
{
return
false
;}
...
...
@@ -59,6 +60,7 @@
width
:
bb
.
width
,
height
:
bb
.
height
};
page
.
render
(
params
.
png
);
phantom
.
exit
();
}
...
...
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