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-92352 || Member Viewer. Update the view of available actions b… #4008

Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions app/src/common/constants/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export const ACTIONS = {
FORCE_FINISH_RERUN_LAUNCH: 'FORCE_FINISH_RERUN_LAUNCH',
START_ANALYSIS: 'START_ANALYSIS',
DELETE_TEST_ITEM: 'DELETE_TEST_ITEM',
MAKE_DECISION: 'MAKE_DECISION',
CHANGE_TEST_ITEM_STATUS: 'CHANGE_TEST_ITEM_STATUS',
MANAGE_BTS_ISSUES: 'MANAGE_BTS_ISSUES',
MOVE_TO_DEBUG: 'MOVE_TO_DEBUG',
MERGE_LAUNCHES: 'MERGE_LAUNCHES',
WORK_WITH_FILTERS: 'WORK_WITH_FILTERS',
Expand Down Expand Up @@ -80,7 +83,10 @@ export const PERMISSIONS_MAP = {
[ACTIONS.START_ANALYSIS]: true,
[ACTIONS.BULK_EDIT_ITEMS]: true,
[ACTIONS.FORCE_FINISH_RERUN_LAUNCH]: true,
[ACTIONS.CHANGE_TEST_ITEM_STATUS]: true,
[ACTIONS.DELETE_TEST_ITEM]: true,
[ACTIONS.MAKE_DECISION]: true,
[ACTIONS.MANAGE_BTS_ISSUES]: true,
[ACTIONS.WORK_WITH_FILTERS]: true,
[ACTIONS.WORK_WITH_WIDGETS]: true,
[ACTIONS.SEE_ORGANIZATION_SETTINGS]: true,
Expand Down Expand Up @@ -120,6 +126,9 @@ export const PERMISSIONS_MAP = {
[ACTIONS.FORCE_FINISH_RERUN_LAUNCH]: true,
[ACTIONS.BULK_EDIT_ITEMS]: true,
[ACTIONS.DELETE_TEST_ITEM]: true,
[ACTIONS.CHANGE_TEST_ITEM_STATUS]: true,
[ACTIONS.MAKE_DECISION]: true,
[ACTIONS.MANAGE_BTS_ISSUES]: true,
[ACTIONS.WORK_WITH_FILTERS]: true,
[ACTIONS.WORK_WITH_WIDGETS]: true,
[ACTIONS.RENAME_PROJECT]: true,
Expand Down
3 changes: 3 additions & 0 deletions app/src/common/utils/permissions/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const canForceFinishRerunLaunch = checkPermission(ACTIONS.FORCE_FINISH_RE
export const canStartAnalysis = checkPermission(ACTIONS.START_ANALYSIS);
export const canDeleteTestItem = checkPermission(ACTIONS.DELETE_TEST_ITEM);
export const canMoveToDebug = checkPermission(ACTIONS.MOVE_TO_DEBUG);
export const canChangeTestItemStatus = checkPermission(ACTIONS.CHANGE_TEST_ITEM_STATUS);
export const canMakeDecision = checkPermission(ACTIONS.MAKE_DECISION);
export const canManageBTSIssues = checkPermission(ACTIONS.MANAGE_BTS_ISSUES);
export const canMergeLaunches = checkPermission(ACTIONS.MERGE_LAUNCHES);
export const canWorkWithFilters = checkPermission(ACTIONS.WORK_WITH_FILTERS);
export const canReadData = checkPermission(ACTIONS.READ_DATA);
Expand Down
44 changes: 27 additions & 17 deletions app/src/pages/inside/common/statusDropdown/statusDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class StatusDropdown extends Component {
onChange: PropTypes.func,
withIndicator: PropTypes.bool,
disabled: PropTypes.bool,
readOnly: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -75,6 +76,7 @@ export class StatusDropdown extends Component {
onChange: () => {},
withIndicator: false,
disabled: false,
readOnly: false,
};

updateItem = (newStatus) => {
Expand Down Expand Up @@ -142,25 +144,33 @@ export class StatusDropdown extends Component {
};

render() {
const { status, withIndicator, disabled } = this.props;
const { status, withIndicator, disabled, readOnly } = this.props;
return (
<div className={cx('status-dropdown')}>
<InputDropdown
options={this.generateOptions(status)}
value={status}
onChange={this.updateItem}
customClasses={{
dropdown: cx('dropdown'),
selectBlock: cx('select-block', { 'select-block-with-indicator': withIndicator }),
arrow: cx('arrow'),
value: cx('value'),
selectList: cx('select-list'),
dropdownOption: (withIndicator && cx('dropdown-option')) || '',
opened: (withIndicator && cx('opened')) || '',
}}
disabled={disabled}
mobileDisabled
/>
{readOnly ? (
<TestItemStatus
status={status}
withIndicator={withIndicator}
className={cx('defined-status')}
/>
) : (
<InputDropdown
options={this.generateOptions(status)}
value={status}
onChange={this.updateItem}
customClasses={{
dropdown: cx('dropdown'),
selectBlock: cx('select-block', { 'select-block-with-indicator': withIndicator }),
arrow: cx('arrow'),
value: cx('value'),
selectList: cx('select-list'),
dropdownOption: (withIndicator && cx('dropdown-option')) || '',
opened: (withIndicator && cx('opened')) || '',
}}
disabled={disabled}
mobileDisabled
/>
)}
</div>
);
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/pages/inside/common/statusDropdown/statusDropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,55 @@
.status-dropdown {
text-transform: capitalize;
}

.dropdown {
height: auto;
}

.opened {
.select-block {
box-shadow: none;
}
}

.select-block {
min-width: 140px;
padding: 0 10px 0 0;
border: none;
background-color: transparent;

&.select-block-with-indicator {
min-width: auto;
padding: 0 16px;
}
}

.value {
display: inline;
padding-right: 7px;
line-height: 18px;
}

.arrow {
position: relative;
right: auto;
top: -2px;
margin-top: 0;
}

.select-list {
margin-top: 0;
min-width: fit-content;
}

.status-container {
display: inline-flex;
}

.dropdown-option {
padding: 0 16px 0 15px;
}

.defined-status {
padding: 0 16px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ import styles from './testItemStatus.scss';

const cx = classNames.bind(styles);

export const TestItemStatus = ({ status }) => (
<div className={cx('status-container')}>
export const TestItemStatus = ({ status, className }) => (
<div className={cx('status-container', className)}>
<div className={cx('indicator', status.toLowerCase())} />
<div className={cx('status')}>{status}</div>
</div>
);

TestItemStatus.propTypes = {
status: PropTypes.string,
className: PropTypes.string,
};

TestItemStatus.defaultProps = {
status: '',
className: '',
};
Loading
Loading