mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #8230 from nixocio/ui_issue_7751
Add username to tooltip Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
5c751f3f8e
@ -94,7 +94,7 @@ function ToolbarDeleteButton({
|
||||
const renderTooltip = () => {
|
||||
const itemsUnableToDelete = itemsToDelete
|
||||
.filter(cannotDelete)
|
||||
.map(item => item.name)
|
||||
.map(item => item.name || item.username)
|
||||
.join(', ');
|
||||
if (itemsToDelete.some(cannotDelete)) {
|
||||
return (
|
||||
|
||||
@ -12,6 +12,11 @@ const itemB = {
|
||||
name: 'Foo',
|
||||
summary_fields: { user_capabilities: { delete: false } },
|
||||
};
|
||||
const itemC = {
|
||||
id: 1,
|
||||
username: 'Foo',
|
||||
summary_fields: { user_capabilities: { delete: false } },
|
||||
};
|
||||
|
||||
describe('<ToolbarDeleteButton />', () => {
|
||||
test('should render button', () => {
|
||||
@ -61,4 +66,14 @@ describe('<ToolbarDeleteButton />', () => {
|
||||
expect(wrapper.find('Tooltip')).toHaveLength(1);
|
||||
expect(wrapper.find('Tooltip').prop('content')).toEqual('Delete');
|
||||
});
|
||||
|
||||
test('should render tooltip for username', () => {
|
||||
const wrapper = mountWithContexts(
|
||||
<ToolbarDeleteButton onDelete={() => {}} itemsToDelete={[itemC]} />
|
||||
);
|
||||
expect(wrapper.find('Tooltip')).toHaveLength(1);
|
||||
expect(wrapper.find('Tooltip').prop('content').props.children).toEqual(
|
||||
'You do not have permission to delete Items: Foo'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user