Skip to content

Commit d4415e3

Browse files
committed
feat: notification ui fixes
1 parent ad269a6 commit d4415e3

File tree

7 files changed

+266
-123
lines changed

7 files changed

+266
-123
lines changed

src/components/notifications/AddNotification.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,17 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
278278
} else {
279279
const baseEvents = pipeline.success && pipeline.trigger && pipeline.failure
280280
const approvalEvents = pipeline.configApproval && pipeline.imageApproval
281-
const anyEvent = pipeline.success || pipeline.trigger || pipeline.failure || pipeline.configApproval || pipeline.imageApproval
281+
const anyEvent =
282+
pipeline.success ||
283+
pipeline.trigger ||
284+
pipeline.failure ||
285+
pipeline.configApproval ||
286+
pipeline.imageApproval
282287

283-
const isFullySelected = rowType === NotificationPipelineType.CI
284-
? baseEvents && !pipeline.configApproval && !pipeline.imageApproval
285-
: baseEvents && approvalEvents
288+
const isFullySelected =
289+
rowType === NotificationPipelineType.CI
290+
? baseEvents && !pipeline.configApproval && !pipeline.imageApproval
291+
: baseEvents && approvalEvents
286292

287293
if (isFullySelected) {
288294
pipeline.checkbox = {
@@ -696,7 +702,6 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
696702
<th className="pipeline-list__checkbox fw-6" />
697703
<th className="pipeline-list__pipeline-name fw-6">Resource</th>
698704
<th className="pipeline-list__pipeline-name fw-6">Application Name</th>
699-
<th className="pipeline-list__type fw-6">Type</th>
700705
<th className="pipeline-list__environment fw-6">Env/Branch</th>
701706
<th className="pipeline-list__stages dc__block fw-6">Events</th>
702707
</tr>
@@ -731,6 +736,7 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
731736
</Checkbox>
732737
</td>
733738
<td className="pipeline-list__pipeline-name">
739+
<span className="pipeline-list__type">{renderPipelineTypeIcon(row, 20)}</span>
734740
{row.appliedFilters.length ? (
735741
<>
736742
<i>
@@ -753,7 +759,6 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
753759
)}
754760
</td>
755761
<th className="pipeline-list__pipeline-name fw-6">{row?.appName}</th>
756-
<td className="pipeline-list__type">{renderPipelineTypeIcon(row)}</td>
757762
<td className="pipeline-list__environment">
758763
{_isCi && (
759764
<span className="flex left">
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*/
4+
5+
import {
6+
Button,
7+
ButtonStyleType,
8+
ButtonVariantType,
9+
DraggableButton,
10+
DraggablePositionVariant,
11+
DraggableWrapper,
12+
Icon,
13+
PopupMenu,
14+
} from '@devtron-labs/devtron-fe-common-lib'
15+
16+
import { ModifyRecipientPopUp } from './ModifyRecipientPopUp'
17+
import { BulkMultiSelectTagWidgetType } from './types'
18+
19+
export const BulkMultiSelectTagWidget = ({
20+
parentRef,
21+
selectedIdentifiersCount,
22+
showDeleteModal,
23+
events,
24+
applyModifyEvents,
25+
onChangeCheckboxHandler,
26+
selectedNotificationList,
27+
onOpenEditNotificationMenu,
28+
showModifyModal,
29+
}: BulkMultiSelectTagWidgetType) => {
30+
const renderModifyEventPopUpBody = () => (
31+
<PopupMenu.Body>
32+
<ModifyRecipientPopUp
33+
events={events}
34+
applyModifyEvents={applyModifyEvents}
35+
onChangeCheckboxHandler={onChangeCheckboxHandler}
36+
selectedNotificationList={selectedNotificationList}
37+
/>
38+
</PopupMenu.Body>
39+
)
40+
return (
41+
<DraggableWrapper
42+
dragSelector=".drag-selector"
43+
positionVariant={DraggablePositionVariant.PARENT_BOTTOM_CENTER}
44+
parentRef={parentRef}
45+
zIndex="calc(var(--modal-index) - 1)"
46+
>
47+
<div className="flex dc__gap-8 pt-12 pb-12 pr-12 pl-8 bulk-selection-widget br-8">
48+
<DraggableButton dragClassName="drag-selector" />
49+
<div className="fs-13 lh-20 fw-6 flex dc__gap-12">
50+
<span className="flex dc__gap-2 bcb-5 cn-0 br-4 pr-6 pl-6">{selectedIdentifiersCount}</span>
51+
<span className="cn-9">Selected</span>
52+
</div>
53+
<div className="dc__divider h-16" />
54+
<div className="flex left dc__gap-4" />
55+
<div className="flex left dc__gap-4">
56+
<Button
57+
dataTestId="notification-delete-button"
58+
icon={<Icon name="ic-delete" color={null} />}
59+
variant={ButtonVariantType.borderLess}
60+
style={ButtonStyleType.neutral}
61+
ariaLabel="Delete Notifications"
62+
onClick={showDeleteModal}
63+
showAriaLabelInTippy
64+
/>
65+
<PopupMenu
66+
onToggleCallback={(isOpen) => {
67+
if (isOpen) {
68+
onOpenEditNotificationMenu()
69+
}
70+
}}
71+
>
72+
<PopupMenu.Button rootClassName="popup-button--notification-tab">
73+
<Icon
74+
name="ic-error"
75+
color={null}
76+
size={20}
77+
tooltipProps={{ content: 'Modify events', alwaysShowTippyOnHover: true }}
78+
/>
79+
</PopupMenu.Button>
80+
{renderModifyEventPopUpBody()}
81+
</PopupMenu>
82+
83+
<Button
84+
dataTestId="button__modify-recipients"
85+
icon={<Icon name="ic-users" color={null} />}
86+
variant={ButtonVariantType.borderLess}
87+
style={ButtonStyleType.neutral}
88+
ariaLabel="Modify Recipients"
89+
onClick={showModifyModal}
90+
showAriaLabelInTippy
91+
/>
92+
</div>
93+
</div>
94+
</DraggableWrapper>
95+
)
96+
}

0 commit comments

Comments
 (0)