mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
(format) run go fmt in pkg
This commit is contained in:
parent
63bf332023
commit
adb441e5c8
@ -55,8 +55,8 @@ func OAuthLogin(ctx *middleware.Context) {
|
|||||||
ctx.Session.Set(middleware.SESS_KEY_OAUTH_STATE, state)
|
ctx.Session.Set(middleware.SESS_KEY_OAUTH_STATE, state)
|
||||||
if setting.OAuthService.OAuthInfos[name].HostedDomain == "" {
|
if setting.OAuthService.OAuthInfos[name].HostedDomain == "" {
|
||||||
ctx.Redirect(connect.AuthCodeURL(state, oauth2.AccessTypeOnline))
|
ctx.Redirect(connect.AuthCodeURL(state, oauth2.AccessTypeOnline))
|
||||||
}else{
|
} else {
|
||||||
ctx.Redirect(connect.AuthCodeURL(state, oauth2.SetParam("hd", setting.OAuthService.OAuthInfos[name].HostedDomain), oauth2.AccessTypeOnline));
|
ctx.Redirect(connect.AuthCodeURL(state, oauth2.SetParam("hd", setting.OAuthService.OAuthInfos[name].HostedDomain), oauth2.AccessTypeOnline))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type DatabaseConfig struct {
|
type DatabaseConfig struct {
|
||||||
Type, Host, Name, User, Pwd, Path, SslMode string
|
Type, Host, Name, User, Pwd, Path, SslMode string
|
||||||
CaCertPath string
|
CaCertPath string
|
||||||
|
@ -186,7 +186,7 @@ func (s *GenericOAuth) UserInfo(client *http.Client) (*BasicUserInfo, error) {
|
|||||||
Email: data.Email,
|
Email: data.Email,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userInfo.Email == "" && data.Attributes["email:primary"] != nil) {
|
if userInfo.Email == "" && data.Attributes["email:primary"] != nil {
|
||||||
userInfo.Email = data.Attributes["email:primary"][0]
|
userInfo.Email = data.Attributes["email:primary"][0]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,11 +197,11 @@ func (s *GenericOAuth) UserInfo(client *http.Client) (*BasicUserInfo, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userInfo.Login == "" && data.Username != "") {
|
if userInfo.Login == "" && data.Username != "" {
|
||||||
userInfo.Login = data.Username
|
userInfo.Login = data.Username
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userInfo.Login == "") {
|
if userInfo.Login == "" {
|
||||||
userInfo.Login = data.Email
|
userInfo.Login = data.Email
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package opentsdb
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||||
"github.com/grafana/grafana/pkg/tsdb"
|
"github.com/grafana/grafana/pkg/tsdb"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestOpenTsdbExecutor(t *testing.T) {
|
func TestOpenTsdbExecutor(t *testing.T) {
|
||||||
@ -23,8 +23,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
|||||||
query.Model.Set("aggregator", "avg")
|
query.Model.Set("aggregator", "avg")
|
||||||
query.Model.Set("disableDownsampling", false)
|
query.Model.Set("disableDownsampling", false)
|
||||||
query.Model.Set("downsampleInterval", "")
|
query.Model.Set("downsampleInterval", "")
|
||||||
query.Model.Set("downsampleAggregator","avg")
|
query.Model.Set("downsampleAggregator", "avg")
|
||||||
query.Model.Set("downsampleFillPolicy","none")
|
query.Model.Set("downsampleFillPolicy", "none")
|
||||||
|
|
||||||
metric := exec.buildMetric(query)
|
metric := exec.buildMetric(query)
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
|||||||
query.Model.Set("aggregator", "avg")
|
query.Model.Set("aggregator", "avg")
|
||||||
query.Model.Set("disableDownsampling", true)
|
query.Model.Set("disableDownsampling", true)
|
||||||
query.Model.Set("downsampleInterval", "")
|
query.Model.Set("downsampleInterval", "")
|
||||||
query.Model.Set("downsampleAggregator","avg")
|
query.Model.Set("downsampleAggregator", "avg")
|
||||||
query.Model.Set("downsampleFillPolicy","none")
|
query.Model.Set("downsampleFillPolicy", "none")
|
||||||
|
|
||||||
metric := exec.buildMetric(query)
|
metric := exec.buildMetric(query)
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
|||||||
query.Model.Set("aggregator", "avg")
|
query.Model.Set("aggregator", "avg")
|
||||||
query.Model.Set("disableDownsampling", false)
|
query.Model.Set("disableDownsampling", false)
|
||||||
query.Model.Set("downsampleInterval", "5m")
|
query.Model.Set("downsampleInterval", "5m")
|
||||||
query.Model.Set("downsampleAggregator","sum")
|
query.Model.Set("downsampleAggregator", "sum")
|
||||||
query.Model.Set("downsampleFillPolicy","null")
|
query.Model.Set("downsampleFillPolicy", "null")
|
||||||
|
|
||||||
metric := exec.buildMetric(query)
|
metric := exec.buildMetric(query)
|
||||||
|
|
||||||
@ -87,8 +87,8 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
|||||||
query.Model.Set("aggregator", "avg")
|
query.Model.Set("aggregator", "avg")
|
||||||
query.Model.Set("disableDownsampling", true)
|
query.Model.Set("disableDownsampling", true)
|
||||||
query.Model.Set("downsampleInterval", "5m")
|
query.Model.Set("downsampleInterval", "5m")
|
||||||
query.Model.Set("downsampleAggregator","sum")
|
query.Model.Set("downsampleAggregator", "sum")
|
||||||
query.Model.Set("downsampleFillPolicy","null")
|
query.Model.Set("downsampleFillPolicy", "null")
|
||||||
|
|
||||||
tags := simplejson.New()
|
tags := simplejson.New()
|
||||||
tags.Set("env", "prod")
|
tags.Set("env", "prod")
|
||||||
@ -117,7 +117,7 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
|||||||
query.Model.Set("aggregator", "avg")
|
query.Model.Set("aggregator", "avg")
|
||||||
query.Model.Set("disableDownsampling", true)
|
query.Model.Set("disableDownsampling", true)
|
||||||
query.Model.Set("shouldComputeRate", true)
|
query.Model.Set("shouldComputeRate", true)
|
||||||
query.Model.Set("isCounter",false)
|
query.Model.Set("isCounter", false)
|
||||||
|
|
||||||
tags := simplejson.New()
|
tags := simplejson.New()
|
||||||
tags.Set("env", "prod")
|
tags.Set("env", "prod")
|
||||||
@ -147,9 +147,9 @@ func TestOpenTsdbExecutor(t *testing.T) {
|
|||||||
query.Model.Set("aggregator", "avg")
|
query.Model.Set("aggregator", "avg")
|
||||||
query.Model.Set("disableDownsampling", true)
|
query.Model.Set("disableDownsampling", true)
|
||||||
query.Model.Set("shouldComputeRate", true)
|
query.Model.Set("shouldComputeRate", true)
|
||||||
query.Model.Set("isCounter",true)
|
query.Model.Set("isCounter", true)
|
||||||
query.Model.Set("counterMax",45)
|
query.Model.Set("counterMax", 45)
|
||||||
query.Model.Set("counterResetValue",60)
|
query.Model.Set("counterResetValue", 60)
|
||||||
|
|
||||||
tags := simplejson.New()
|
tags := simplejson.New()
|
||||||
tags.Set("env", "prod")
|
tags.Set("env", "prod")
|
||||||
|
Loading…
Reference in New Issue
Block a user