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
aa47b9bf
Commit
aa47b9bf
authored
Apr 14, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: simplified backend_srv and subUrl handling, #8122
parent
b77991f6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
public/app/core/services/backend_srv.ts
+4
-6
public/app/plugins/panel/gettingstarted/module.ts
+2
-2
No files found.
public/app/core/services/backend_srv.ts
View file @
aa47b9bf
...
...
@@ -66,16 +66,14 @@ export class BackendSrv {
var
requestIsLocal
=
!
options
.
url
.
match
(
/^http/
);
var
firstAttempt
=
options
.
retry
===
0
;
if
(
requestIsLocal
)
{
if
(
this
.
contextSrv
.
user
&&
this
.
contextSrv
.
user
.
orgId
)
{
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
;
if
(
options
.
url
.
indexOf
(
"/"
)
===
0
)
{
options
.
url
=
options
.
url
.
substring
(
1
);
}
}
...
...
@@ -142,8 +140,8 @@ export class BackendSrv {
options
.
headers
[
'X-Grafana-Org-Id'
]
=
this
.
contextSrv
.
user
.
orgId
;
}
if
(
!
options
.
hasSubUrl
&&
options
.
retry
===
0
)
{
options
.
url
=
config
.
appSubUrl
+
options
.
url
;
if
(
options
.
url
.
indexOf
(
"/"
)
===
0
)
{
options
.
url
=
options
.
url
.
substring
(
1
)
;
}
if
(
options
.
headers
&&
options
.
headers
.
Authorization
)
{
...
...
public/app/plugins/panel/gettingstarted/module.ts
View file @
aa47b9bf
...
...
@@ -58,7 +58,7 @@ class GettingStartedPanelCtrl extends PanelCtrl {
icon
:
'icon-gf icon-gf-users'
,
href
:
'org/users?gettingstarted'
,
check
:
()
=>
{
return
this
.
backendSrv
.
get
(
'api/org/users'
).
then
(
res
=>
{
return
this
.
backendSrv
.
get
(
'
/
api/org/users'
).
then
(
res
=>
{
return
res
.
length
>
1
;
});
}
...
...
@@ -71,7 +71,7 @@ class GettingStartedPanelCtrl extends PanelCtrl {
icon
:
'icon-gf icon-gf-apps'
,
href
:
'https://grafana.com/plugins?utm_source=grafana_getting_started'
,
check
:
()
=>
{
return
this
.
backendSrv
.
get
(
'api/plugins'
,
{
embedded
:
0
,
core
:
0
}).
then
(
plugins
=>
{
return
this
.
backendSrv
.
get
(
'
/
api/plugins'
,
{
embedded
:
0
,
core
:
0
}).
then
(
plugins
=>
{
return
plugins
.
length
>
0
;
});
}
...
...
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