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
467b7a40
Commit
467b7a40
authored
Mar 08, 2019
by
Hugo Häggmark
Committed by
Leonard Gram
Mar 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teams: feature toggle component
parent
aedc4782
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
11 deletions
+72
-11
public/app/core/components/WithFeatureToggle.tsx
+13
-0
public/app/features/teams/TeamMembers.tsx
+7
-1
public/app/features/teams/__snapshots__/TeamMembers.test.tsx.snap
+52
-10
No files found.
public/app/core/components/WithFeatureToggle.tsx
0 → 100644
View file @
467b7a40
import
React
,
{
FunctionComponent
}
from
'react'
;
export
interface
Props
{
featureToggle
:
boolean
;
}
export
const
WithFeatureToggle
:
FunctionComponent
<
Props
>
=
({
featureToggle
,
children
})
=>
{
if
(
featureToggle
===
true
)
{
return
<>
{
children
}
</>;
}
return
null
;
};
public/app/features/teams/TeamMembers.tsx
View file @
467b7a40
...
...
@@ -8,6 +8,8 @@ import { TeamMember, User, teamsPermissionLevels } from 'app/types';
import
{
loadTeamMembers
,
addTeamMember
,
removeTeamMember
,
setSearchMemberQuery
}
from
'./state/actions'
;
import
{
getSearchMemberQuery
,
getTeamMembers
}
from
'./state/selectors'
;
import
{
FilterInput
}
from
'app/core/components/FilterInput/FilterInput'
;
import
{
WithFeatureToggle
}
from
'app/core/components/WithFeatureToggle'
;
import
{
config
}
from
'app/core/config'
;
export
interface
Props
{
members
:
TeamMember
[];
...
...
@@ -78,6 +80,7 @@ export class TeamMembers extends PureComponent<Props, State> {
</
td
>
<
td
>
{
member
.
login
}
</
td
>
<
td
>
{
member
.
email
}
</
td
>
<
WithFeatureToggle
featureToggle=
{
config
.
editorsCanOwn
}
>
<
td
>
<
div
className=
"gf-form"
>
<
Select
...
...
@@ -89,7 +92,8 @@ export class TeamMembers extends PureComponent<Props, State> {
isDisabled=
{
true
}
/>
</
div
>
</
td
>
{
' '
}
</
td
>
</
WithFeatureToggle
>
{
syncEnabled
&&
this
.
renderLabels
(
member
.
labels
)
}
<
td
className=
"text-right"
>
<
DeleteButton
onConfirm=
{
()
=>
this
.
onRemoveMember
(
member
)
}
/>
...
...
@@ -145,7 +149,9 @@ export class TeamMembers extends PureComponent<Props, State> {
<
th
/>
<
th
>
Name
</
th
>
<
th
>
Email
</
th
>
<
WithFeatureToggle
featureToggle=
{
config
.
editorsCanOwn
}
>
<
th
>
Permission
</
th
>
</
WithFeatureToggle
>
{
syncEnabled
&&
<
th
/>
}
<
th
style=
{
{
width
:
'1%'
}
}
/>
</
tr
>
...
...
public/app/features/teams/__snapshots__/TeamMembers.test.tsx.snap
View file @
467b7a40
...
...
@@ -69,9 +69,13 @@ exports[`Render should render component 1`] = `
<th>
Email
</th>
<Component
featureToggle={false}
>
<th>
Permission
</th>
</Component>
<th
style={
Object {
...
...
@@ -156,9 +160,13 @@ exports[`Render should render team members 1`] = `
<th>
Email
</th>
<Component
featureToggle={false}
>
<th>
Permission
</th>
</Component>
<th
style={
Object {
...
...
@@ -186,6 +194,9 @@ exports[`Render should render team members 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -227,7 +238,7 @@ exports[`Render should render team members 1`] = `
/>
</div>
</td>
</Component>
<td
className="text-right"
>
...
...
@@ -253,6 +264,9 @@ exports[`Render should render team members 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -294,7 +308,7 @@ exports[`Render should render team members 1`] = `
/>
</div>
</td>
</Component>
<td
className="text-right"
>
...
...
@@ -320,6 +334,9 @@ exports[`Render should render team members 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -361,7 +378,7 @@ exports[`Render should render team members 1`] = `
/>
</div>
</td>
</Component>
<td
className="text-right"
>
...
...
@@ -387,6 +404,9 @@ exports[`Render should render team members 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -428,7 +448,7 @@ exports[`Render should render team members 1`] = `
/>
</div>
</td>
</Component>
<td
className="text-right"
>
...
...
@@ -454,6 +474,9 @@ exports[`Render should render team members 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -495,7 +518,7 @@ exports[`Render should render team members 1`] = `
/>
</div>
</td>
</Component>
<td
className="text-right"
>
...
...
@@ -579,9 +602,13 @@ exports[`Render should render team members when sync enabled 1`] = `
<th>
Email
</th>
<Component
featureToggle={false}
>
<th>
Permission
</th>
</Component>
<th />
<th
style={
...
...
@@ -610,6 +637,9 @@ exports[`Render should render team members when sync enabled 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -651,7 +681,7 @@ exports[`Render should render team members when sync enabled 1`] = `
/>
</div>
</td>
</Component>
<td>
<TagBadge
count={0}
...
...
@@ -693,6 +723,9 @@ exports[`Render should render team members when sync enabled 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -734,7 +767,7 @@ exports[`Render should render team members when sync enabled 1`] = `
/>
</div>
</td>
</Component>
<td>
<TagBadge
count={0}
...
...
@@ -776,6 +809,9 @@ exports[`Render should render team members when sync enabled 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -817,7 +853,7 @@ exports[`Render should render team members when sync enabled 1`] = `
/>
</div>
</td>
</Component>
<td>
<TagBadge
count={0}
...
...
@@ -859,6 +895,9 @@ exports[`Render should render team members when sync enabled 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -900,7 +939,7 @@ exports[`Render should render team members when sync enabled 1`] = `
/>
</div>
</td>
</Component>
<td>
<TagBadge
count={0}
...
...
@@ -942,6 +981,9 @@ exports[`Render should render team members when sync enabled 1`] = `
<td>
test@test.com
</td>
<Component
featureToggle={false}
>
<td>
<div
className="gf-form"
...
...
@@ -983,7 +1025,7 @@ exports[`Render should render team members when sync enabled 1`] = `
/>
</div>
</td>
</Component>
<td>
<TagBadge
count={0}
...
...
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