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
4dfe8b6f
Commit
4dfe8b6f
authored
Sep 17, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on login user name state
parent
ecafc7bf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
12 deletions
+38
-12
grafana
+1
-1
pkg/api/api.go
+7
-1
pkg/api/api_login.go
+7
-3
pkg/api/api_models.go
+11
-2
views/index.html
+12
-5
No files found.
grafana
@
4f798cfe
Subproject commit 4
b382e0faff3fa2e5c05ca3306d54d8e5f8ca89c
Subproject commit 4
f798cfe568db2491fe5eea3f06ddd3027117e90
pkg/api/api.go
View file @
4dfe8b6f
...
...
@@ -58,7 +58,13 @@ func (self *HttpServer) ListenAndServe() {
}
func
(
self
*
HttpServer
)
index
(
c
*
gin
.
Context
)
{
c
.
HTML
(
200
,
"index.html"
,
&
indexViewModel
{
title
:
"hello from go"
})
viewModel
:=
&
IndexDto
{}
login
,
_
:=
c
.
Get
(
"login"
)
if
login
!=
nil
{
viewModel
.
User
.
Login
=
login
.
(
string
)
}
c
.
HTML
(
200
,
"index.html"
,
viewModel
)
}
func
CacheHeadersMiddleware
()
gin
.
HandlerFunc
{
...
...
pkg/api/api_login.go
View file @
4dfe8b6f
...
...
@@ -35,12 +35,15 @@ func (self *HttpServer) loginPost(c *gin.Context) {
}
session
,
_
:=
sessionStore
.
Get
(
c
.
Request
,
"grafana-session"
)
session
.
Values
[
"login"
]
=
true
session
.
Values
[
"login"
]
=
loginModel
.
Email
session
.
Values
[
"accountId"
]
=
account
.
DatabaseId
session
.
Save
(
c
.
Request
,
c
.
Writer
)
c
.
JSON
(
200
,
gin
.
H
{
"status"
:
"you are logged in"
})
var
resp
=
&
LoginResultDto
{}
resp
.
Status
=
"Logged in"
resp
.
User
.
Login
=
account
.
Login
c
.
JSON
(
200
,
resp
)
}
func
(
self
*
HttpServer
)
logoutPost
(
c
*
gin
.
Context
)
{
...
...
@@ -73,6 +76,7 @@ func (self *HttpServer) auth() gin.HandlerFunc {
}
c
.
Set
(
"accountId"
,
session
.
Values
[
"accountId"
])
c
.
Set
(
"login"
,
session
.
Values
[
"login"
])
session
.
Save
(
c
.
Request
,
c
.
Writer
)
}
...
...
pkg/api/api_models.go
View file @
4dfe8b6f
...
...
@@ -10,8 +10,17 @@ type errorResponse struct {
Message
string
`json:"message"`
}
type
indexViewModel
struct
{
title
string
type
IndexDto
struct
{
User
CurrentUserDto
}
type
CurrentUserDto
struct
{
Login
string
`json:"login"`
}
type
LoginResultDto
struct
{
Status
string
`json:"status"`
User
CurrentUserDto
`json:"user"`
}
func
newErrorResponse
(
message
string
)
*
errorResponse
{
...
...
views/index.html
View file @
4dfe8b6f
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html
class=
"no-js"
lang=
"en"
>
<!--<![endif]-->
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
...
...
@@ -8,6 +7,7 @@
<title>
Grafana
</title>
<link
rel=
"stylesheet"
href=
"/public/css/grafana.dark.min.css"
title=
"Dark"
>
<link
rel=
"icon"
type=
"image/png"
href=
"img/fav32.png"
>
<base
href=
"/"
>
<!-- build:js app/app.js -->
...
...
@@ -20,12 +20,11 @@
</head>
<body
ng-cloak
ng-controller=
"GrafanaCtrl"
>
<link
rel=
"stylesheet"
href=
"/public/css/grafana.light.min.css"
ng-if=
"grafana.style === 'light'"
>
<div
class=
"pro-container"
ng-class=
"{'pro-sidemenu-open':
showProSideM
enu}"
>
<div
class=
"pro-container"
ng-class=
"{'pro-sidemenu-open':
grafana.sidem
enu}"
>
<aside
class=
"pro-sidemenu"
ng-if=
"
showProSideM
enu"
>
<aside
class=
"pro-sidemenu"
ng-if=
"
grafana.sidem
enu"
>
<div
ng-include=
"'app/partials/pro/sidemenu.html'"
></div>
</aside>
...
...
@@ -39,4 +38,12 @@
</div>
</body>
<script>
window
.
grafanaBootData
=
{
user
:
{
login
:
[[.
User
.
Login
]]
}
};
</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