- Notifications
You must be signed in to change notification settings - Fork928
feat: show tags for psk provisioners#14628
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
665c9b3
4558b44
fcd8614
82c6362
8bb49a7
dfa2621
55360f7
9129412
401eab3
716b257
a1b7cbd
5d6d312
37e3933
2c6fd6d
fd3b259
1f8c386
cc620a5
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -134,13 +134,7 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({ | ||
> | ||
<Tooltip title="Scope"> | ||
<Pill size="lg" icon={iconScope}> | ||
<span css={{ textTransform: "capitalize" }}>{daemonScope}</span> | ||
</Pill> | ||
</Tooltip> | ||
{type === "key" && | ||
@@ -166,67 +160,45 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({ | ||
borderRadius: 8, | ||
border: `1px solid ${theme.palette.divider}`, | ||
fontSize: 14, | ||
padding: "14px 18px", | ||
width:375, | ||
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. Could the 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 kinda don't want them to grow tho, and disrupt the "grid" | ||
}} | ||
> | ||
<Stack | ||
direction="row" | ||
justifyContent="space-between" | ||
alignItems="center" | ||
> | ||
<div css={{ lineHeight: 1.5 }}> | ||
<h4 css={{ fontWeight: 500, margin: 0 }}> | ||
{provisioner.name} | ||
</h4> | ||
<span | ||
css={{ color: theme.palette.text.secondary, fontSize: 12 }} | ||
> | ||
{type === "builtin" ? ( | ||
<span>Built-in</span> | ||
) : ( | ||
<> | ||
<ProvisionerVersionPopover | ||
buildInfo={buildInfo} | ||
provisioner={provisioner} | ||
/>{" "} | ||
—{" "} | ||
{provisioner.last_seen_at && ( | ||
<span data-chromatic="ignore"> | ||
Last seen{" "} | ||
{createDayString(provisioner.last_seen_at)} | ||
</span> | ||
)} | ||
</> | ||
)} | ||
</span> | ||
</div> | ||
{type === "psk" && ( | ||
<PskProvisionerTags tags={provisioner.tags} /> | ||
)} | ||
</Stack> | ||
</div> | ||
))} | ||
</div> | ||
@@ -263,6 +235,107 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({ | ||
); | ||
}; | ||
interface ProvisionerVersionPopoverProps { | ||
buildInfo?: BuildInfoResponse; | ||
provisioner: ProvisionerDaemon; | ||
} | ||
const ProvisionerVersionPopover: FC<ProvisionerVersionPopoverProps> = ({ | ||
buildInfo, | ||
provisioner, | ||
}) => { | ||
return ( | ||
<Popover mode="hover"> | ||
<PopoverTrigger> | ||
<span> | ||
{buildInfo | ||
? provisioner.version === buildInfo.version | ||
? "Up to date" | ||
: "Out of date" | ||
: provisioner.version} | ||
</span> | ||
</PopoverTrigger> | ||
<PopoverContent | ||
transformOrigin={{ vertical: -8, horizontal: 0 }} | ||
css={{ | ||
"& .MuiPaper-root": { | ||
padding: "20px 20px 8px", | ||
maxWidth: 340, | ||
}, | ||
}} | ||
> | ||
<h4 css={styles.versionPopoverTitle}>Release version</h4> | ||
<p css={styles.text}>{provisioner.version}</p> | ||
<h4 css={styles.versionPopoverTitle}>Protocol version</h4> | ||
<p css={styles.text}>{provisioner.api_version}</p> | ||
{provisioner.api_version !== buildInfo?.provisioner_api_version && ( | ||
<p css={[styles.text, { fontSize: 13 }]}> | ||
This provisioner is out of date. You may experience issues when | ||
using a provisioner version that doesn’t match your Coder | ||
deployment. Please upgrade to a newer version.{" "} | ||
<Link href={docs("/")}>Learn more…</Link> | ||
</p> | ||
)} | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
}; | ||
interface PskProvisionerTagsProps { | ||
tags: Record<string, string>; | ||
} | ||
const PskProvisionerTags: FC<PskProvisionerTagsProps> = ({ tags }) => { | ||
const daemonScope = tags.scope || "organization"; | ||
const iconScope = daemonScope === "organization" ? <Business /> : <Person />; | ||
const extraTags = Object.entries(tags).filter( | ||
([tag]) => tag !== "scope" && tag !== "owner", | ||
); | ||
if (extraTags.length === 0) { | ||
return ( | ||
<Pill icon={iconScope}> | ||
<span css={{ textTransform: "capitalize" }}>{daemonScope}</span> | ||
</Pill> | ||
); | ||
} | ||
return ( | ||
<Popover mode="hover"> | ||
<PopoverTrigger> | ||
<Pill icon={iconScope}> | ||
{extraTags.length === 1 ? "+ 1 tag" : `+ ${extraTags.length} tags`} | ||
</Pill> | ||
</PopoverTrigger> | ||
<PopoverContent | ||
transformOrigin={{ vertical: -8, horizontal: 0 }} | ||
css={{ | ||
"& .MuiPaper-root": { | ||
padding: 20, | ||
maxWidth: 340, | ||
width: "fit-content", | ||
}, | ||
}} | ||
> | ||
<div | ||
css={{ | ||
marginLeft: "auto", | ||
display: "flex", | ||
flexWrap: "wrap", | ||
gap: 12, | ||
justifyContent: "right", | ||
}} | ||
> | ||
{extraTags.map(([key, value]) => ( | ||
<ProvisionerTag key={key} tagName={key} tagValue={value} /> | ||
))} | ||
</div> | ||
</PopoverContent> | ||
</Popover> | ||
); | ||
}; | ||
const BuiltinProvisionerTitle: FC = () => { | ||
return ( | ||
<h4 css={styles.groupTitle}> | ||
@@ -283,6 +356,7 @@ const BuiltinProvisionerTitle: FC = () => { | ||
</h4> | ||
); | ||
}; | ||
const PskProvisionerTitle: FC = () => { | ||
return ( | ||
<h4 css={styles.groupTitle}> | ||
Uh oh!
There was an error while loading.Please reload this page.