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
89d4db8e
Commit
89d4db8e
authored
Mar 11, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teams: team listing shows only your teams (editors).
parent
1f949e58
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
pkg/api/team.go
+6
-0
pkg/models/team.go
+1
-0
pkg/services/sqlstore/team.go
+4
-0
public/app/features/teams/state/actions.ts
+4
-2
No files found.
pkg/api/team.go
View file @
89d4db8e
...
@@ -86,10 +86,16 @@ func SearchTeams(c *m.ReqContext) Response {
...
@@ -86,10 +86,16 @@ func SearchTeams(c *m.ReqContext) Response {
page
=
1
page
=
1
}
}
var
userIdFilter
int64
if
c
.
QueryBool
(
"showMine"
)
{
userIdFilter
=
c
.
SignedInUser
.
UserId
}
query
:=
m
.
SearchTeamsQuery
{
query
:=
m
.
SearchTeamsQuery
{
OrgId
:
c
.
OrgId
,
OrgId
:
c
.
OrgId
,
Query
:
c
.
Query
(
"query"
),
Query
:
c
.
Query
(
"query"
),
Name
:
c
.
Query
(
"name"
),
Name
:
c
.
Query
(
"name"
),
UserIdFilter
:
userIdFilter
,
Page
:
page
,
Page
:
page
,
Limit
:
perPage
,
Limit
:
perPage
,
}
}
...
...
pkg/models/team.go
View file @
89d4db8e
...
@@ -66,6 +66,7 @@ type SearchTeamsQuery struct {
...
@@ -66,6 +66,7 @@ type SearchTeamsQuery struct {
Limit
int
Limit
int
Page
int
Page
int
OrgId
int64
OrgId
int64
UserIdFilter
int64
Result
SearchTeamQueryResult
Result
SearchTeamQueryResult
}
}
...
...
pkg/services/sqlstore/team.go
View file @
89d4db8e
...
@@ -149,6 +149,10 @@ func SearchTeams(query *m.SearchTeamsQuery) error {
...
@@ -149,6 +149,10 @@ func SearchTeams(query *m.SearchTeamsQuery) error {
params
:=
make
([]
interface
{},
0
)
params
:=
make
([]
interface
{},
0
)
sql
.
WriteString
(
getTeamSelectSqlBase
())
sql
.
WriteString
(
getTeamSelectSqlBase
())
if
query
.
UserIdFilter
>
0
{
sql
.
WriteString
(
`INNER JOIN team_member on team.id = team_member.team_id AND team_member.user_id = ?`
)
params
=
append
(
params
,
query
.
UserIdFilter
)
}
sql
.
WriteString
(
` WHERE team.org_id = ?`
)
sql
.
WriteString
(
` WHERE team.org_id = ?`
)
params
=
append
(
params
,
query
.
OrgId
)
params
=
append
(
params
,
query
.
OrgId
)
...
...
public/app/features/teams/state/actions.ts
View file @
89d4db8e
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
ThunkAction
}
from
'redux-thunk'
;
import
{
getBackendSrv
}
from
'app/core/services/backend_srv'
;
import
{
getBackendSrv
}
from
'app/core/services/backend_srv'
;
import
{
StoreState
,
Team
,
TeamGroup
,
TeamMember
}
from
'app/types'
;
import
{
OrgRole
,
StoreState
,
Team
,
TeamGroup
,
TeamMember
}
from
'app/types'
;
import
{
updateNavIndex
,
UpdateNavIndexAction
}
from
'app/core/actions'
;
import
{
updateNavIndex
,
UpdateNavIndexAction
}
from
'app/core/actions'
;
import
{
buildNavModel
}
from
'./navModel'
;
import
{
buildNavModel
}
from
'./navModel'
;
import
{
contextSrv
}
from
'../../../core/services/context_srv'
;
export
enum
ActionTypes
{
export
enum
ActionTypes
{
LoadTeams
=
'LOAD_TEAMS'
,
LoadTeams
=
'LOAD_TEAMS'
,
...
@@ -85,7 +86,8 @@ export const setSearchQuery = (searchQuery: string): SetSearchQueryAction => ({
...
@@ -85,7 +86,8 @@ export const setSearchQuery = (searchQuery: string): SetSearchQueryAction => ({
export
function
loadTeams
():
ThunkResult
<
void
>
{
export
function
loadTeams
():
ThunkResult
<
void
>
{
return
async
dispatch
=>
{
return
async
dispatch
=>
{
const
response
=
await
getBackendSrv
().
get
(
'/api/teams/search'
,
{
perpage
:
1000
,
page
:
1
});
const
showMine
=
contextSrv
.
user
.
orgRole
===
OrgRole
.
Editor
;
const
response
=
await
getBackendSrv
().
get
(
'/api/teams/search'
,
{
perpage
:
1000
,
page
:
1
,
showMine
});
dispatch
(
teamsLoaded
(
response
.
teams
));
dispatch
(
teamsLoaded
(
response
.
teams
));
};
};
}
}
...
...
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