-
Notifications
You must be signed in to change notification settings - Fork 926
feat(site): implement notification ui #14175
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
fc282e7
Add base notification settings page to deployment
BrunoQuaresma 997e0d3
Add base notifications components
BrunoQuaresma 73f8471
Bind notifications into the user account notifications page
BrunoQuaresma 33c9ab0
Remove deployment notifications page
BrunoQuaresma bbc8cbb
Add test for toggling notifications
BrunoQuaresma 7227a42
Update migration
BrunoQuaresma 788de88
Update template notification methods
BrunoQuaresma 1262f7b
Fix types
BrunoQuaresma e449e3d
Fix remaining type issues
BrunoQuaresma 0154b94
Experience improvements
BrunoQuaresma aedf159
Fix validation
BrunoQuaresma 1a2efae
Remove BE changes
BrunoQuaresma a1f363c
Fix FE types
BrunoQuaresma 7412eb9
Fix notifications permissions
BrunoQuaresma 1ff0973
Display webhook info
BrunoQuaresma 2acde04
Merge branch 'main' of https://github.com/coder/coder into bq/user-no…
BrunoQuaresma 7cc7bdb
Add tests to the notifications page
BrunoQuaresma 4956409
Remove unecessary migration
BrunoQuaresma 1c62242
Don't show deployment wide method
BrunoQuaresma a020619
Fix templates sorting
BrunoQuaresma 0efc40d
Add nav tabs
BrunoQuaresma 1aedb92
Update titles
BrunoQuaresma 786b005
Add tests
BrunoQuaresma 2ecbe5f
Improve product copy
BrunoQuaresma ec7ab40
Fix notifications visibility
BrunoQuaresma c986e51
Minor improvements
BrunoQuaresma e037423
Remove alerts
BrunoQuaresma 341f550
Add alerts when SMTP or Webhook config are enabled but not set
BrunoQuaresma d97dd82
Apply a few Michaels suggestions
BrunoQuaresma 4399cd6
Merge branch 'main' of https://github.com/coder/coder into bq/user-no…
BrunoQuaresma d403eed
Simplify state logic for the switch component
BrunoQuaresma fb02aec
Update copy
BrunoQuaresma 013ccff
Apply PR comments
BrunoQuaresma 7858a5a
Add docs
BrunoQuaresma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add base notification settings page to deployment
- Loading branch information
commit fc282e7bb02b6f07e273e19d2be606707b34416b
There are no files selected for viewing
314 changes: 314 additions & 0 deletions
314
site/src/pages/DeploySettingsPage/NotificationsPage/NotificationsPage.tsx
This file contains hidden or 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,314 @@ | ||
import type { Interpolation, Theme } from "@emotion/react"; | ||
import EmailIcon from "@mui/icons-material/EmailOutlined"; | ||
import WebhookIcon from "@mui/icons-material/LanguageOutlined"; | ||
import Card from "@mui/material/Card"; | ||
import Divider from "@mui/material/Divider"; | ||
import List from "@mui/material/List"; | ||
import ListItem from "@mui/material/ListItem"; | ||
import ListItemIcon from "@mui/material/ListItemIcon"; | ||
import ListItemText, { listItemTextClasses } from "@mui/material/ListItemText"; | ||
import Switch from "@mui/material/Switch"; | ||
import TextField from "@mui/material/TextField"; | ||
import ToggleButton from "@mui/material/ToggleButton"; | ||
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup"; | ||
import type { FC } from "react"; | ||
import { FormFields, FormSection, HorizontalForm } from "components/Form/Form"; | ||
import { Section } from "pages/UserSettingsPage/Section"; | ||
import Button from "@mui/material/Button"; | ||
import { Stack } from "components/Stack/Stack"; | ||
|
||
export const NotificationsPage: FC = () => { | ||
return ( | ||
<Section | ||
title="Notification Targets" | ||
description="Control delivery methods for notifications. Settings applied to this deployment." | ||
layout="fluid" | ||
> | ||
<HorizontalForm> | ||
<FormSection | ||
title="Webhook Target" | ||
description="A webhook target is a URL that you can use to receive your events through an API." | ||
> | ||
<FormFields> | ||
<TextField | ||
label="Webhook Target URL" | ||
placeholder="https://myapi.com/events" | ||
helperText="Leave this empty to disable webhook notifications." | ||
/> | ||
<Stack direction="row" spacing={1}> | ||
<Button>Reset</Button> | ||
<Button variant="contained" color="primary"> | ||
Save URL | ||
</Button> | ||
</Stack> | ||
</FormFields> | ||
</FormSection> | ||
|
||
<FormSection | ||
title="Events" | ||
description="Update the events to use the correct targets for each notification." | ||
> | ||
<FormFields> | ||
<Card | ||
variant="outlined" | ||
css={{ background: "transparent", width: "100%" }} | ||
> | ||
<List> | ||
<ListItem css={styles.listHeader}> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="User events" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="User added" | ||
/> | ||
<ToggleButtonGroup | ||
value="email" | ||
size="small" | ||
aria-label="Targe" | ||
css={styles.toggleGroup} | ||
> | ||
<ToggleButton | ||
value="email" | ||
key="email" | ||
css={styles.toggleButton} | ||
> | ||
<EmailIcon /> | ||
</ToggleButton> | ||
<ToggleButton | ||
value="webhook" | ||
key="webhook" | ||
css={styles.toggleButton} | ||
> | ||
<WebhookIcon /> | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</ListItem> | ||
<Divider /> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="User removed" | ||
/> | ||
<ToggleButtonGroup | ||
value="email" | ||
size="small" | ||
aria-label="Targe" | ||
css={styles.toggleGroup} | ||
> | ||
<ToggleButton | ||
value="email" | ||
key="email" | ||
css={styles.toggleButton} | ||
> | ||
<EmailIcon /> | ||
</ToggleButton> | ||
<ToggleButton | ||
value="webhook" | ||
key="webhook" | ||
css={styles.toggleButton} | ||
> | ||
<WebhookIcon /> | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</ListItem> | ||
<Divider /> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="User suspended" | ||
/> | ||
<ToggleButtonGroup | ||
value="webhook" | ||
size="small" | ||
aria-label="Targe" | ||
css={styles.toggleGroup} | ||
> | ||
<ToggleButton | ||
value="email" | ||
key="email" | ||
css={styles.toggleButton} | ||
> | ||
<EmailIcon /> | ||
</ToggleButton> | ||
<ToggleButton | ||
value="webhook" | ||
key="webhook" | ||
css={styles.toggleButton} | ||
> | ||
<WebhookIcon /> | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</ListItem> | ||
</List> | ||
</Card> | ||
|
||
<Card | ||
variant="outlined" | ||
css={{ background: "transparent", width: "100%" }} | ||
> | ||
<List> | ||
<ListItem css={styles.listHeader}> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="Workspace events" | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="Dormancy" | ||
secondary="When a workspace is marked as dormant" | ||
/> | ||
<ToggleButtonGroup | ||
value="email" | ||
size="small" | ||
aria-label="Targe" | ||
css={styles.toggleGroup} | ||
> | ||
<ToggleButton | ||
value="email" | ||
key="email" | ||
css={styles.toggleButton} | ||
> | ||
<EmailIcon /> | ||
</ToggleButton> | ||
<ToggleButton | ||
value="webhook" | ||
key="webhook" | ||
css={styles.toggleButton} | ||
> | ||
<WebhookIcon /> | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</ListItem> | ||
<Divider /> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="Deletion" | ||
secondary="When a workspace is marked for deletion" | ||
/> | ||
<ToggleButtonGroup | ||
value="email" | ||
size="small" | ||
aria-label="Targe" | ||
css={styles.toggleGroup} | ||
> | ||
<ToggleButton | ||
value="email" | ||
key="email" | ||
css={styles.toggleButton} | ||
> | ||
<EmailIcon /> | ||
</ToggleButton> | ||
<ToggleButton | ||
value="webhook" | ||
key="webhook" | ||
css={styles.toggleButton} | ||
> | ||
<WebhookIcon /> | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</ListItem> | ||
<Divider /> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Switch size="small" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
css={styles.listItemText} | ||
primary="Build failure" | ||
secondary="When a workspace fails to build" | ||
/> | ||
<ToggleButtonGroup | ||
value="webhook" | ||
size="small" | ||
aria-label="Targe" | ||
css={styles.toggleGroup} | ||
> | ||
<ToggleButton | ||
value="email" | ||
key="email" | ||
css={styles.toggleButton} | ||
> | ||
<EmailIcon /> | ||
</ToggleButton> | ||
<ToggleButton | ||
value="webhook" | ||
key="webhook" | ||
css={styles.toggleButton} | ||
> | ||
<WebhookIcon /> | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</ListItem> | ||
</List> | ||
</Card> | ||
</FormFields> | ||
</FormSection> | ||
</HorizontalForm> | ||
</Section> | ||
); | ||
}; | ||
|
||
export default NotificationsPage; | ||
|
||
const styles = { | ||
listHeader: (theme) => ({ | ||
background: theme.palette.background.paper, | ||
borderBottom: `1px solid ${theme.palette.divider}`, | ||
}), | ||
listItemText: { | ||
[`& .${listItemTextClasses.primary}`]: { | ||
fontSize: 14, | ||
fontWeight: 500, | ||
}, | ||
[`& .${listItemTextClasses.secondary}`]: { | ||
fontSize: 14, | ||
}, | ||
}, | ||
toggleGroup: (theme) => ({ | ||
border: `1px solid ${theme.palette.divider}`, | ||
borderRadius: 4, | ||
}), | ||
toggleButton: (theme) => ({ | ||
border: 0, | ||
borderRadius: 4, | ||
fontSize: 16, | ||
padding: "4px 8px", | ||
color: theme.palette.text.disabled, | ||
|
||
"&:hover": { | ||
color: theme.palette.text.primary, | ||
}, | ||
|
||
"& svg": { | ||
fontSize: "inherit", | ||
}, | ||
}), | ||
} as Record<string, Interpolation<Theme>>; |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.