mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-28 19:53:35 -05:00
updating PR issues updated snapshot test
This commit is contained in:
@@ -29,11 +29,11 @@ class DataListToolbar extends React.Component {
|
||||
render () {
|
||||
const {
|
||||
add,
|
||||
addBtnToolTipContent,
|
||||
addUrl,
|
||||
columns,
|
||||
deleteTooltip,
|
||||
disableDeleteIcon,
|
||||
deleteIconStyling,
|
||||
disableDelete,
|
||||
isAllSelected,
|
||||
isCompact,
|
||||
noLeftMargin,
|
||||
@@ -48,9 +48,11 @@ class DataListToolbar extends React.Component {
|
||||
showSelectAll,
|
||||
sortOrder,
|
||||
sortedColumnKey,
|
||||
// deleteToolTipContent
|
||||
} = this.props;
|
||||
|
||||
const deleteIconStyling = disableDelete ? 'awx-ToolBarBtn awx-ToolBarBtn--disabled'
|
||||
: 'awx-ToolBarBtn';
|
||||
|
||||
const showExpandCollapse = (onCompact && onExpand);
|
||||
return (
|
||||
<I18n>
|
||||
@@ -126,7 +128,7 @@ class DataListToolbar extends React.Component {
|
||||
variant="plain"
|
||||
aria-label={i18n._(t`Delete`)}
|
||||
onClick={onOpenDeleteModal}
|
||||
isDisabled={disableDeleteIcon}
|
||||
isDisabled={disableDelete}
|
||||
>
|
||||
<TrashAltIcon className="awx-ToolBarTrashCanIcon" />
|
||||
</Button>
|
||||
@@ -136,7 +138,7 @@ class DataListToolbar extends React.Component {
|
||||
{showAdd && addUrl && (
|
||||
<Link to={addUrl}>
|
||||
<Tooltip
|
||||
content={i18n._(t`Add Organization`)}
|
||||
content={addBtnToolTipContent}
|
||||
>
|
||||
<Button
|
||||
variant="primary"
|
||||
@@ -164,7 +166,7 @@ DataListToolbar.propTypes = {
|
||||
addUrl: PropTypes.string,
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
deleteTooltip: PropTypes.node,
|
||||
disableDeleteIcon: PropTypes.bool,
|
||||
disableDelete: PropTypes.bool,
|
||||
isAllSelected: PropTypes.bool,
|
||||
isCompact: PropTypes.bool,
|
||||
noLeftMargin: PropTypes.bool,
|
||||
@@ -184,7 +186,7 @@ DataListToolbar.defaultProps = {
|
||||
add: null,
|
||||
addUrl: null,
|
||||
deleteTooltip: i18nMark('Delete'),
|
||||
disableDeleteIcon: true,
|
||||
disableDelete: true,
|
||||
isAllSelected: false,
|
||||
isCompact: false,
|
||||
noLeftMargin: false,
|
||||
|
||||
@@ -126,7 +126,6 @@ class Organization extends Component {
|
||||
|
||||
const tabsPaddingOverride = {
|
||||
padding: '0',
|
||||
borderBottom: '1px solid black'
|
||||
};
|
||||
|
||||
const canSeeNotificationsTab = me.is_system_auditor || isNotifAdmin || isAuditorOfThisOrg;
|
||||
|
||||
@@ -281,11 +281,34 @@ class OrganizationsList extends Component {
|
||||
} = this.state;
|
||||
const { match } = this.props;
|
||||
|
||||
let deleteToolTipContent;
|
||||
|
||||
if (selected.some(row => !row.summary_fields.user_capabilities.delete)) {
|
||||
deleteToolTipContent = (
|
||||
<div>
|
||||
<Trans>
|
||||
You dont have permission to delete the following Organizations:
|
||||
</Trans>
|
||||
{selected
|
||||
.filter(row => !row.summary_fields.user_capabilities.delete)
|
||||
.map(row => (
|
||||
<div key={row.id}>
|
||||
{row.name}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
);
|
||||
} else if (selected.length === 0) {
|
||||
deleteToolTipContent = i18nMark('Select a row to delete');
|
||||
} else {
|
||||
deleteToolTipContent = i18nMark('Delete');
|
||||
}
|
||||
|
||||
const disableDelete = (
|
||||
selected.length === 0
|
||||
|| selected.some(row => !row.summary_fields.user_capabilities.delete)
|
||||
);
|
||||
const deleteToolTipContent = disableDelete ? i18nMark('Select a row to delete') : i18nMark('Delete');
|
||||
|
||||
return (
|
||||
<I18n>
|
||||
@@ -330,6 +353,7 @@ class OrganizationsList extends Component {
|
||||
<Fragment>
|
||||
<DataListToolbar
|
||||
addUrl={`${match.url}/add`}
|
||||
addBtnToolTipContent={i18nMark('Add Organization')}
|
||||
isAllSelected={selected.length === results.length}
|
||||
sortedColumnKey={sortedColumnKey}
|
||||
sortOrder={sortOrder}
|
||||
@@ -338,27 +362,8 @@ class OrganizationsList extends Component {
|
||||
onSort={this.onSort}
|
||||
onSelectAll={this.onSelectAll}
|
||||
onOpenDeleteModal={this.handleOpenOrgDeleteModal}
|
||||
disableDeleteIcon={disableDelete}
|
||||
deleteIconStyling={disableDelete ? 'awx-ToolBarBtn awx-ToolBarBtn--disabled'
|
||||
: 'awx-ToolBarBtn'}
|
||||
|
||||
deleteTooltip={
|
||||
selected.some(row => !row.summary_fields.user_capabilities.delete) ? (
|
||||
<div>
|
||||
<Trans>
|
||||
You dont have permission to delete the following Organizations:
|
||||
</Trans>
|
||||
{selected
|
||||
.filter(row => !row.summary_fields.user_capabilities.delete)
|
||||
.map(row => (
|
||||
<div key={row.id}>
|
||||
{row.name}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
) : deleteToolTipContent
|
||||
}
|
||||
disableDelete={disableDelete}
|
||||
deleteTooltip={deleteToolTipContent}
|
||||
showDelete
|
||||
showSelectAll
|
||||
showAdd={canAdd}
|
||||
@@ -374,7 +379,6 @@ class OrganizationsList extends Component {
|
||||
teamCount={o.summary_fields.related_field_counts.teams}
|
||||
isSelected={selected.some(row => row.id === o.id)}
|
||||
onSelect={() => this.onSelect(o)}
|
||||
onOpenOrgDeleteModal={this.handleOpenOrgDeleteModal}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user