mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 10:11:05 -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:
@@ -94,7 +94,7 @@ function ToolbarDeleteButton({
|
|||||||
const renderTooltip = () => {
|
const renderTooltip = () => {
|
||||||
const itemsUnableToDelete = itemsToDelete
|
const itemsUnableToDelete = itemsToDelete
|
||||||
.filter(cannotDelete)
|
.filter(cannotDelete)
|
||||||
.map(item => item.name)
|
.map(item => item.name || item.username)
|
||||||
.join(', ');
|
.join(', ');
|
||||||
if (itemsToDelete.some(cannotDelete)) {
|
if (itemsToDelete.some(cannotDelete)) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ const itemB = {
|
|||||||
name: 'Foo',
|
name: 'Foo',
|
||||||
summary_fields: { user_capabilities: { delete: false } },
|
summary_fields: { user_capabilities: { delete: false } },
|
||||||
};
|
};
|
||||||
|
const itemC = {
|
||||||
|
id: 1,
|
||||||
|
username: 'Foo',
|
||||||
|
summary_fields: { user_capabilities: { delete: false } },
|
||||||
|
};
|
||||||
|
|
||||||
describe('<ToolbarDeleteButton />', () => {
|
describe('<ToolbarDeleteButton />', () => {
|
||||||
test('should render button', () => {
|
test('should render button', () => {
|
||||||
@@ -61,4 +66,14 @@ describe('<ToolbarDeleteButton />', () => {
|
|||||||
expect(wrapper.find('Tooltip')).toHaveLength(1);
|
expect(wrapper.find('Tooltip')).toHaveLength(1);
|
||||||
expect(wrapper.find('Tooltip').prop('content')).toEqual('Delete');
|
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'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user