mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
updated after pr feedback
This commit is contained in:
@@ -74,7 +74,7 @@ export class DataSourcesListPage extends PureComponent<Props> {
|
||||
<OrgActionBar
|
||||
layoutMode={layoutMode}
|
||||
searchQuery={searchQuery}
|
||||
setLayoutMode={mode => setDataSourcesLayoutMode(mode)}
|
||||
onSetLayoutMode={mode => setDataSourcesLayoutMode(mode)}
|
||||
setSearchQuery={query => setDataSourcesSearchQuery(query)}
|
||||
linkButton={linkButton}
|
||||
key="action-bar"
|
||||
|
||||
@@ -43,7 +43,7 @@ export class PluginListPage extends PureComponent<Props> {
|
||||
<OrgActionBar
|
||||
searchQuery={searchQuery}
|
||||
layoutMode={layoutMode}
|
||||
setLayoutMode={mode => setPluginsLayoutMode(mode)}
|
||||
onSetLayoutMode={mode => setPluginsLayoutMode(mode)}
|
||||
setSearchQuery={query => setPluginsSearchQuery(query)}
|
||||
linkButton={linkButton}
|
||||
/>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getMockInvitees } from './__mocks__/userMocks';
|
||||
const setup = (propOverrides?: object) => {
|
||||
const props: Props = {
|
||||
invitees: [] as Invitee[],
|
||||
revokeInvite: jest.fn(),
|
||||
onRevokeInvite: jest.fn(),
|
||||
};
|
||||
|
||||
Object.assign(props, propOverrides);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Invitee } from 'app/types';
|
||||
|
||||
export interface Props {
|
||||
invitees: Invitee[];
|
||||
revokeInvite: (code: string) => void;
|
||||
onRevokeInvite: (code: string) => void;
|
||||
}
|
||||
|
||||
export default class InviteesTable extends PureComponent<Props> {
|
||||
@@ -19,7 +19,7 @@ export default class InviteesTable extends PureComponent<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { invitees, revokeInvite } = this.props;
|
||||
const { invitees, onRevokeInvite } = this.props;
|
||||
|
||||
return (
|
||||
<table className="filter-table form-inline">
|
||||
@@ -50,7 +50,7 @@ export default class InviteesTable extends PureComponent<Props> {
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<button className="btn btn-danger btn-mini" onClick={() => revokeInvite(invitee.code)}>
|
||||
<button className="btn btn-danger btn-mini" onClick={() => onRevokeInvite(invitee.code)}>
|
||||
<i className="fa fa-remove" />
|
||||
</button>
|
||||
</td>
|
||||
|
||||
@@ -6,7 +6,7 @@ const setup = (propOverrides?: object) => {
|
||||
const props: Props = {
|
||||
searchQuery: '',
|
||||
setUsersSearchQuery: jest.fn(),
|
||||
showInvites: jest.fn(),
|
||||
onShowInvites: jest.fn(),
|
||||
pendingInvitesCount: 0,
|
||||
canInvite: false,
|
||||
externalUserMngLinkUrl: '',
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getInviteesCount, getUsersSearchQuery } from './state/selectors';
|
||||
export interface Props {
|
||||
searchQuery: string;
|
||||
setUsersSearchQuery: typeof setUsersSearchQuery;
|
||||
showInvites: () => void;
|
||||
onShowInvites: () => void;
|
||||
pendingInvitesCount: number;
|
||||
canInvite: boolean;
|
||||
externalUserMngLinkUrl: string;
|
||||
@@ -22,7 +22,7 @@ export class UsersActionBar extends PureComponent<Props> {
|
||||
searchQuery,
|
||||
pendingInvitesCount,
|
||||
setUsersSearchQuery,
|
||||
showInvites,
|
||||
onShowInvites,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@@ -41,7 +41,7 @@ export class UsersActionBar extends PureComponent<Props> {
|
||||
|
||||
<div className="page-action-bar__spacer" />
|
||||
{pendingInvitesCount > 0 && (
|
||||
<button className="btn btn-inverse" onClick={showInvites}>
|
||||
<button className="btn btn-inverse" onClick={onShowInvites}>
|
||||
Pending Invites ({pendingInvitesCount})
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -69,7 +69,7 @@ export class UsersListPage extends PureComponent<Props, State> {
|
||||
this.props.revokeInvite(code);
|
||||
};
|
||||
|
||||
showInvites = () => {
|
||||
onShowInvites = () => {
|
||||
this.setState(prevState => ({
|
||||
showInvites: !prevState.showInvites,
|
||||
}));
|
||||
@@ -82,14 +82,14 @@ export class UsersListPage extends PureComponent<Props, State> {
|
||||
<div>
|
||||
<PageHeader model={navModel} />
|
||||
<div className="page-container page-body">
|
||||
<UsersActionBar showInvites={this.showInvites} />
|
||||
<UsersActionBar onShowInvites={this.onShowInvites} />
|
||||
{externalUserMngInfo && (
|
||||
<div className="grafana-info-box">
|
||||
<span>{externalUserMngInfo}</span>
|
||||
</div>
|
||||
)}
|
||||
{this.state.showInvites ? (
|
||||
<InviteesTable invitees={invitees} revokeInvite={code => this.onRevokeInvite(code)} />
|
||||
<InviteesTable invitees={invitees} onRevokeInvite={code => this.onRevokeInvite(code)} />
|
||||
) : (
|
||||
<UsersTable
|
||||
users={users}
|
||||
|
||||
@@ -59,7 +59,7 @@ export function loadInvitees(): ThunkResult<void> {
|
||||
|
||||
export function updateUser(user: OrgUser): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
await getBackendSrv().patch(`/api/org/users/${user.userId}`, user);
|
||||
await getBackendSrv().patch(`/api/org/users/${user.userId}`, { role: user.role });
|
||||
dispatch(loadUsers());
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user