mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-19 14:31:48 -05:00
Add RBAC to org views
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { I18n } from '@lingui/react';
|
||||
import { I18n, i18nMark } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import {
|
||||
Button,
|
||||
@@ -28,23 +28,27 @@ import VerticalSeparator from '../VerticalSeparator';
|
||||
class DataListToolbar extends React.Component {
|
||||
render () {
|
||||
const {
|
||||
add,
|
||||
addUrl,
|
||||
columns,
|
||||
deleteTooltip,
|
||||
disableTrashCanIcon,
|
||||
onSelectAll,
|
||||
sortedColumnKey,
|
||||
sortOrder,
|
||||
showDelete,
|
||||
showSelectAll,
|
||||
isAllSelected,
|
||||
isCompact,
|
||||
noLeftMargin,
|
||||
onSort,
|
||||
onSearch,
|
||||
onSearch
|
||||
onCompact,
|
||||
onExpand,
|
||||
add,
|
||||
onOpenDeleteModal
|
||||
onOpenDeleteModal,
|
||||
onSearch,
|
||||
onSelectAll,
|
||||
onSort,
|
||||
showAdd,
|
||||
showDelete,
|
||||
showSelectAll,
|
||||
sortOrder,
|
||||
sortedColumnKey
|
||||
} = this.props;
|
||||
|
||||
const showExpandCollapse = (onCompact && onExpand);
|
||||
@@ -112,21 +116,23 @@ class DataListToolbar extends React.Component {
|
||||
<LevelItem>
|
||||
{ showDelete && (
|
||||
<Tooltip
|
||||
content={i18n._(t`Delete`)}
|
||||
position="top"
|
||||
content={deleteTooltip}
|
||||
position="left"
|
||||
>
|
||||
<Button
|
||||
className="awx-ToolBarBtn"
|
||||
variant="plain"
|
||||
aria-label={i18n._(t`Delete`)}
|
||||
onClick={onOpenDeleteModal}
|
||||
isDisabled={disableTrashCanIcon}
|
||||
>
|
||||
<TrashAltIcon className="awx-ToolBarTrashCanIcon" />
|
||||
</Button>
|
||||
<span>
|
||||
<Button
|
||||
className="awx-ToolBarBtn"
|
||||
variant="plain"
|
||||
aria-label={i18n._(t`Delete`)}
|
||||
onClick={onOpenDeleteModal}
|
||||
isDisabled={disableTrashCanIcon}
|
||||
>
|
||||
<TrashAltIcon className="awx-ToolBarTrashCanIcon" />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
{addUrl && (
|
||||
{showAdd && addUrl && (
|
||||
<Link to={addUrl}>
|
||||
<Button
|
||||
variant="primary"
|
||||
@@ -136,7 +142,7 @@ class DataListToolbar extends React.Component {
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
{add && (
|
||||
{showAdd && add && (
|
||||
<Fragment>{add}</Fragment>
|
||||
)}
|
||||
</LevelItem>
|
||||
@@ -149,13 +155,16 @@ class DataListToolbar extends React.Component {
|
||||
}
|
||||
|
||||
DataListToolbar.propTypes = {
|
||||
add: PropTypes.node,
|
||||
addUrl: PropTypes.string,
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
deleteTooltip: PropTypes.node,
|
||||
isAllSelected: PropTypes.bool,
|
||||
noLeftMargin: PropTypes.bool,
|
||||
onSearch: PropTypes.func,
|
||||
onSelectAll: PropTypes.func,
|
||||
onSort: PropTypes.func,
|
||||
showAdd: PropTypes.bool,
|
||||
showDelete: PropTypes.bool,
|
||||
showSelectAll: PropTypes.bool,
|
||||
sortOrder: PropTypes.string,
|
||||
@@ -167,10 +176,17 @@ DataListToolbar.propTypes = {
|
||||
};
|
||||
|
||||
DataListToolbar.defaultProps = {
|
||||
add: null,
|
||||
addUrl: null,
|
||||
deleteTooltip: i18nMark('Delete'),
|
||||
isAllSelected: false,
|
||||
isCompact: false,
|
||||
onCompact: null,
|
||||
onExpand: null,
|
||||
onSearch: null,
|
||||
onSelectAll: null,
|
||||
onSort: null,
|
||||
showAdd: false,
|
||||
showDelete: false,
|
||||
showSelectAll: false,
|
||||
sortOrder: 'ascending',
|
||||
|
||||
Reference in New Issue
Block a user