address pr issues

This commit is contained in:
Alex Corey
2019-05-01 11:05:29 -04:00
parent c4a4275a89
commit f704f320b5
7 changed files with 37 additions and 27 deletions

View File

@@ -217,11 +217,11 @@ describe('<DataListToolbar />', () => {
columns={columns} columns={columns}
onOpenDeleteModal={onOpenDeleteModal} onOpenDeleteModal={onOpenDeleteModal}
showDelete showDelete
disableDeleteIcon={false}
/> />
); );
toolbar.find(openDeleteModalButton).simulate('click'); toolbar.find(openDeleteModalButton).simulate('click');
expect(onOpenDeleteModal).toBeCalled(); expect(onOpenDeleteModal).toHaveBeenCalled();
}); });
test('Tooltip says "Select a row to delete" when trash can icon is disabled', () => { test('Tooltip says "Select a row to delete" when trash can icon is disabled', () => {
@@ -229,7 +229,7 @@ describe('<DataListToolbar />', () => {
<DataListToolbar <DataListToolbar
columns={[{ name: 'Name', key: 'name', isSortable: true }]} columns={[{ name: 'Name', key: 'name', isSortable: true }]}
showDelete showDelete
disableTrashCanIcon deleteTooltip="Select a row to delete"
/> />
); );
@@ -243,7 +243,7 @@ describe('<DataListToolbar />', () => {
<DataListToolbar <DataListToolbar
columns={[{ name: 'Name', key: 'name', isSortable: true }]} columns={[{ name: 'Name', key: 'name', isSortable: true }]}
showDelete showDelete
disableTrashCanIcon={false} deleteTooltip="Delete"
/> />
); );
const toolTip = toolbar.find('.pf-c-tooltip__content'); const toolTip = toolbar.find('.pf-c-tooltip__content');

View File

@@ -238,6 +238,7 @@ class AddResourceRole extends React.Component {
return ( return (
<Wizard <Wizard
style={{ overflow: 'scroll' }}
isOpen isOpen
onNext={this.handleWizardNext} onNext={this.handleWizardNext}
onClose={onClose} onClose={onClose}

View File

@@ -5,6 +5,7 @@
margin-right: 20px; margin-right: 20px;
font-weight: bold; font-weight: bold;
display: flex; display: flex;
cursor: pointer;
.awx-selectableCard__indicator { .awx-selectableCard__indicator {
display: flex; display: flex;
@@ -16,7 +17,6 @@
flex: 1; flex: 1;
align-items: center; align-items: center;
padding: 20px; padding: 20px;
cursor: pointer;
} }
} }

View File

@@ -32,7 +32,8 @@ class DataListToolbar extends React.Component {
addUrl, addUrl,
columns, columns,
deleteTooltip, deleteTooltip,
disableTrashCanIcon, disableDeleteIcon,
deleteIconStyling,
isAllSelected, isAllSelected,
isCompact, isCompact,
noLeftMargin, noLeftMargin,
@@ -46,7 +47,8 @@ class DataListToolbar extends React.Component {
showDelete, showDelete,
showSelectAll, showSelectAll,
sortOrder, sortOrder,
sortedColumnKey sortedColumnKey,
// deleteToolTipContent
} = this.props; } = this.props;
const showExpandCollapse = (onCompact && onExpand); const showExpandCollapse = (onCompact && onExpand);
@@ -111,21 +113,20 @@ class DataListToolbar extends React.Component {
)} )}
</Toolbar> </Toolbar>
</LevelItem> </LevelItem>
<LevelItem> <LevelItem style={{ display: 'flex' }}>
{ showDelete && ( {showDelete && (
<Tooltip <Tooltip
content={disableTrashCanIcon ? i18n._(t`Select a row to delete`) : i18n._(t`Delete`)} content={deleteTooltip}
position="top" position="top"
> >
<div <div
className={disableTrashCanIcon ? 'awx-ToolBarTrashCanIcon-disabled' className={deleteIconStyling}
: 'awx-ToolBarBtn'}
> >
<Button <Button
variant="plain" variant="plain"
aria-label={i18n._(t`Delete`)} aria-label={i18n._(t`Delete`)}
onClick={onOpenDeleteModal} onClick={onOpenDeleteModal}
isDisabled={disableTrashCanIcon} isDisabled={disableDeleteIcon}
> >
<TrashAltIcon className="awx-ToolBarTrashCanIcon" /> <TrashAltIcon className="awx-ToolBarTrashCanIcon" />
</Button> </Button>
@@ -163,6 +164,7 @@ DataListToolbar.propTypes = {
addUrl: PropTypes.string, addUrl: PropTypes.string,
columns: PropTypes.arrayOf(PropTypes.object).isRequired, columns: PropTypes.arrayOf(PropTypes.object).isRequired,
deleteTooltip: PropTypes.node, deleteTooltip: PropTypes.node,
disableDeleteIcon: PropTypes.bool,
isAllSelected: PropTypes.bool, isAllSelected: PropTypes.bool,
isCompact: PropTypes.bool, isCompact: PropTypes.bool,
noLeftMargin: PropTypes.bool, noLeftMargin: PropTypes.bool,
@@ -175,13 +177,14 @@ DataListToolbar.propTypes = {
showDelete: PropTypes.bool, showDelete: PropTypes.bool,
showSelectAll: PropTypes.bool, showSelectAll: PropTypes.bool,
sortOrder: PropTypes.string, sortOrder: PropTypes.string,
sortedColumnKey: PropTypes.string sortedColumnKey: PropTypes.string,
}; };
DataListToolbar.defaultProps = { DataListToolbar.defaultProps = {
add: null, add: null,
addUrl: null, addUrl: null,
deleteTooltip: i18nMark('Delete'), deleteTooltip: i18nMark('Delete'),
disableDeleteIcon: true,
isAllSelected: false, isAllSelected: false,
isCompact: false, isCompact: false,
noLeftMargin: false, noLeftMargin: false,
@@ -194,7 +197,7 @@ DataListToolbar.defaultProps = {
showDelete: false, showDelete: false,
showSelectAll: false, showSelectAll: false,
sortOrder: 'ascending', sortOrder: 'ascending',
sortedColumnKey: 'name' sortedColumnKey: 'name',
}; };
export default DataListToolbar; export default DataListToolbar;

View File

@@ -30,6 +30,7 @@
.awx-toolbar button.pf-c-button { .awx-toolbar button.pf-c-button {
height: 30px; height: 30px;
width: 30px;
padding: 0px; padding: 0px;
} }
@@ -82,27 +83,27 @@
.awx-ToolBarBtn{ .awx-ToolBarBtn{
width: 30px; width: 30px;
position: absolute;
right: 80px;
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-right: 20px; margin-right: 20px;
border-radius: 3px; border-radius: 3px;
} }
.awx-ToolBarBtn:hover{ .awx-ToolBarBtn:hover{
.awx-ToolBarTrashCanIcon { .awx-ToolBarTrashCanIcon {
color:white; color:white;
} }
background-color:#d9534f; background-color:#d9534f;
} }
.awx-ToolBarTrashCanIcon-disabled{
width: 30px; .awx-ToolBarBtn--disabled:hover{
position: absolute; .awx-ToolBarTrashCanIcon {
right: 80px; color: #d2d2d2;
display: flex; }
justify-content: center; background-color:white;
margin-right: 20px; cursor: not-allowed;
} }
.pf-l-toolbar >div{ .pf-l-toolbar >div{
&:last-child{ &:last-child{
display:none; display:none;

View File

@@ -125,7 +125,8 @@ class Organization extends Component {
} = this.state; } = this.state;
const tabsPaddingOverride = { const tabsPaddingOverride = {
padding: '0' padding: '0',
borderBottom: '1px solid black'
}; };
const canSeeNotificationsTab = me.is_system_auditor || isNotifAdmin || isAuditorOfThisOrg; const canSeeNotificationsTab = me.is_system_auditor || isNotifAdmin || isAuditorOfThisOrg;

View File

@@ -285,6 +285,7 @@ class OrganizationsList extends Component {
selected.length === 0 selected.length === 0
|| selected.some(row => !row.summary_fields.user_capabilities.delete) || selected.some(row => !row.summary_fields.user_capabilities.delete)
); );
const deleteToolTipContent = disableDelete ? i18nMark('Select a row to delete') : i18nMark('Delete');
return ( return (
<I18n> <I18n>
@@ -337,7 +338,10 @@ class OrganizationsList extends Component {
onSort={this.onSort} onSort={this.onSort}
onSelectAll={this.onSelectAll} onSelectAll={this.onSelectAll}
onOpenDeleteModal={this.handleOpenOrgDeleteModal} onOpenDeleteModal={this.handleOpenOrgDeleteModal}
disableTrashCanIcon={disableDelete} disableDeleteIcon={disableDelete}
deleteIconStyling={disableDelete ? 'awx-ToolBarBtn awx-ToolBarBtn--disabled'
: 'awx-ToolBarBtn'}
deleteTooltip={ deleteTooltip={
selected.some(row => !row.summary_fields.user_capabilities.delete) ? ( selected.some(row => !row.summary_fields.user_capabilities.delete) ? (
<div> <div>
@@ -353,7 +357,7 @@ class OrganizationsList extends Component {
)) ))
} }
</div> </div>
) : undefined ) : deleteToolTipContent
} }
showDelete showDelete
showSelectAll showSelectAll