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

feat: Revamp UI of Global Notifictaion Configuration #2318

Merged
merged 56 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
30b513f
chore: code refactoring
shivani170 Dec 26, 2024
9e76bb7
chore: code refactoring
shivani170 Dec 26, 2024
e03a5d4
Merge branch 'develop' into feat/notification-configuration
shivani170 Dec 26, 2024
1fbf648
chore: code refactoring
shivani170 Dec 27, 2024
883ca15
Merge branch 'develop' into feat/notification-configuration
shivani170 Dec 27, 2024
02ac80a
chore: scroll fix for cluster & environment
shivani170 Dec 27, 2024
35aae80
Merge branch 'develop' into feat/notification-configuration
shivani170 Jan 1, 2025
3037d94
chore: code refactoring
shivani170 Jan 2, 2025
6457569
chore: ses code refactoring
shivani170 Jan 3, 2025
8c78b5e
chore: configuration code refactoring
shivani170 Jan 3, 2025
b4c61ca
chore: webhook code refactoring
shivani170 Jan 3, 2025
7364e05
chore: webhook code refactoring
shivani170 Jan 3, 2025
eeac793
chore: code refactoring
shivani170 Jan 3, 2025
ab50856
chore: code feedback fixes
shivani170 Jan 3, 2025
7c469f9
chore: image added in empty state
shivani170 Jan 3, 2025
b385d5e
chore: code feedback fixes
shivani170 Jan 6, 2025
b7e0253
chore: smtp code feedbacks fixes
shivani170 Jan 6, 2025
1c210c3
chorE: slack fixes
shivani170 Jan 6, 2025
b59f375
Merge branch 'develop' into feat/notification-configuration-code-refa…
shivani170 Jan 6, 2025
5aabb3c
chore: webhook code refactoring
shivani170 Jan 6, 2025
63d43a1
Merge branch 'develop' into feat/notification-configuration
shivani170 Jan 6, 2025
7a02952
Merge branch 'feat/notification-configuration' into feat/notification…
shivani170 Jan 6, 2025
10b2e6e
chore: fix for webhook edit mode
shivani170 Jan 6, 2025
9feb611
fix: for webhook css
shivani170 Jan 7, 2025
eb6a3d6
css fixes
shivani170 Jan 7, 2025
563e55e
chore: css fixes
shivani170 Jan 7, 2025
5927f57
chore: webhook css fixes
shivani170 Jan 7, 2025
d44c291
chore: css fixes
shivani170 Jan 8, 2025
40a6ec2
default css
shivani170 Jan 8, 2025
5a2cbca
chore: unnecessary code removed
shivani170 Jan 8, 2025
464fa0a
chore: default component added
shivani170 Jan 8, 2025
1ab1175
chore: css fixes for confirmation modal
shivani170 Jan 8, 2025
f01f8b4
chore: validation added
shivani170 Jan 8, 2025
f027c4b
chore: validation added
shivani170 Jan 8, 2025
df64c92
chore: calidation required for webhook & slack modal
shivani170 Jan 8, 2025
b2ad157
fix: character limit validation added
shivani170 Jan 8, 2025
4bb9d21
fix: feedback fixes
shivani170 Jan 8, 2025
d503014
fix: css fixes
shivani170 Jan 8, 2025
d04001c
chore: fixed header width for webhook dynamic table
shivani170 Jan 8, 2025
27ff638
chore: code feedback incorporated
shivani170 Jan 8, 2025
f8acb4f
chore: type fix added for all modal
shivani170 Jan 8, 2025
d970597
Merge pull request #2345 from devtron-labs/feat/css-fixes
shivani170 Jan 8, 2025
e472546
Merge pull request #2336 from devtron-labs/feat/notification-configur…
shivani170 Jan 8, 2025
6652803
chore: test case related id
shivani170 Jan 9, 2025
e8badd4
chore: unnecessary code removed
shivani170 Jan 9, 2025
1711bba
Merge pull request #2347 from devtron-labs/fea/notification-configura…
shivani170 Jan 9, 2025
ccaf3ad
chore: fix for rows saving issue
shivani170 Jan 10, 2025
a547235
fix: QA fixes
shivani170 Jan 10, 2025
d43caa1
fix: QA webhook url link added
shivani170 Jan 10, 2025
d4a8e8e
fix: QA validation function refactoring of all config modal
shivani170 Jan 13, 2025
e4590e5
chore: QA code refactoring
shivani170 Jan 13, 2025
893d28e
chore: QA code refactoring of validation on save
shivani170 Jan 13, 2025
602ac64
Merge branch 'develop' into feat/uat-add-button
shivani170 Jan 13, 2025
7c90f07
Merge branch 'develop' into feat/notification-configuration
shivani170 Jan 13, 2025
5556ef1
Merge pull request #2349 from devtron-labs/feat/uat-add-button
shivani170 Jan 13, 2025
6a9cb92
Merge branch 'feat/notification-configuration' of github.com:devtron-…
shivani170 Jan 13, 2025
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
6 changes: 0 additions & 6 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,9 @@ src/components/material/MaterialList.tsx
src/components/material/MaterialView.tsx
src/components/material/UpdateMaterial.tsx
src/components/notifications/AddNotification.tsx
src/components/notifications/ConfigurationTab.tsx
src/components/notifications/CreateHeaderDetails.tsx
src/components/notifications/ModifyRecipientsModal.tsx
src/components/notifications/NotificationTab.tsx
src/components/notifications/Notifications.tsx
src/components/notifications/SESConfigModal.tsx
src/components/notifications/SMTPConfigModal.tsx
src/components/notifications/SlackConfigModal.tsx
src/components/notifications/WebhookConfigModal.tsx
src/components/notifications/notifications.service.ts
src/components/notifications/notifications.util.tsx
src/components/onboardingGuide/GuideCommonHeader.tsx
Expand Down
File renamed without changes
Binary file added src/assets/img/ses-empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/slack-empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/smtp-empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/webhook-empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions src/components/globalConfigurations/GlobalConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { lazy, useState, useEffect, Suspense, isValidElement } from 'react'
import { lazy, useState, useEffect, Suspense, isValidElement, useRef } from 'react'
import { Route, NavLink, Router, Switch, Redirect, useHistory, useLocation } from 'react-router-dom'
import {
showError,
Expand Down Expand Up @@ -852,7 +852,19 @@ export const ProtectedInput = ({
dataTestid = '',
onBlur = (e) => { },
isRequiredField = false,
autoFocus = false,
}: ProtectedInputType) => {
const inputRef = useRef<HTMLInputElement>()

useEffect(() => {
setTimeout(() => {
// Added timeout to ensure the autofocus code is executed post the re-renders
if (inputRef.current && autoFocus) {
inputRef.current.focus()
}
}, 100)
}, [autoFocus])

const [shown, toggleShown] = useState(false)
useEffect(() => {
toggleShown(!hidden)
Expand All @@ -871,7 +883,7 @@ export const ProtectedInput = ({
data-testid={dataTestid}
type={shown ? 'text' : 'password'}
tabIndex={tabIndex}
className={error ? 'form__input form__input--error pl-42' : 'form__input pl-42'}
className={error ? 'form__input form__input--error pl-42' : 'form__input pl-42 fs-13'}
name={name}
placeholder={placeholder}
onChange={(e) => {
Expand All @@ -881,6 +893,8 @@ export const ProtectedInput = ({
value={value}
disabled={disabled}
onBlur={onBlur}
autoFocus={autoFocus}
ref={inputRef}
/>
<ShowHide
className="protected-input__toggle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ export interface ProtectedInputType {
dataTestid: string
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void
isRequiredField?: boolean
autoFocus?: boolean
}
32 changes: 32 additions & 0 deletions src/components/notifications/AddConfigurationButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Button, ButtonVariantType, ComponentSizeType, useSearchString } from '@devtron-labs/devtron-fe-common-lib'
import { useHistory } from 'react-router-dom'
import { ReactComponent as Add } from '@Icons/ic-add.svg'
import { getTabText } from './notifications.util'
import { AddConfigurationButtonProps } from './types'

export const AddConfigurationButton = ({ activeTab }: AddConfigurationButtonProps) => {
const { searchParams } = useSearchString()
const history = useHistory()

const handleAddClick = () => {
const newParams = {
...searchParams,
modal: activeTab,
configId: '0',
}
history.push({
search: new URLSearchParams(newParams).toString(),
})
}

return (
<Button
onClick={handleAddClick}
variant={ButtonVariantType.primary}
size={ComponentSizeType.small}
dataTestId={`${activeTab}-add-button`}
startIcon={<Add />}
text={`Add ${getTabText(activeTab)}`}
/>
)
}
20 changes: 12 additions & 8 deletions src/components/notifications/AddNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ import { RouteComponentProps, Link } from 'react-router-dom'
import { components } from 'react-select'
import Tippy from '@tippyjs/react'
import CreatableSelect from 'react-select/creatable'
import { SESConfigModal } from './SESConfigModal'
import SESConfigModal from './SESConfigModal'
import { SlackConfigModal } from './SlackConfigModal'
import { Select, validateEmail, ErrorBoundary } from '../common'
import { ReactComponent as Slack } from '../../assets/img/slack-logo.svg'
import { ReactComponent as Slack } from '../../assets/icons/slack-logo.svg'
import { ReactComponent as Add } from '../../assets/icons/ic-add.svg'
import { ReactComponent as Filter } from '../../assets/icons/ic-filter.svg'
import { ReactComponent as Folder } from '../../assets/icons/img-folder-empty.svg'
Expand Down Expand Up @@ -967,6 +967,14 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
)
}

onClickCloseSESModal = () => {
this.setState({ showSESConfigModal: false })
}

onClickCloseSMTPModal = () => {
this.setState({ showSMTPConfigModal: false })
}

renderSESConfigModal() {
if (this.state.showSESConfigModal) {
return (
Expand All @@ -985,9 +993,7 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
showError(error)
})
}}
closeSESConfigModal={(event) => {
this.setState({ showSESConfigModal: false })
}}
closeSESConfigModal={this.onClickCloseSESModal}
/>
)
}
Expand All @@ -1011,9 +1017,7 @@ export class AddNotification extends Component<AddNotificationsProps, AddNotific
showError(error)
})
}}
closeSMTPConfigModal={(event) => {
this.setState({ showSMTPConfigModal: false })
}}
closeSMTPConfigModal={this.onClickCloseSMTPModal}
/>
)
}
Expand Down
33 changes: 33 additions & 0 deletions src/components/notifications/ConfigTableRowActionButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Trash } from '@Components/common'
import { ReactComponent as Edit } from '@Icons/ic-pencil.svg'
import { Button, ButtonStyleType, ButtonVariantType, ComponentSizeType } from '@devtron-labs/devtron-fe-common-lib'
import { ConfigTableRowActionButtonProps } from './types'

export const ConfigTableRowActionButton = ({
onClickEditRow,
onClickDeleteRow,
modal,
}: ConfigTableRowActionButtonProps) => (
<div className="dc__visible-hover--child">
<div className="flex right dc__gap-8 dc__no-shrink">
<Button
onClick={onClickEditRow}
variant={ButtonVariantType.borderLess}
size={ComponentSizeType.xs}
dataTestId={`${modal}-config-edit-button`}
icon={<Edit />}
ariaLabel="Edit"
style={ButtonStyleType.neutral}
/>
<Button
onClick={onClickDeleteRow}
variant={ButtonVariantType.borderLess}
size={ComponentSizeType.xs}
dataTestId={`${modal}-config-delete-button`}
icon={<Trash />}
ariaLabel="Delete"
style={ButtonStyleType.negativeGrey}
/>
</div>
</div>
)
78 changes: 78 additions & 0 deletions src/components/notifications/ConfigurationDrawerModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import {
Button,
ButtonStyleType,
ButtonVariantType,
ComponentSizeType,
Drawer,
Progressing,
} from '@devtron-labs/devtron-fe-common-lib'
import { ReactComponent as Close } from '@Icons/ic-close.svg'
import { ConfigurationsTabTypes } from './constants'
import { ConfigurationTabDrawerModalProps } from './types'
import { getTabText } from './notifications.util'

export const ConfigurationTabDrawerModal = ({
renderContent,
closeModal,
modal,
isLoading,
saveConfigModal,
disableSave,
}: ConfigurationTabDrawerModalProps) => {
const renderFooter = () => (
<div className="px-20 py-16 flex right dc__gap-12 dc__zi-1 dc__border-top bcn-0">
<Button
dataTestId={`${modal}-config-modal-close-button`}
size={ComponentSizeType.large}
onClick={closeModal}
text="Cancel"
disabled={isLoading}
variant={ButtonVariantType.secondary}
style={ButtonStyleType.neutral}
/>
<Button
dataTestId={`add-${modal}-save-button`}
size={ComponentSizeType.large}
onClick={saveConfigModal}
text="Save"
isLoading={isLoading}
disabled={disableSave}
/>
</div>
)

const renderModalContent = () => {
if (isLoading) {
return <Progressing pageLoader />
}
return (
<div className="flexbox-col flex-grow-1 mh-0">
{renderContent()}
{renderFooter()}
</div>
)
}

return (
<Drawer position="right" onEscape={closeModal}>
<div
className={`configuration-drawer h-100 modal__body w-${modal === ConfigurationsTabTypes.WEBHOOK ? '1024' : '600'} modal__body--p-0 dc__no-border-radius mt-0 flex-grow-1 flexbox-col`}
>
<div className="flex flex-align-center dc__border-bottom flex-justify bcn-0 pb-12 pt-12 pl-20 pr-20">
<h1 className="fs-16 fw-6 lh-1-43 m-0 title-padding">Configure {getTabText(modal)}</h1>
<Button
ariaLabel="close-button"
icon={<Close />}
style={ButtonStyleType.negativeGrey}
size={ComponentSizeType.xs}
onClick={closeModal}
dataTestId="add-ses-close-button"
showAriaLabelInTippy={false}
variant={ButtonVariantType.borderLess}
/>
</div>
{renderModalContent()}
</div>
</Drawer>
)
}
Loading
Loading