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
652fce7e
Commit
652fce7e
authored
Sep 07, 2017
by
wangguoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize some wrong usage and spelling
Signed-off-by: wgliang <liangcszzu@163.com>
parent
e98254e1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
13 deletions
+11
-13
pkg/api/cloudwatch/metrics.go
+1
-3
pkg/components/dashdiffs/formatter_basic.go
+1
-1
pkg/components/dashdiffs/formatter_json.go
+3
-3
pkg/login/auth.go
+2
-2
pkg/middleware/auth_proxy.go
+3
-3
pkg/tsdb/mqe/types_test.go
+1
-1
No files found.
pkg/api/cloudwatch/metrics.go
View file @
652fce7e
...
...
@@ -166,9 +166,7 @@ func handleGetNamespaces(req *cwRequest, c *middleware.Context) {
customNamespaces
:=
req
.
DataSource
.
JsonData
.
Get
(
"customMetricsNamespaces"
)
.
MustString
()
if
customNamespaces
!=
""
{
for
_
,
key
:=
range
strings
.
Split
(
customNamespaces
,
","
)
{
keys
=
append
(
keys
,
key
)
}
keys
=
append
(
keys
,
strings
.
Split
(
customNamespaces
,
","
)
...
)
}
sort
.
Sort
(
sort
.
StringSlice
(
keys
))
...
...
pkg/components/dashdiffs/formatter_basic.go
View file @
652fce7e
...
...
@@ -231,7 +231,7 @@ func (b *BasicDiff) Basic(lines []*JSONLine) []*BasicBlock {
// in the JSON document to a top level key.
//
// In order to produce distinct "blocks" when rendering the basic diff,
// we need a way to distinguish between differnt sections of data.
// we need a way to distinguish between differ
e
nt sections of data.
// To do this, we consider the value(s) of each top-level JSON key to
// represent a distinct block for Grafana's JSON data structure, so
// we perform this check to see if we've entered a new "block". If we
...
...
pkg/components/dashdiffs/formatter_json.go
View file @
652fce7e
...
...
@@ -302,16 +302,16 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
return
nil
}
func
(
f
*
JSONFormatter
)
searchDeltas
(
deltas
[]
diff
.
Delta
,
postion
diff
.
Position
)
(
results
[]
diff
.
Delta
)
{
func
(
f
*
JSONFormatter
)
searchDeltas
(
deltas
[]
diff
.
Delta
,
pos
i
tion
diff
.
Position
)
(
results
[]
diff
.
Delta
)
{
results
=
make
([]
diff
.
Delta
,
0
)
for
_
,
delta
:=
range
deltas
{
switch
delta
.
(
type
)
{
case
diff
.
PostDelta
:
if
delta
.
(
diff
.
PostDelta
)
.
PostPosition
()
==
postion
{
if
delta
.
(
diff
.
PostDelta
)
.
PostPosition
()
==
pos
i
tion
{
results
=
append
(
results
,
delta
)
}
case
diff
.
PreDelta
:
if
delta
.
(
diff
.
PreDelta
)
.
PrePosition
()
==
postion
{
if
delta
.
(
diff
.
PreDelta
)
.
PrePosition
()
==
pos
i
tion
{
results
=
append
(
results
,
delta
)
}
default
:
...
...
pkg/login/auth.go
View file @
652fce7e
...
...
@@ -33,8 +33,8 @@ func AuthenticateUser(query *LoginUserQuery) error {
if
setting
.
LdapEnabled
{
for
_
,
server
:=
range
LdapCfg
.
Servers
{
auth
e
r
:=
NewLdapAuthenticator
(
server
)
err
=
auth
e
r
.
Login
(
query
)
auth
o
r
:=
NewLdapAuthenticator
(
server
)
err
=
auth
o
r
.
Login
(
query
)
if
err
==
nil
||
err
!=
ErrInvalidCredentials
{
return
err
}
...
...
pkg/middleware/auth_proxy.go
View file @
652fce7e
...
...
@@ -67,7 +67,7 @@ func initContextWithAuthProxy(ctx *Context, orgId int64) bool {
if
getRequestUserId
(
ctx
)
>
0
&&
getRequestUserId
(
ctx
)
!=
query
.
Result
.
UserId
{
// remove session
if
err
:=
ctx
.
Session
.
Destory
(
ctx
);
err
!=
nil
{
log
.
Error
(
3
,
"Failed to dest
or
y session, err"
)
log
.
Error
(
3
,
"Failed to dest
ro
y session, err"
)
}
// initialize a new session
...
...
@@ -107,8 +107,8 @@ var syncGrafanaUserWithLdapUser = func(ctx *Context, query *m.GetSignedInUserQue
ldapCfg
:=
login
.
LdapCfg
for
_
,
server
:=
range
ldapCfg
.
Servers
{
auth
e
r
:=
login
.
NewLdapAuthenticator
(
server
)
if
err
:=
auth
e
r
.
SyncSignedInUser
(
query
.
Result
);
err
!=
nil
{
auth
o
r
:=
login
.
NewLdapAuthenticator
(
server
)
if
err
:=
auth
o
r
.
SyncSignedInUser
(
query
.
Result
);
err
!=
nil
{
return
err
}
}
...
...
pkg/tsdb/mqe/types_test.go
View file @
652fce7e
...
...
@@ -71,7 +71,7 @@ func TestWildcardExpansion(t *testing.T) {
So
(
expandeQueries
[
0
]
.
RawQuery
,
ShouldEqual
,
fmt
.
Sprintf
(
"`os.cpu.3.idle`|aggregate.min|aggregate.max where cluster in ('demoapp-1', 'demoapp-2') and host in ('staples-lab-1', 'staples-lab-2') from %v to %v"
,
from
,
to
))
})
Convey
(
"Containg wildcard series"
,
func
()
{
Convey
(
"Contain
in
g wildcard series"
,
func
()
{
query
:=
&
Query
{
Metrics
:
[]
Metric
{
{
Metric
:
"os.cpu*"
,
Alias
:
""
},
...
...
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