Skip to content
This repository was archived by the owner on Aug 25, 2021. It is now read-only.

Commit 7bcf771

Browse files
authored
Merge pull request #77 from Hyperkid123/rbac-components-fix
Rbac components fix
2 parents c66b3c1 + 60b8800 commit 7bcf771

15 files changed

+256
-307
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"babel-preset-env": "^1.7.0",
7575
"babel-preset-es2015": "^6.24.1",
7676
"babel-preset-react": "^6.24.1",
77+
"@babel/runtime": "7.0.0-beta.55",
7778
"bootstrap": "^4.1.1",
7879
"copy-webpack-plugin": "^4.3.1",
7980
"coveralls": "^3.0.0",

src/rbac-forms/rbacAssignUserTags.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,7 @@ class RbacAssignCompanyTags extends Component {
170170
type: 'pf',
171171
name: 'user',
172172
}}
173-
rows={[...users.map(({ role, current_group, ...rest }) => ({ // eslint-disable-line camelcase
174-
role: role.label,
175-
current_group: current_group.label,
176-
...rest,
177-
}))]}
173+
rows={[...users]}
178174
columns={columns}
179175
rowKey="id"
180176
rowClick={() => {}}

src/rbac-forms/rbacUserForm.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const RbacUserForm = ({
3636
form: { change, reset },
3737
}) => (
3838
<PfForm horizontal>
39-
<Grid>
39+
<Grid fluid>
4040
<Row>
4141
<Col xs={12}>
4242
<Field

src/rbac-forms/tests/__snapshots__/rbacAssignUserTags.test.jsx.snap

Lines changed: 119 additions & 201 deletions
Large diffs are not rendered by default.

src/rbac-forms/tests/__snapshots__/rbacUserForm.test.jsx.snap

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ exports[`RbacUserForm component Should render correctly 1`] = `
116116
<Grid
117117
bsClass="container"
118118
componentClass="div"
119-
fluid={false}
119+
fluid={true}
120120
>
121121
<div
122-
className="container"
122+
className="container-fluid"
123123
>
124124
<Row
125125
bsClass="row"
@@ -587,6 +587,25 @@ exports[`RbacUserForm component Should render correctly 1`] = `
587587
</FormControl>
588588
</div>
589589
</Col>
590+
<Col
591+
bsClass="col"
592+
componentClass="div"
593+
md={2}
594+
>
595+
<div
596+
className="col-md-2"
597+
>
598+
<button
599+
className="button-link"
600+
id="password-change-enabler"
601+
onClick={[Function]}
602+
tabIndex="-1"
603+
type="button"
604+
>
605+
Change stored password
606+
</button>
607+
</div>
608+
</Col>
590609
</div>
591610
</FormGroup>
592611
</FinalFormComponent>
@@ -1298,7 +1317,7 @@ exports[`RbacUserForm component Should render correctly 1`] = `
12981317
onTouchMove={[Function]}
12991318
onTouchStart={[Function]}
13001319
>
1301-
<span
1320+
<div
13021321
className="Select-multi-value-wrapper"
13031322
id="react-select-2--value"
13041323
>
@@ -1325,7 +1344,7 @@ exports[`RbacUserForm component Should render correctly 1`] = `
13251344
}
13261345
tabIndex={0}
13271346
/>
1328-
</span>
1347+
</div>
13291348
<span
13301349
className="Select-arrow-zone"
13311350
onMouseDown={[Function]}
@@ -1582,10 +1601,10 @@ exports[`RbacUserForm component Should render editing version 1`] = `
15821601
<Grid
15831602
bsClass="container"
15841603
componentClass="div"
1585-
fluid={false}
1604+
fluid={true}
15861605
>
15871606
<div
1588-
className="container"
1607+
className="container-fluid"
15891608
>
15901609
<Row
15911610
bsClass="row"
@@ -2053,6 +2072,25 @@ exports[`RbacUserForm component Should render editing version 1`] = `
20532072
</FormControl>
20542073
</div>
20552074
</Col>
2075+
<Col
2076+
bsClass="col"
2077+
componentClass="div"
2078+
md={2}
2079+
>
2080+
<div
2081+
className="col-md-2"
2082+
>
2083+
<button
2084+
className="button-link"
2085+
id="password-change-enabler"
2086+
onClick={[Function]}
2087+
tabIndex="-1"
2088+
type="button"
2089+
>
2090+
Change stored password
2091+
</button>
2092+
</div>
2093+
</Col>
20562094
</div>
20572095
</FormGroup>
20582096
</FinalFormComponent>
@@ -2795,7 +2833,7 @@ exports[`RbacUserForm component Should render editing version 1`] = `
27952833
onTouchMove={[Function]}
27962834
onTouchStart={[Function]}
27972835
>
2798-
<span
2836+
<div
27992837
className="Select-multi-value-wrapper"
28002838
id="react-select-3--value"
28012839
>
@@ -2813,6 +2851,18 @@ exports[`RbacUserForm component Should render editing version 1`] = `
28132851
"value": "10000000000026",
28142852
}
28152853
}
2854+
values={
2855+
Array [
2856+
Object {
2857+
"label": "Cloud-Users",
2858+
"value": "10000000000026",
2859+
},
2860+
Object {
2861+
"label": "EvmGroup-consumption_administrator",
2862+
"value": "10000000000016",
2863+
},
2864+
]
2865+
}
28162866
>
28172867
<div
28182868
className="Select-value"
@@ -2856,6 +2906,18 @@ exports[`RbacUserForm component Should render editing version 1`] = `
28562906
"value": "10000000000016",
28572907
}
28582908
}
2909+
values={
2910+
Array [
2911+
Object {
2912+
"label": "Cloud-Users",
2913+
"value": "10000000000026",
2914+
},
2915+
Object {
2916+
"label": "EvmGroup-consumption_administrator",
2917+
"value": "10000000000016",
2918+
},
2919+
]
2920+
}
28592921
>
28602922
<div
28612923
className="Select-value"
@@ -2903,7 +2965,7 @@ exports[`RbacUserForm component Should render editing version 1`] = `
29032965
}
29042966
tabIndex={0}
29052967
/>
2906-
</span>
2968+
</div>
29072969
<span
29082970
className="Select-arrow-zone"
29092971
onMouseDown={[Function]}

src/rbac-forms/tests/rbacAssignUserTags.test.jsx

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Rbac assign user tags component', () => {
3636
}],
3737
}));
3838
beforeEach(() => {
39-
initialProps.users = users;
39+
initialProps.users = users.map(user => ({ ...user, current_group: 'foo', role: 'bar' }));
4040
initialProps.columns = usersTableColumns;
4141
initialProps.categories = categories.map(category => ({ ...category, label: category.description, value: category.id }));
4242
initialProps.loadCategoryEntry = mockLoadCategoryEntry;
@@ -83,7 +83,15 @@ describe('Rbac assign user tags component', () => {
8383
});
8484

8585
it('should render correctly without initial assignmets', () => {
86-
const wrapper = mount(<RbacAssignCompanyTags {...initialProps} users={[users[0]]} />);
86+
const wrapper = mount(<RbacAssignCompanyTags
87+
{...initialProps}
88+
users={[{
89+
...users[0],
90+
currentgroup: 'foo',
91+
role: 'bar',
92+
tags: [],
93+
}]}
94+
/>);
8795
wrapper.setState({ isLoaded: true });
8896
wrapper.update();
8997
expect(toJson(wrapper)).toMatchSnapshot();
@@ -104,7 +112,16 @@ describe('Rbac assign user tags component', () => {
104112

105113
it('should call save function', () => {
106114
const handleSave = jest.fn();
107-
const wrapper = mount(<RbacAssignCompanyTags {...initialProps} users={[{ ...users[0], tags: [] }]} handleSave={handleSave} />);
115+
const wrapper = mount(<RbacAssignCompanyTags
116+
{...initialProps}
117+
users={[{
118+
...users[0],
119+
currentgroup: 'foo',
120+
role: 'bar',
121+
tags: [],
122+
}]}
123+
handleSave={handleSave}
124+
/>);
108125
expect.assertions(1);
109126
return mockInitialLoad()
110127
.then(() => {
@@ -134,7 +151,15 @@ describe('Rbac assign user tags component', () => {
134151
});
135152

136153
it('should call remove entry', () => {
137-
const wrapper = mount(<RbacAssignCompanyTags {...initialProps} users={[{ ...users[0], tags: [] }]} />);
154+
const wrapper = mount(<RbacAssignCompanyTags
155+
{...initialProps}
156+
users={[{
157+
...users[0],
158+
currentgroup: 'foo',
159+
role: 'bar',
160+
tags: [],
161+
}]}
162+
/>);
138163
expect.assertions(1);
139164
return mockInitialLoad()
140165
.then(() => {
@@ -165,7 +190,15 @@ describe('Rbac assign user tags component', () => {
165190
});
166191

167192
it('should call reset function', () => {
168-
const wrapper = mount(<RbacAssignCompanyTags {...initialProps} users={[{ ...users[0], tags: [] }]} />);
193+
const wrapper = mount(<RbacAssignCompanyTags
194+
{...initialProps}
195+
users={[{
196+
...users[0],
197+
currentgroup: 'foo',
198+
role: 'bar',
199+
tags: [],
200+
}]}
201+
/>);
169202
expect.assertions(1);
170203
return mockInitialLoad()
171204
.then(() => {
@@ -195,7 +228,15 @@ describe('Rbac assign user tags component', () => {
195228
});
196229

197230
it('should select new entry state', () => {
198-
const wrapper = mount(<RbacAssignCompanyTags {...initialProps} users={[{ ...users[0], tags: [] }]} />);
231+
const wrapper = mount(<RbacAssignCompanyTags
232+
{...initialProps}
233+
users={[{
234+
...users[0],
235+
currentgroup: 'foo',
236+
role: 'bar',
237+
tags: [],
238+
}]}
239+
/>);
199240
wrapper.setState({
200241
categoryEntries: {
201242
10000000000085: [{
@@ -222,7 +263,15 @@ describe('Rbac assign user tags component', () => {
222263
});
223264

224265
it('should select new entry state', () => {
225-
const wrapper = mount(<RbacAssignCompanyTags {...initialProps} users={[{ ...users[0], tags: [] }]} />);
266+
const wrapper = mount(<RbacAssignCompanyTags
267+
{...initialProps}
268+
users={[{
269+
...users[0],
270+
currentgroup: 'foo',
271+
role: 'bar',
272+
tags: [],
273+
}]}
274+
/>);
226275
wrapper.instance().handleCategorySelect({ value: 'foo', label: 'bar' });
227276
expect(wrapper.state().selectedCategory).toEqual('foo');
228277
});

src/tagging/tests/__snapshots__/tag.modifier.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Tagging modifier match snapshot 1`] = `
4-
<React.Fragment>
4+
<Fragment>
55
<Row
66
bsClass="row"
77
componentClass="div"
@@ -80,5 +80,5 @@ exports[`Tagging modifier match snapshot 1`] = `
8080
}
8181
/>
8282
</Form>
83-
</React.Fragment>
83+
</Fragment>
8484
`;

src/tagging/tests/__snapshots__/tag.view.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Tag view match snapshot 1`] = `
4-
<React.Fragment>
4+
<Fragment>
55
<Row
66
bsClass="row"
77
componentClass="div"
@@ -55,5 +55,5 @@ exports[`Tag view match snapshot 1`] = `
5555
</ul>
5656
</Col>
5757
</Row>
58-
</React.Fragment>
58+
</Fragment>
5959
`;

src/tagging/tests/__snapshots__/tagging.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ exports[`Tagging component without redux mapping match snapshot 1`] = `
387387
onTouchMove={[Function]}
388388
onTouchStart={[Function]}
389389
>
390-
<span
390+
<div
391391
className="Select-multi-value-wrapper"
392392
id="react-select-2--value"
393393
>
@@ -474,7 +474,7 @@ exports[`Tagging component without redux mapping match snapshot 1`] = `
474474
/>
475475
</div>
476476
</AutosizeInput>
477-
</span>
477+
</div>
478478
<span
479479
className="Select-arrow-zone"
480480
onMouseDown={[Function]}
@@ -648,7 +648,7 @@ exports[`Tagging component without redux mapping match snapshot 1`] = `
648648
onTouchMove={[Function]}
649649
onTouchStart={[Function]}
650650
>
651-
<span
651+
<div
652652
className="Select-multi-value-wrapper"
653653
id="react-select-3--value"
654654
>
@@ -713,7 +713,7 @@ exports[`Tagging component without redux mapping match snapshot 1`] = `
713713
/>
714714
</div>
715715
</AutosizeInput>
716-
</span>
716+
</div>
717717
<span
718718
className="Select-arrow-zone"
719719
onMouseDown={[Function]}

src/textual_summary/tests/__snapshots__/generic_group.test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ exports[`GenericGroup renders just fine 1`] = `
5555
</td>
5656
<td>
5757
<IconOrImage
58-
background={null}
5958
icon={null}
6059
image={null}
6160
title={null}
@@ -89,7 +88,6 @@ exports[`GenericGroup renders just fine 1`] = `
8988
</td>
9089
<td>
9190
<IconOrImage
92-
background={null}
9391
icon={null}
9492
image={null}
9593
title={null}

0 commit comments

Comments
 (0)