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
9be53f0a
Commit
9be53f0a
authored
Jan 05, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to support sub url
parent
5feed234
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
56 deletions
+37
-56
src/app/components/settings.js
+2
-1
src/app/controllers/grafanaCtrl.js
+1
-0
src/app/controllers/pro/loginCtrl.js
+7
-17
src/app/partials/pro/sidemenu.html
+6
-6
src/app/routes/backend/dashboard.js
+3
-3
src/app/services/backendSrv.js
+3
-2
src/app/services/grafanaDatasource.js
+14
-26
src/views/index.html
+1
-1
No files found.
src/app/components/settings.js
View file @
9be53f0a
...
...
@@ -25,7 +25,8 @@ function (_, crypto) {
playlist_timespan
:
"1m"
,
unsaved_changes_warning
:
true
,
search
:
{
max_results
:
100
},
admin
:
{}
admin
:
{},
appSubUrl
:
""
};
// This initializes a new hash on purpose, to avoid adding parameters to
...
...
src/app/controllers/grafanaCtrl.js
View file @
9be53f0a
...
...
@@ -16,6 +16,7 @@ function (angular, config, _, $, store) {
$rootScope
.
profilingEnabled
=
store
.
getBool
(
'profilingEnabled'
);
$rootScope
.
performance
=
{
loadStart
:
new
Date
().
getTime
()
};
$rootScope
.
appSubUrl
=
config
.
appSubUrl
;
$scope
.
init
=
function
()
{
$scope
.
_
=
_
;
...
...
src/app/controllers/pro/loginCtrl.js
View file @
9be53f0a
define
([
'angular'
,
'config'
,
],
function
(
angular
)
{
function
(
angular
,
config
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$http
,
$location
,
$routeParams
,
alertSrv
)
{
module
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
backendSrv
,
$location
,
$routeParams
,
alertSrv
)
{
$scope
.
loginModel
=
{};
$scope
.
grafana
.
sidemenu
=
false
;
...
...
@@ -17,14 +18,10 @@ function (angular) {
};
$scope
.
logout
=
function
()
{
$http
.
post
(
'/logout'
).
then
(
function
()
{
backendSrv
.
post
(
'/logout'
).
then
(
function
()
{
alertSrv
.
set
(
'Logged out!'
,
''
,
'success'
,
3000
);
$scope
.
appEvent
(
'logged-out'
);
$location
.
search
({});
},
function
()
{
alertSrv
.
set
(
'Logout failed:'
,
'Unexpected error'
,
'error'
,
3000
);
});
};
...
...
@@ -35,16 +32,9 @@ function (angular) {
return
;
}
$http
.
post
(
'/login'
,
$scope
.
loginModel
).
then
(
function
(
results
)
{
$scope
.
appEvent
(
'logged-in'
,
results
.
data
.
user
);
window
.
location
.
href
=
'/'
;
},
function
(
err
)
{
if
(
err
.
status
===
401
)
{
$scope
.
loginError
=
"Username or password is incorrect"
;
}
else
{
$scope
.
loginError
=
"Unexpected error"
;
}
backendSrv
.
post
(
'/login'
,
$scope
.
loginModel
).
then
(
function
(
results
)
{
$scope
.
appEvent
(
'logged-in'
,
results
.
user
);
window
.
location
.
href
=
config
.
appSubUrl
+
'/'
;
});
};
...
...
src/app/partials/pro/sidemenu.html
View file @
9be53f0a
...
...
@@ -8,11 +8,11 @@
<li><a
href=
"/login?logout"
>
Logout
</a></li>
</ul>
</div>
<a
class=
"pro-sidemenu-link"
href=
"/
"
>
<a
class=
"pro-sidemenu-link"
ng-href=
"{{appSubUrl}}
"
>
<i
class=
"icon-th-large"
></i>
Dashboards
</a>
<a
class=
"pro-sidemenu-link"
href=
"
/
charts"
>
<a
class=
"pro-sidemenu-link"
href=
"charts"
>
<i
class=
"icon-signal"
></i>
Graphs
</a>
...
...
@@ -20,19 +20,19 @@
<i
class=
"icon-bolt"
style=
"padding-right: 23px"
></i>
Alerts
</a>
<a
class=
"pro-sidemenu-link"
href=
"
/
admin/datasources"
>
<a
class=
"pro-sidemenu-link"
href=
"admin/datasources"
>
<i
class=
"icon-sitemap"
></i>
Data sources
</a>
<a
class=
"pro-sidemenu-link"
href=
"
/
admin"
>
<a
class=
"pro-sidemenu-link"
href=
"admin"
>
<i
class=
"icon-tasks"
></i>
Global options
</a>
<a
class=
"pro-sidemenu-link"
href=
"
/
account"
>
<a
class=
"pro-sidemenu-link"
href=
"account"
>
<i
class=
"icon-user"
></i>
Account settings
</a>
<a
class=
"pro-sidemenu-link"
href=
"
/
login?logout"
>
<a
class=
"pro-sidemenu-link"
href=
"login?logout"
>
<i
class=
"icon-signout"
></i>
Sign out
</a>
...
...
src/app/routes/backend/dashboard.js
View file @
9be53f0a
...
...
@@ -12,17 +12,17 @@ function (angular, store) {
$routeProvider
.
when
(
'/'
,
{
templateUrl
:
'
/
app/partials/dashboard.html'
,
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromDBProvider'
,
reloadOnSearch
:
false
,
})
.
when
(
'/dashboard/db/:id'
,
{
templateUrl
:
'
/
app/partials/dashboard.html'
,
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromDBProvider'
,
reloadOnSearch
:
false
,
})
.
when
(
'/dashboard/temp/:id'
,
{
templateUrl
:
'
/
app/partials/dashboard.html'
,
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromDBProvider'
,
reloadOnSearch
:
false
,
})
...
...
src/app/services/backendSrv.js
View file @
9be53f0a
define
([
'angular'
,
'lodash'
,
'config'
,
],
function
(
angular
,
_
)
{
function
(
angular
,
_
,
config
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
...
...
@@ -27,7 +28,7 @@ function (angular, _) {
this
.
request
=
function
(
options
)
{
var
httpOptions
=
{
url
:
options
.
url
,
url
:
config
.
appSubUrl
+
options
.
url
,
method
:
options
.
method
,
data
:
options
.
data
};
...
...
src/app/services/grafanaDatasource.js
View file @
9be53f0a
...
...
@@ -7,7 +7,7 @@ function (angular, _) {
var
module
=
angular
.
module
(
'grafana.services'
);
module
.
factory
(
'GrafanaDatasource'
,
function
(
$q
,
$http
)
{
module
.
factory
(
'GrafanaDatasource'
,
function
(
$q
,
backendSrv
)
{
function
GrafanaDatasource
()
{
this
.
type
=
'grafana'
;
...
...
@@ -21,19 +21,13 @@ function (angular, _) {
url
=
'/temp/'
+
id
;
}
return
$http
.
get
(
'/api/dashboards/'
+
id
)
.
then
(
function
(
result
)
{
if
(
result
.
data
)
{
return
angular
.
fromJson
(
result
.
data
);
return
backendSrv
.
get
(
'/api/dashboards/'
+
id
)
.
then
(
function
(
data
)
{
if
(
data
)
{
return
angular
.
fromJson
(
data
);
}
else
{
return
false
;
}
},
function
(
data
)
{
if
(
data
.
status
===
0
)
{
throw
"Could not contact Elasticsearch. Please ensure that Elasticsearch is reachable from your browser."
;
}
else
{
throw
"Could not find dashboard "
+
id
;
}
});
};
...
...
@@ -43,34 +37,28 @@ function (angular, _) {
dashboard
.
id
=
null
;
}
return
$http
.
post
(
'/api/dashboard/'
,
{
dashboard
:
dashboard
})
.
then
(
function
(
result
)
{
return
{
title
:
dashboard
.
title
,
url
:
'/dashboard/db/'
+
result
.
data
.
slug
};
},
function
(
data
)
{
throw
"Failed to search: "
+
data
;
return
backendSrv
.
post
(
'/api/dashboard/'
,
{
dashboard
:
dashboard
})
.
then
(
function
(
data
)
{
return
{
title
:
dashboard
.
title
,
url
:
'/dashboard/db/'
+
data
.
slug
};
});
};
GrafanaDatasource
.
prototype
.
deleteDashboard
=
function
(
id
)
{
return
$http
({
method
:
'DELETE'
,
url
:
'/api/dashboard/'
+
id
})
.
then
(
function
(
result
)
{
return
result
.
data
.
title
;
},
function
(
err
)
{
throw
err
.
data
;
return
backendSrv
.
delete
(
'/api/dashboard/'
+
id
)
.
then
(
function
(
data
)
{
return
data
.
title
;
});
};
GrafanaDatasource
.
prototype
.
searchDashboards
=
function
(
query
)
{
return
$http
.
get
(
'/api/search/'
,
{
params
:
{
q
:
query
}
})
.
then
(
function
(
results
)
{
return
backendSrv
.
get
(
'/api/search/'
,
{
params
:
{
q
:
query
}
})
.
then
(
function
(
data
)
{
var
hits
=
{
dashboards
:
[],
tags
:
[]
};
hits
.
dashboards
=
_
.
map
(
results
.
data
,
function
(
item
)
{
hits
.
dashboards
=
_
.
map
(
data
,
function
(
item
)
{
item
.
id
=
item
.
slug
;
return
item
;
});
return
hits
;
},
function
(
data
)
{
throw
"Failed to search: "
+
data
;
});
};
...
...
src/views/index.html
View file @
9be53f0a
...
...
@@ -52,7 +52,7 @@
<script>
window
.
grafanaBootData
=
{
user
:[[.
User
]],
settings
:
[[.
Settings
]]
settings
:
[[.
Settings
]]
,
};
</script>
</html>
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