-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2336 from devtron-labs/feat/notification-configur…
…ation-code-refactoring feat: notification configuration code refactoring
- Loading branch information
Showing
31 changed files
with
2,055 additions
and
2,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/components/notifications/ConfigTableRowActionButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 = ({ | ||
rootClassName, | ||
onClickEditRow, | ||
onClickDeleteRow, | ||
modal, | ||
}: ConfigTableRowActionButtonProps) => ( | ||
<div className={`${rootClassName} flexbox dc__gap-4 m-0`}> | ||
<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> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="ses-config-modal-close-button" | ||
size={ComponentSizeType.large} | ||
onClick={closeModal} | ||
text="Cancel" | ||
disabled={isLoading} | ||
variant={ButtonVariantType.secondary} | ||
style={ButtonStyleType.neutral} | ||
/> | ||
<Button | ||
dataTestId="add-ses-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> | ||
) | ||
} |
Oops, something went wrong.