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
b77991f6
Commit
b77991f6
authored
Apr 14, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: minor changes to #8122
parent
f490c5f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
public/app/core/services/backend_srv.ts
+24
-19
No files found.
public/app/core/services/backend_srv.ts
View file @
b77991f6
...
@@ -63,17 +63,20 @@ export class BackendSrv {
...
@@ -63,17 +63,20 @@ export class BackendSrv {
request
(
options
)
{
request
(
options
)
{
options
.
retry
=
options
.
retry
||
0
;
options
.
retry
=
options
.
retry
||
0
;
var
requestIsLocal
=
options
.
url
.
indexOf
(
'/'
)
===
0
;
var
requestIsLocal
=
!
options
.
url
.
match
(
/^http/
)
;
var
firstAttempt
=
options
.
retry
===
0
;
var
firstAttempt
=
options
.
retry
===
0
;
if
(
!
options
.
url
.
match
(
'https?://'
)
&&
this
.
contextSrv
&&
this
.
contextSrv
.
user
&&
this
.
contextSrv
.
user
.
orgId
)
{
options
.
headers
=
options
.
headers
||
{};
options
.
headers
[
'X-Grafana-Org-Id'
]
=
this
.
contextSrv
.
user
.
orgId
;
}
if
(
requestIsLocal
&&
!
options
.
hasSubUrl
)
{
if
(
requestIsLocal
)
{
options
.
url
=
config
.
appSubUrl
+
options
.
url
;
if
(
this
.
contextSrv
.
user
&&
this
.
contextSrv
.
user
.
orgId
)
{
options
.
hasSubUrl
=
true
;
options
.
headers
=
options
.
headers
||
{};
options
.
headers
[
'X-Grafana-Org-Id'
]
=
this
.
contextSrv
.
user
.
orgId
;
}
if
(
!
options
.
hasSubUrl
)
{
options
.
url
=
config
.
appSubUrl
+
options
.
url
;
options
.
hasSubUrl
=
true
;
}
}
}
return
this
.
$http
(
options
).
then
(
results
=>
{
return
this
.
$http
(
options
).
then
(
results
=>
{
...
@@ -130,21 +133,23 @@ export class BackendSrv {
...
@@ -130,21 +133,23 @@ export class BackendSrv {
this
.
addCanceler
(
requestId
,
canceler
);
this
.
addCanceler
(
requestId
,
canceler
);
}
}
var
requestIsLocal
=
options
.
url
.
indexOf
(
'/'
)
===
0
;
var
requestIsLocal
=
!
options
.
url
.
match
(
/^http/
)
;
var
firstAttempt
=
options
.
retry
===
0
;
var
firstAttempt
=
options
.
retry
===
0
;
if
(
!
options
.
url
.
match
(
'https?://'
)
&&
this
.
contextSrv
&&
this
.
contextSrv
.
user
&&
this
.
contextSrv
.
user
.
orgId
)
{
if
(
requestIsLocal
)
{
options
.
headers
=
options
.
headers
||
{};
if
(
this
.
contextSrv
.
user
&&
this
.
contextSrv
.
user
.
orgId
)
{
options
.
headers
[
'X-Grafana-Org-Id'
]
=
this
.
contextSrv
.
user
.
orgId
;
options
.
headers
=
options
.
headers
||
{};
}
options
.
headers
[
'X-Grafana-Org-Id'
]
=
this
.
contextSrv
.
user
.
orgId
;
}
if
(
requestIsLocal
&&
!
options
.
hasSubUrl
&&
options
.
retry
===
0
)
{
if
(
!
options
.
hasSubUrl
&&
options
.
retry
===
0
)
{
options
.
url
=
config
.
appSubUrl
+
options
.
url
;
options
.
url
=
config
.
appSubUrl
+
options
.
url
;
}
}
if
(
requestIsLocal
&&
options
.
headers
&&
options
.
headers
.
Authorization
)
{
if
(
options
.
headers
&&
options
.
headers
.
Authorization
)
{
options
.
headers
[
'X-DS-Authorization'
]
=
options
.
headers
.
Authorization
;
options
.
headers
[
'X-DS-Authorization'
]
=
options
.
headers
.
Authorization
;
delete
options
.
headers
.
Authorization
;
delete
options
.
headers
.
Authorization
;
}
}
}
return
this
.
$http
(
options
).
catch
(
err
=>
{
return
this
.
$http
(
options
).
catch
(
err
=>
{
...
...
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