mirror of
https://github.com/grafana/grafana.git
synced 2025-09-21 07:12:51 +08:00
fixed toggle buttons
This commit is contained in:
@ -17,8 +17,8 @@ exports[`Render should render action bar and datasources 1`] = `
|
|||||||
"title": "Add data source",
|
"title": "Add data source",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onSetLayoutMode={[Function]}
|
||||||
searchQuery=""
|
searchQuery=""
|
||||||
setLayoutMode={[Function]}
|
|
||||||
setSearchQuery={[Function]}
|
setSearchQuery={[Function]}
|
||||||
/>
|
/>
|
||||||
<DataSourcesList
|
<DataSourcesList
|
||||||
|
@ -16,8 +16,8 @@ exports[`Render should render component 1`] = `
|
|||||||
"title": "Find more plugins on Grafana.com",
|
"title": "Find more plugins on Grafana.com",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onSetLayoutMode={[Function]}
|
||||||
searchQuery=""
|
searchQuery=""
|
||||||
setLayoutMode={[Function]}
|
|
||||||
setSearchQuery={[Function]}
|
setSearchQuery={[Function]}
|
||||||
/>
|
/>
|
||||||
<PluginList
|
<PluginList
|
||||||
|
@ -11,6 +11,7 @@ const setup = (propOverrides?: object) => {
|
|||||||
canInvite: false,
|
canInvite: false,
|
||||||
externalUserMngLinkUrl: '',
|
externalUserMngLinkUrl: '',
|
||||||
externalUserMngLinkName: '',
|
externalUserMngLinkName: '',
|
||||||
|
showInvites: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.assign(props, propOverrides);
|
Object.assign(props, propOverrides);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import classNames from 'classnames/bind';
|
||||||
import { setUsersSearchQuery } from './state/actions';
|
import { setUsersSearchQuery } from './state/actions';
|
||||||
import { getInviteesCount, getUsersSearchQuery } from './state/selectors';
|
import { getInviteesCount, getUsersSearchQuery } from './state/selectors';
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ export interface Props {
|
|||||||
onShowInvites: () => void;
|
onShowInvites: () => void;
|
||||||
pendingInvitesCount: number;
|
pendingInvitesCount: number;
|
||||||
canInvite: boolean;
|
canInvite: boolean;
|
||||||
|
showInvites: boolean;
|
||||||
externalUserMngLinkUrl: string;
|
externalUserMngLinkUrl: string;
|
||||||
externalUserMngLinkName: string;
|
externalUserMngLinkName: string;
|
||||||
}
|
}
|
||||||
@ -23,8 +25,21 @@ export class UsersActionBar extends PureComponent<Props> {
|
|||||||
pendingInvitesCount,
|
pendingInvitesCount,
|
||||||
setUsersSearchQuery,
|
setUsersSearchQuery,
|
||||||
onShowInvites,
|
onShowInvites,
|
||||||
|
showInvites,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const pendingInvitesButtonStyle = classNames({
|
||||||
|
btn: true,
|
||||||
|
'toggle-btn': true,
|
||||||
|
active: showInvites,
|
||||||
|
});
|
||||||
|
|
||||||
|
const usersButtonStyle = classNames({
|
||||||
|
btn: true,
|
||||||
|
'toggle-btn': true,
|
||||||
|
active: !showInvites,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page-action-bar">
|
<div className="page-action-bar">
|
||||||
<div className="gf-form gf-form--grow">
|
<div className="gf-form gf-form--grow">
|
||||||
@ -38,13 +53,17 @@ export class UsersActionBar extends PureComponent<Props> {
|
|||||||
/>
|
/>
|
||||||
<i className="gf-form-input-icon fa fa-search" />
|
<i className="gf-form-input-icon fa fa-search" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className="page-action-bar__spacer" />
|
|
||||||
{pendingInvitesCount > 0 && (
|
{pendingInvitesCount > 0 && (
|
||||||
<button className="btn btn-inverse" onClick={onShowInvites}>
|
<div style={{ marginLeft: '1rem' }}>
|
||||||
Pending Invites ({pendingInvitesCount})
|
<button className={usersButtonStyle} key="users" onClick={onShowInvites}>
|
||||||
</button>
|
Users
|
||||||
|
</button>
|
||||||
|
<button className={pendingInvitesButtonStyle} onClick={onShowInvites} key="pending-invites">
|
||||||
|
Pending Invites ({pendingInvitesCount})
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<div className="page-action-bar__spacer" />
|
||||||
{canInvite && (
|
{canInvite && (
|
||||||
<a className="btn btn-success" href="org/users/invite">
|
<a className="btn btn-success" href="org/users/invite">
|
||||||
<i className="fa fa-plus" />
|
<i className="fa fa-plus" />
|
||||||
|
@ -82,7 +82,7 @@ export class UsersListPage extends PureComponent<Props, State> {
|
|||||||
<div>
|
<div>
|
||||||
<PageHeader model={navModel} />
|
<PageHeader model={navModel} />
|
||||||
<div className="page-container page-body">
|
<div className="page-container page-body">
|
||||||
<UsersActionBar onShowInvites={this.onShowInvites} />
|
<UsersActionBar onShowInvites={this.onShowInvites} showInvites={this.state.showInvites} />
|
||||||
{externalUserMngInfo && (
|
{externalUserMngInfo && (
|
||||||
<div className="grafana-info-box">
|
<div className="grafana-info-box">
|
||||||
<span>{externalUserMngInfo}</span>
|
<span>{externalUserMngInfo}</span>
|
||||||
|
@ -49,17 +49,33 @@ exports[`Render should render pending invites button 1`] = `
|
|||||||
className="gf-form-input-icon fa fa-search"
|
className="gf-form-input-icon fa fa-search"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<div
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"marginLeft": "1rem",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
className="btn toggle-btn active"
|
||||||
|
key="users"
|
||||||
|
onClick={[MockFunction]}
|
||||||
|
>
|
||||||
|
Users
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="btn toggle-btn"
|
||||||
|
key="pending-invites"
|
||||||
|
onClick={[MockFunction]}
|
||||||
|
>
|
||||||
|
Pending Invites (
|
||||||
|
5
|
||||||
|
)
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className="page-action-bar__spacer"
|
className="page-action-bar__spacer"
|
||||||
/>
|
/>
|
||||||
<button
|
|
||||||
className="btn btn-inverse"
|
|
||||||
onClick={[MockFunction]}
|
|
||||||
>
|
|
||||||
Pending Invites (
|
|
||||||
5
|
|
||||||
)
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
@ -9,7 +9,8 @@ exports[`Render should render component 1`] = `
|
|||||||
className="page-container page-body"
|
className="page-container page-body"
|
||||||
>
|
>
|
||||||
<Connect(UsersActionBar)
|
<Connect(UsersActionBar)
|
||||||
showInvites={[Function]}
|
onShowInvites={[Function]}
|
||||||
|
showInvites={false}
|
||||||
/>
|
/>
|
||||||
<UsersTable
|
<UsersTable
|
||||||
onRemoveUser={[Function]}
|
onRemoveUser={[Function]}
|
||||||
|
Reference in New Issue
Block a user