-
Notifications
You must be signed in to change notification settings - Fork 985
refactor(site): Add more info on agent outdated tooltip and update action #5967
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import { useRef, useState, FC } from "react" | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import RefreshIcon from "@material-ui/icons/RefreshOutlined" | ||
import { | ||
HelpTooltipText, | ||
HelpPopover, | ||
HelpTooltipTitle, | ||
HelpTooltipAction, | ||
HelpTooltipLinksGroup, | ||
HelpTooltipContext, | ||
} from "components/Tooltips/HelpTooltip" | ||
import { WorkspaceAgent } from "api/typesGenerated" | ||
import { getDisplayVersionStatus } from "util/workspace" | ||
import { Stack } from "components/Stack/Stack" | ||
|
||
export const AgentVersion: FC<{ | ||
agent: WorkspaceAgent | ||
serverVersion: string | ||
}> = ({ agent, serverVersion }) => { | ||
onUpdate: () => void | ||
}> = ({ agent, serverVersion, onUpdate }) => { | ||
const styles = useStyles() | ||
const anchorRef = useRef<HTMLButtonElement>(null) | ||
const [isOpen, setIsOpen] = useState(false) | ||
|
@@ -44,19 +50,52 @@ export const AgentVersion: FC<{ | |
onOpen={() => setIsOpen(true)} | ||
onClose={() => setIsOpen(false)} | ||
> | ||
<HelpTooltipTitle>Agent Outdated</HelpTooltipTitle> | ||
<HelpTooltipText> | ||
This agent is an older version than the Coder server. This can happen | ||
after you update Coder with running workspaces. To fix this, you can | ||
stop and start the workspace. | ||
</HelpTooltipText> | ||
<HelpTooltipContext.Provider | ||
value={{ open: isOpen, onClose: () => setIsOpen(false) }} | ||
> | ||
<Stack spacing={1}> | ||
<div> | ||
<HelpTooltipTitle>Agent Outdated</HelpTooltipTitle> | ||
<HelpTooltipText> | ||
This agent is an older version than the Coder server. This can | ||
happen after you update Coder with running workspaces. To fix | ||
this, you can stop and start the workspace. | ||
</HelpTooltipText> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a translation. |
||
</div> | ||
|
||
<Stack spacing={0.5}> | ||
<span className={styles.versionLabel}>Agent version</span> | ||
<span>{agent.version}</span> | ||
</Stack> | ||
|
||
<Stack spacing={0.5}> | ||
<span className={styles.versionLabel}>Server version</span> | ||
<span>{serverVersion}</span> | ||
</Stack> | ||
|
||
<HelpTooltipLinksGroup> | ||
<HelpTooltipAction | ||
icon={RefreshIcon} | ||
onClick={onUpdate} | ||
ariaLabel="Update workspace" | ||
> | ||
Update workspace | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add a warning that this will restart the workspace and running applications will be terminated? (Or something along those lines.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is a good idea but I think it is "common sense" that updating something will turn it off. We have other parts on the app we could use this warning to warn users about update actions (or actions that terminate the workspace) so, to make this work worth it, I would wait for users to ask for that. |
||
</HelpTooltipAction> | ||
</HelpTooltipLinksGroup> | ||
</Stack> | ||
</HelpTooltipContext.Provider> | ||
</HelpPopover> | ||
</> | ||
) | ||
} | ||
|
||
const useStyles = makeStyles(() => ({ | ||
const useStyles = makeStyles((theme) => ({ | ||
trigger: { | ||
cursor: "pointer", | ||
}, | ||
|
||
versionLabel: { | ||
fontWeight: 600, | ||
color: theme.palette.text.primary, | ||
}, | ||
})) |
Uh oh!
There was an error while loading. Please reload this page.