Skip to content

merge main into groups #4439

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 47 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a6bb3b2
docs: add quotas (#4366)
ammario Oct 4, 2022
f295200
fix: Ensure WebSockets routinely transfer data (#4367)
kylecarbs Oct 4, 2022
06d7e36
fix: Ignore hidden folders when archiving (#4370)
kylecarbs Oct 4, 2022
5870176
feat: Also log out of apps if they are hosted on the same domain (#4334)
Emyrk Oct 4, 2022
8940ea1
fix: Always set `DisconnectedAt` if the agent isn't connected (#4328)
kylecarbs Oct 5, 2022
504cd46
fix: Check for a response body when dialing the Tailnet WebSocket (#4…
kylecarbs Oct 5, 2022
3759bb2
docs: fixed a typo (#4374)
matifali Oct 5, 2022
8d14076
fix: move quotas above inputs (#4376)
f0ssel Oct 5, 2022
b65c555
fix: warn user if not entitled feature is enabled (#4377)
f0ssel Oct 5, 2022
4f3958c
docs: link all enterprise features (#4368)
ammario Oct 5, 2022
2a66395
feat: use app wildcards for apps if configured (#4263)
deansheather Oct 5, 2022
9a670b9
chore: refactor frontend to use workspace status directly (#4361)
presleyp Oct 5, 2022
3ad5e11
feat: add warning if workspace page becomes stale (#4375)
Kira-Pilot Oct 5, 2022
bbe2baf
fix: Ignore all hidden files and folders in archive (#4382)
kylecarbs Oct 6, 2022
1386465
feat: add endpoint to get listening ports in agent (#4260)
deansheather Oct 6, 2022
93b8121
fix: Change use of 1337 to 13337 in example templates (#4386)
mafredri Oct 6, 2022
29a2fe4
fix: fix builds on windows_arm64 (#4388)
deansheather Oct 6, 2022
d275331
fix: Remove audit warning if unlicensed (#4387)
kylecarbs Oct 6, 2022
0ebcb7d
fix: Remove reliance of `relative_path` on subdomains (#4390)
kylecarbs Oct 6, 2022
ea42212
chore: add icons to quickstarts (#4379)
bpmct Oct 6, 2022
9b1ff43
fix: Don't run CI for releases (#4393)
kylecarbs Oct 6, 2022
3b15f13
fix: fix apps being unavailable until rebuild (#4395)
deansheather Oct 6, 2022
9cf3e10
chore: Pin typos to fix CI (#4396)
kylecarbs Oct 6, 2022
fe7c9f8
chore: Stop building images on tag pushes (#4397)
kylecarbs Oct 6, 2022
f5df548
feat: tokens (#4380)
f0ssel Oct 6, 2022
a89d690
fix: show help on wraper commands (#4402)
f0ssel Oct 6, 2022
32bb1e7
fix: add back missing postAPIKey route (#4406)
f0ssel Oct 6, 2022
05670d1
fix: Spelling in audit log docs (#4384)
ntimo Oct 6, 2022
915bb41
feat: Add trial property to licenses (#4372)
kylecarbs Oct 7, 2022
3049a56
fix: Use the maximum number of users for a license warning (#4410)
kylecarbs Oct 7, 2022
3cc77d9
feat: Add tunnel by default (#4399)
kylecarbs Oct 7, 2022
e8e095e
feat: redesign error alert (#4403)
Kira-Pilot Oct 7, 2022
adcf883
fix: Ensure GitHub OAuth2 users are active in organization (#4416)
mafredri Oct 7, 2022
2b6586d
chore: add ignoreRestSiblings to no-unused-vars ESLint rule (#4404)
jsjoeio Oct 7, 2022
257df81
chore: replace old ErrorSummary component (#4417)
Kira-Pilot Oct 7, 2022
34f7992
refactor: Remove user roles from dropdown (#4419)
BrunoQuaresma Oct 7, 2022
50966c4
fix: Fix keyboard focus styles on buttons (#4418)
BrunoQuaresma Oct 7, 2022
3ad27b5
chore: Rename context in `cli/agent` (#4422)
mafredri Oct 7, 2022
0ad8e77
fix(ci): use correct `retention-days` in e2e (#4424)
coadler Oct 7, 2022
c01910f
docs: use enterprise badges (#4428)
ammario Oct 8, 2022
dd5173b
fix: apply loadBalancerIP and externalTrafficPolicy values in helm ch…
andrei-nefeli Oct 8, 2022
eefc26c
Hide build logs older than 30 days (#4436)
ammario Oct 9, 2022
6266895
Merge branch 'main' into mergemain
sreya Oct 9, 2022
99868f2
remove migration conflict
sreya Oct 9, 2022
c46eba4
fix license woes
sreya Oct 9, 2022
33a5599
fix coderd/license
sreya Oct 9, 2022
20a89eb
Update error banner
BrunoQuaresma Oct 10, 2022
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
Prev Previous commit
Next Next commit
feat: add warning if workspace page becomes stale (#4375)
* added a warning summary component

* added warning to workspace page

* consolidated warnings

* prettier

* updated design
  • Loading branch information
Kira-Pilot authored Oct 5, 2022
commit 3ad5e11d2295ceb08a2b2684f03f6a56cde23553
35 changes: 35 additions & 0 deletions site/src/components/WarningAlert/WarningAlert.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Story } from "@storybook/react"
import { WarningAlert, WarningAlertProps } from "./WarningAlert"
import Button from "@material-ui/core/Button"

export default {
title: "components/WarningAlert",
component: WarningAlert,
}

const Template: Story<WarningAlertProps> = (args) => <WarningAlert {...args} />

export const ExampleWithDismiss = Template.bind({})
ExampleWithDismiss.args = {
text: "This is a warning",
dismissible: true,
}

const ExampleAction = (
<Button onClick={() => null} size="small">
Button
</Button>
)

export const ExampleWithAction = Template.bind({})
ExampleWithAction.args = {
text: "This is a warning",
actions: [ExampleAction],
}

export const ExampleWithActionAndDismiss = Template.bind({})
ExampleWithActionAndDismiss.args = {
text: "This is a warning",
actions: [ExampleAction],
dismissible: true,
}
61 changes: 61 additions & 0 deletions site/src/components/WarningAlert/WarningAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { useState, FC, ReactElement } from "react"
import Collapse from "@material-ui/core/Collapse"
import { Stack } from "components/Stack/Stack"
import { makeStyles, Theme } from "@material-ui/core/styles"
import { colors } from "theme/colors"
import ReportProblemOutlinedIcon from "@material-ui/icons/ReportProblemOutlined"
import Button from "@material-ui/core/Button"
import { useTranslation } from "react-i18next"

export interface WarningAlertProps {
text: string
dismissible?: boolean
actions?: ReactElement[]
}

export const WarningAlert: FC<WarningAlertProps> = ({
text,
dismissible = false,
actions = [],
}) => {
const { t } = useTranslation("common")
const [open, setOpen] = useState(true)
const classes = useStyles()

return (
<Collapse in={open}>
<Stack
className={classes.alertContainer}
direction="row"
alignItems="center"
spacing={0}
justifyContent="space-between"
>
<Stack direction="row" spacing={1}>
<ReportProblemOutlinedIcon fontSize="small" className={classes.alertIcon} />
{text}
</Stack>
<Stack direction="row">
{actions.length > 0 && actions.map((action) => <div key={String(action)}>{action}</div>)}
{dismissible && (
<Button size="small" onClick={() => setOpen(false)} variant="outlined">
{t("ctas.dismissCta")}
</Button>
)}
</Stack>
</Stack>
</Collapse>
)
}

const useStyles = makeStyles<Theme>((theme) => ({
alertContainer: {
border: `1px solid ${colors.orange[7]}`,
borderRadius: theme.shape.borderRadius,
padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`,
backgroundColor: `${colors.gray[16]}`,
},
alertIcon: {
color: `${colors.orange[7]}`,
},
}))
17 changes: 11 additions & 6 deletions site/src/components/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { WorkspaceScheduleBanner } from "../WorkspaceScheduleBanner/WorkspaceSch
import { WorkspaceScheduleButton } from "../WorkspaceScheduleButton/WorkspaceScheduleButton"
import { WorkspaceSection } from "../WorkspaceSection/WorkspaceSection"
import { WorkspaceStats } from "../WorkspaceStats/WorkspaceStats"
import { WarningAlert } from "../WarningAlert/WarningAlert"
import { useTranslation } from "react-i18next"

export enum WorkspaceErrors {
GET_RESOURCES_ERROR = "getResourcesError",
Expand Down Expand Up @@ -71,19 +73,21 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
buildInfo,
applicationsHost,
}) => {
const { t } = useTranslation("workspacePage")
const styles = useStyles()
const navigate = useNavigate()
const hasTemplateIcon = workspace.template_icon && workspace.template_icon !== ""

const buildError = workspaceErrors[WorkspaceErrors.BUILD_ERROR] ? (
const buildError = Boolean(workspaceErrors[WorkspaceErrors.BUILD_ERROR]) && (
<ErrorSummary error={workspaceErrors[WorkspaceErrors.BUILD_ERROR]} dismissible />
) : (
<></>
)
const cancellationError = workspaceErrors[WorkspaceErrors.CANCELLATION_ERROR] ? (

const cancellationError = Boolean(workspaceErrors[WorkspaceErrors.CANCELLATION_ERROR]) && (
<ErrorSummary error={workspaceErrors[WorkspaceErrors.CANCELLATION_ERROR]} dismissible />
) : (
<></>
)

const workspaceRefreshWarning = Boolean(workspaceErrors[WorkspaceErrors.GET_RESOURCES_ERROR]) && (
<WarningAlert text={t("warningsAndErrors.workspaceRefreshWarning")} dismissible />
)

return (
Expand Down Expand Up @@ -127,6 +131,7 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
<Stack direction="column" className={styles.firstColumnSpacer} spacing={2.5}>
{buildError}
{cancellationError}
{workspaceRefreshWarning}

<WorkspaceScheduleBanner
isLoading={bannerProps.isLoading}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import Button from "@material-ui/core/Button"
import { makeStyles } from "@material-ui/core/styles"
import Alert from "@material-ui/lab/Alert"
import AlertTitle from "@material-ui/lab/AlertTitle"
import { Maybe } from "components/Conditionals/Maybe"
import { FC } from "react"
import * as TypesGen from "../../api/typesGenerated"

const Language = {
bannerTitle: "This workspace has been deleted and cannot be edited.",
createWorkspaceCta: "Create new workspace",
}
import { WarningAlert } from "components/WarningAlert/WarningAlert"
import { useTranslation } from "react-i18next"
import { Maybe } from "components/Conditionals/Maybe"

export interface WorkspaceDeletedBannerProps {
workspace: TypesGen.Workspace
Expand All @@ -20,32 +14,19 @@ export const WorkspaceDeletedBanner: FC<React.PropsWithChildren<WorkspaceDeleted
workspace,
handleClick,
}) => {
const styles = useStyles()
const { t } = useTranslation("workspacePage")
const NewWorkspaceButton = (
<Button onClick={handleClick} size="small">
{t("ctas.createWorkspaceCta")}
</Button>
)

return (
<Maybe condition={workspace.latest_build.status === "deleted"}>
<Alert
className={styles.root}
action={
<Button color="inherit" onClick={handleClick} size="small">
{Language.createWorkspaceCta}
</Button>
}
severity="warning"
>
<AlertTitle>{Language.bannerTitle}</AlertTitle>
</Alert>
<WarningAlert
text={t("warningsAndErrors.workspaceDeletedWarning")}
actions={[NewWorkspaceButton]}
/>
</Maybe>
)
}

export const useStyles = makeStyles(() => {
return {
root: {
alignItems: "center",
"& .MuiAlertTitle-root": {
marginBottom: "0px",
},
},
}
})
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import Button from "@material-ui/core/Button"
import Alert from "@material-ui/lab/Alert"
import AlertTitle from "@material-ui/lab/AlertTitle"
import dayjs from "dayjs"
import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
import utc from "dayjs/plugin/utc"
import { FC } from "react"
import * as TypesGen from "../../api/typesGenerated"
import { isWorkspaceOn } from "../../util/workspace"
import * as TypesGen from "api/typesGenerated"
import { isWorkspaceOn } from "util/workspace"
import { WarningAlert } from "components/WarningAlert/WarningAlert"
import { useTranslation } from "react-i18next"

dayjs.extend(utc)
dayjs.extend(isSameOrBefore)

export const Language = {
bannerAction: "Extend",
bannerTitle: "Your workspace is scheduled to automatically shut down soon.",
}

export interface WorkspaceScheduleBannerProps {
isLoading?: boolean
onExtend: () => void
Expand All @@ -36,26 +31,22 @@ export const WorkspaceScheduleBanner: FC<React.PropsWithChildren<WorkspaceSchedu
onExtend,
workspace,
}) => {
const { t } = useTranslation("workspacePage")

if (!shouldDisplay(workspace)) {
return null
} else {
return (
<Alert
action={
<Button
variant="outlined"
color="inherit"
disabled={isLoading}
onClick={onExtend}
size="small"
>
{Language.bannerAction}
</Button>
}
severity="warning"
>
<AlertTitle>{Language.bannerTitle}</AlertTitle>
</Alert>
)
}

const ScheduleButton = (
<Button variant="outlined" disabled={isLoading} onClick={onExtend} size="small">
{t("ctas.extendScheduleCta")}
</Button>
)

return (
<WarningAlert
text={t("warningsAndErrors.workspaceShutdownWarning")}
actions={[ScheduleButton]}
/>
)
}
3 changes: 3 additions & 0 deletions site/src/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"confirm": "Are you sure you want to proceed? Type the name of this {{entity}} below to confirm.",
"confirmLabel": "Name of {{entity}} to delete",
"incorrectName": "Incorrect {{entity}} name."
},
"ctas": {
"dismissCta": "Dismiss"
}
}
9 changes: 9 additions & 0 deletions site/src/i18n/en/workspacePage.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"editDeadlineMinus": "Subtract one hour",
"editDeadlinePlus": "Add one hour"
},
"ctas": {
"createWorkspaceCta": "Create new workspace",
"extendScheduleCta": "Extend"
},
"warningsAndErrors": {
"workspaceRefreshWarning": "We're having difficulty fetching the latest workspace state. Refresh the page to see the newest changes.",
"workspaceDeletedWarning": "This workspace has been deleted and cannot be edited.",
"workspaceShutdownWarning": "Your workspace is scheduled to automatically shut down soon."
},
"actionButton": {
"start": "Start",
"stop": "Stop",
Expand Down