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-77977 || Notifications disabling if Email service is not confi… #3161

Merged
merged 4 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions app/src/common/css/variables/newColors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ $COLOR--tag-value-text: #394db6;
$COLOR--tag-value-background: #ced8fc;
$COLOR--tag-key-text: #6f4599;
$COLOR--tag-key-background: #dac3e6;
$COLOR--settings-menu-hover: #e5e5e5;
AmsterGet marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const Notifications = ({ setHeaderTitleNode }) => {
dispatch(fetchProjectNotificationsAction());
}, []);

const isAbleToEditNotificationList = () => canUpdateSettings(userRole, projectRole);
const isAbleToEditNotificationsEnableForm = () =>
canUpdateSettings(userRole, projectRole) && isEmailIntegrationAvailable;

Expand Down Expand Up @@ -162,14 +161,18 @@ export const Notifications = ({ setHeaderTitleNode }) => {
};

useEffect(() => {
setHeaderTitleNode(
<span className={cx('button')} onClick={onAdd}>
<Button disabled={!isAbleToEditNotificationList()}>{formatMessage(messages.create)}</Button>
</span>,
);
if (notifications.length > 0) {
setHeaderTitleNode(
<span className={cx('button')} onClick={onAdd}>
<Button disabled={!isAbleToEditNotificationsEnableForm()}>
{formatMessage(messages.create)}
</Button>
</span>,
);
}

return () => setHeaderTitleNode(null);
});
}, [setHeaderTitleNode]);
AmsterGet marked this conversation as resolved.
Show resolved Hide resolved

const onToggleHandler = (isEnabled, notification) => {
trackEvent(
Expand All @@ -185,7 +188,6 @@ export const Notifications = ({ setHeaderTitleNode }) => {
};

const readOnlyNotificationsEnableForm = !isAbleToEditNotificationsEnableForm();
AmsterGet marked this conversation as resolved.
Show resolved Hide resolved
const readOnlyNotificationList = !isAbleToEditNotificationList();

const actions = [
{
Expand Down Expand Up @@ -219,7 +221,7 @@ export const Notifications = ({ setHeaderTitleNode }) => {
</Layout>
<div className={cx('notifications-container')}>
<RuleList
disabled={readOnlyNotificationList}
disabled={readOnlyNotificationsEnableForm}
data={notifications.map((item) => ({ name: item.ruleName, ...item }))}
actions={actions}
onToggle={onToggleHandler}
Expand All @@ -235,7 +237,7 @@ export const Notifications = ({ setHeaderTitleNode }) => {
documentationLink={
'https://reportportal.io/docs/Project-configuration%3Ee-mail-notifications'
}
disableButton={readOnlyNotificationList}
disableButton={readOnlyNotificationsEnableForm}
handleButton={onAdd}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
white-space: pre;
overflow: hidden;
text-overflow: ellipsis;

&:hover {
background-color: $COLOR--settings-menu-hover;
}
}

.active {
Expand Down