AccessControl: Pass current org id to UsersTable (#49584)

* Pass current org id to UsersTable

* Mock contextSrv and update snapshot
This commit is contained in:
Karl Persson 2022-05-25 13:56:36 +02:00 committed by GitHub
parent 1796a1d277
commit ef6b53ed23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -197,7 +197,7 @@ exports[`no enzyme tests`] = {
"public/app/features/teams/TeamSettings.test.tsx:2043271249": [
[0, 19, 13, "RegExp match", "2409514259"]
],
"public/app/features/users/UsersListPage.test.tsx:3908145117": [
"public/app/features/users/UsersListPage.test.tsx:2518052139": [
[0, 19, 13, "RegExp match", "2409514259"]
],
"public/app/features/users/UsersTable.test.tsx:263958312": [

View File

@ -12,6 +12,12 @@ jest.mock('../../core/app_events', () => ({
emit: jest.fn(),
}));
jest.mock('app/core/services/context_srv', () => ({
contextSrv: {
user: { orgId: 1 },
},
}));
const setup = (propOverrides?: object) => {
const props: Props = {
navModel: {

View File

@ -5,6 +5,7 @@ import { renderMarkdown } from '@grafana/data';
import { HorizontalGroup, Pagination, VerticalGroup } from '@grafana/ui';
import Page from 'app/core/components/Page/Page';
import { getNavModel } from 'app/core/selectors/navModel';
import { contextSrv } from 'app/core/services/context_srv';
import { OrgUser, OrgRole, StoreState } from 'app/types';
import InviteesTable from '../invites/InviteesTable';
@ -106,6 +107,7 @@ export class UsersListPage extends PureComponent<Props, State> {
<VerticalGroup spacing="md">
<UsersTable
users={paginatedUsers}
orgId={contextSrv.user.orgId}
onRoleChange={(role, user) => this.onRoleChange(role, user)}
onRemoveUser={(user) => this.props.removeUser(user.userId)}
/>

View File

@ -26,6 +26,7 @@ exports[`Render should render List page 1`] = `
<UsersTable
onRemoveUser={[Function]}
onRoleChange={[Function]}
orgId={1}
users={Array []}
/>
<HorizontalGroup