Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-95595 || 'Actions' button is visible for member-viewer #4020

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import {
proceedWithValidItemsAction,
} from 'controllers/uniqueErrors/clusterItems';
import { userAccountRoleSelector } from 'controllers/user';
import { activeProjectRoleSelector } from 'controllers/pages';
import { activeProjectRoleSelector, userRolesSelector } from 'controllers/pages';
import { canWorkWithTests } from 'common/utils/permissions';
import styles from './uniqueErrorsActionPanel.scss';

const cx = classNames.bind(styles);
Expand All @@ -59,6 +60,7 @@ const cx = classNames.bind(styles);
lastOperation: lastOperationSelector(state),
accountRole: userAccountRoleSelector(state),
projectRole: activeProjectRoleSelector(state),
userRoles: userRolesSelector(state),
}),
{
restorePath: restorePathAction,
Expand Down Expand Up @@ -97,6 +99,7 @@ export class UniqueErrorsActionPanel extends Component {
restorePath: PropTypes.func,
proceedWithValidItems: PropTypes.func,
projectRole: PropTypes.string.isRequired,
userRoles: PropTypes.object,
selectedItems: PropTypes.array,
showBreadcrumbs: PropTypes.bool,
unselectAndFetchItems: PropTypes.func,
Expand Down Expand Up @@ -248,8 +251,10 @@ export class UniqueErrorsActionPanel extends Component {
selectedItems,
hasErrors,
hasValidItems,
userRoles,
} = this.props;
const itemsActionDescriptors = this.getItemsActionDescriptors();
const canManageItems = canWorkWithTests(userRoles);

return (
<div
Expand Down Expand Up @@ -277,14 +282,16 @@ export class UniqueErrorsActionPanel extends Component {
)}
<div className={cx('action-buttons')}>
{parentItem && <ParentInfo parentItem={parentItem} />}
<div className={cx('action-button', 'mobile-hidden')}>
<GhostMenuButton
title={formatMessage(COMMON_LOCALE_KEYS.ACTIONS)}
items={itemsActionDescriptors}
disabled={!selectedItems.length}
onClick={this.onClickActionsButton}
/>
</div>
{canManageItems && (
<div className={cx('action-button', 'mobile-hidden')}>
<GhostMenuButton
title={formatMessage(COMMON_LOCALE_KEYS.ACTIONS)}
items={itemsActionDescriptors}
disabled={!selectedItems.length}
onClick={this.onClickActionsButton}
/>
</div>
)}
<div className={cx('action-button')}>
<GhostButton icon={RefreshIcon} onClick={this.onRefresh} transparentBackground>
<FormattedMessage id="Common.refresh" defaultMessage="Refresh" />
Expand Down
Loading