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
c709a28f
Commit
c709a28f
authored
Jun 05, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on email and notification infra #1456
parent
3706d0de
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
54 additions
and
15 deletions
+54
-15
main.go
+1
-1
pkg/api/apikey.go
+6
-6
pkg/api/dashboard.go
+1
-1
pkg/api/search.go
+1
-1
pkg/models/emails.go
+39
-0
pkg/services/mailer/mailer.go
+4
-4
pkg/services/notifications/email.go
+0
-0
pkg/services/notifications/notifications.go
+1
-1
pkg/services/search/handlers.go
+0
-0
pkg/services/search/handlers_test.go
+0
-0
pkg/services/search/json_index.go
+0
-0
pkg/services/search/json_index_test.go
+0
-0
pkg/services/search/models.go
+0
-0
pkg/services/sqlstore/dashboard.go
+1
-1
No files found.
main.go
View file @
c709a28f
...
@@ -14,9 +14,9 @@ import (
...
@@ -14,9 +14,9 @@ import (
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/search"
"github.com/grafana/grafana/pkg/services/eventpublisher"
"github.com/grafana/grafana/pkg/services/eventpublisher"
"github.com/grafana/grafana/pkg/services/mailer"
"github.com/grafana/grafana/pkg/services/mailer"
"github.com/grafana/grafana/pkg/services/search"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/social"
"github.com/grafana/grafana/pkg/social"
...
...
pkg/api/apikey.go
View file @
c709a28f
...
@@ -24,12 +24,12 @@ func GetApiKeys(c *middleware.Context) Response {
...
@@ -24,12 +24,12 @@ func GetApiKeys(c *middleware.Context) Response {
}
}
}
}
bus
.
Dispatch
(
&
m
.
SendEmailCommand
{
//
bus.Dispatch(&m.SendEmailCommand{
To
:
[]
string
{
"torkel@raintank.io"
},
//
To: []string{"torkel@raintank.io"},
From
:
"grafana@test.com"
,
//
From: "grafana@test.com",
Subject
:
"Test from Grafana2"
,
//
Subject: "Test from Grafana2",
Body
:
"Body! hej hoppas allt är bra"
,
//
Body: "Body! hej hoppas allt är bra",
})
//
})
return
Json
(
200
,
result
)
return
Json
(
200
,
result
)
}
}
...
...
pkg/api/dashboard.go
View file @
c709a28f
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/middleware"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/search"
"github.com/grafana/grafana/pkg/se
rvices/se
arch"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util"
)
)
...
...
pkg/api/search.go
View file @
c709a28f
...
@@ -3,7 +3,7 @@ package api
...
@@ -3,7 +3,7 @@ package api
import
(
import
(
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/search"
"github.com/grafana/grafana/pkg/se
rvices/se
arch"
)
)
func
Search
(
c
*
middleware
.
Context
)
{
func
Search
(
c
*
middleware
.
Context
)
{
...
...
pkg/models/emails.go
0 → 100644
View file @
c709a28f
package
models
type
SendEmailCommand
struct
{
To
[]
string
From
string
Subject
string
Body
string
Type
string
Massive
bool
Info
string
}
type
SendResetPasswordEmailCommand
struct
{
Email
string
}
// create mail content
func
(
m
*
SendEmailCommand
)
Content
()
string
{
// set mail type
contentType
:=
"text/plain; charset=UTF-8"
if
m
.
Type
==
"html"
{
contentType
=
"text/html; charset=UTF-8"
}
// create mail content
content
:=
"From: "
+
m
.
From
+
"
\r\n
Subject: "
+
m
.
Subject
+
"
\r\n
Content-Type: "
+
contentType
+
"
\r\n\r\n
"
+
m
.
Body
return
content
}
// Create html mail command
func
NewSendEmailCommand
(
To
[]
string
,
From
,
Subject
,
Body
string
)
SendEmailCommand
{
return
SendEmailCommand
{
To
:
To
,
From
:
From
,
Subject
:
Subject
,
Body
:
Body
,
Type
:
"html"
,
}
}
pkg/services/mailer/mailer.go
View file @
c709a28f
...
@@ -15,16 +15,16 @@ import (
...
@@ -15,16 +15,16 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/notification
s"
m
"github.com/grafana/grafana/pkg/model
s"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/setting"
)
)
var
mailQueue
chan
*
notifications
.
SendEmailCommand
var
mailQueue
chan
*
m
.
SendEmailCommand
func
Init
()
{
func
Init
()
{
bus
.
AddHandler
(
"email"
,
handleEmailCommand
)
bus
.
AddHandler
(
"email"
,
handleEmailCommand
)
mailQueue
=
make
(
chan
*
notifications
.
SendEmailCommand
,
10
)
mailQueue
=
make
(
chan
*
m
.
SendEmailCommand
,
10
)
setting
.
Smtp
=
setting
.
SmtpSettings
{
setting
.
Smtp
=
setting
.
SmtpSettings
{
Host
:
"smtp.gmail.com:587"
,
Host
:
"smtp.gmail.com:587"
,
...
@@ -61,7 +61,7 @@ func encodeRFC2047(text string) string {
...
@@ -61,7 +61,7 @@ func encodeRFC2047(text string) string {
return
strings
.
Trim
(
addr
.
String
(),
" <>"
)
return
strings
.
Trim
(
addr
.
String
(),
" <>"
)
}
}
func
handleEmailCommand
(
cmd
*
notifications
.
SendEmailCommand
)
error
{
func
handleEmailCommand
(
cmd
*
m
.
SendEmailCommand
)
error
{
log
.
Info
(
"Sending on queue"
)
log
.
Info
(
"Sending on queue"
)
mailQueue
<-
cmd
mailQueue
<-
cmd
return
nil
return
nil
...
...
pkg/notifications/email.go
→
pkg/
services/
notifications/email.go
View file @
c709a28f
File moved
pkg/notifications/notifications.go
→
pkg/
services/
notifications/notifications.go
View file @
c709a28f
...
@@ -7,5 +7,5 @@ func Init() {
...
@@ -7,5 +7,5 @@ func Init() {
}
}
func
sendResetPasswordEmail
(
cmd
*
SendResetPasswordEmailCommand
)
error
{
func
sendResetPasswordEmail
(
cmd
*
SendResetPasswordEmailCommand
)
error
{
email
:=
NewMailMessage
(
""
)
return
nil
}
}
pkg/search/handlers.go
→
pkg/se
rvices/se
arch/handlers.go
View file @
c709a28f
File moved
pkg/search/handlers_test.go
→
pkg/se
rvices/se
arch/handlers_test.go
View file @
c709a28f
File moved
pkg/search/json_index.go
→
pkg/se
rvices/se
arch/json_index.go
View file @
c709a28f
File moved
pkg/search/json_index_test.go
→
pkg/se
rvices/se
arch/json_index_test.go
View file @
c709a28f
File moved
pkg/search/models.go
→
pkg/se
rvices/se
arch/models.go
View file @
c709a28f
File moved
pkg/services/sqlstore/dashboard.go
View file @
c709a28f
...
@@ -8,7 +8,7 @@ import (
...
@@ -8,7 +8,7 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/metrics"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/search"
"github.com/grafana/grafana/pkg/se
rvices/se
arch"
)
)
func
init
()
{
func
init
()
{
...
...
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