Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
aslilac merged 17 commits intomainfrompsk-tags
Sep 17, 2024
Merged
Changes fromall commits
Commits
Show all changes
17 commits
Select commitHold shift + click to select a range
665c9b3
work
aslilacSep 5, 2024
4558b44
do the stuff
aslilacSep 6, 2024
fcd8614
🧹
aslilacSep 6, 2024
82c6362
feat: show more detailed provisioner version info
aslilacSep 6, 2024
8bb49a7
🧹
aslilacSep 6, 2024
dfa2621
descriptive lil help guys :)
aslilacSep 9, 2024
55360f7
🧹
aslilacSep 9, 2024
9129412
psk tags psk tags psk tags
aslilacSep 9, 2024
401eab3
Merge branch 'main' into group-provisioners
aslilacSep 17, 2024
716b257
hook up to api
aslilacSep 17, 2024
a1b7cbd
:)
aslilacSep 17, 2024
5d6d312
Merge branch 'group-provisioners' into provisioner-version-popups
aslilacSep 17, 2024
37e3933
v2.99.99
aslilacSep 17, 2024
2c6fd6d
Merge branch 'provisioner-version-popups' into provisioner-types
aslilacSep 17, 2024
fd3b259
Merge branch 'provisioner-types' into psk-tags
aslilacSep 17, 2024
1f8c386
tada
aslilacSep 17, 2024
cc620a5
Merge branch 'main' into psk-tags
aslilacSep 17, 2024
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
204 changes: 139 additions & 65 deletionssite/src/modules/provisioners/ProvisionerGroup.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,13 +134,7 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
>
<Tooltip title="Scope">
<Pill size="lg" icon={iconScope}>
<span
css={{
":first-letter": { textTransform: "uppercase" },
}}
>
{daemonScope}
</span>
<span css={{ textTransform: "capitalize" }}>{daemonScope}</span>
</Pill>
</Tooltip>
{type === "key" &&
Expand All@@ -166,67 +160,45 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
borderRadius: 8,
border: `1px solid ${theme.palette.divider}`,
fontSize: 14,
padding: "12px 18px",
width:310,
padding: "14px 18px",
width:375,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could thewidth be swapped out forflex-basis?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The 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"

}}
>
<div css={{ lineHeight: 1.6 }}>
<h4 css={styles.groupTitle}>{provisioner.name}</h4>
<span
css={{ color: theme.palette.text.secondary, fontSize: 13 }}
>
{type === "builtin" ? (
<span>Built-in</span>
) : (
<>
<Popover mode="hover">
<PopoverTrigger>
<span>
{buildInfo
? provisioner.version === buildInfo.version
? "Up to date"
: "Out of date"
: provisioner.version}
<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}
/>{" "}
&mdash;{" "}
{provisioner.last_seen_at && (
<span data-chromatic="ignore">
Last seen{" "}
{createDayString(provisioner.last_seen_at)}
</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.version !== buildInfo?.version && (
<p css={[styles.text, { fontSize: 13 }]}>
This provisioner is out of date. You may
experience issues when using a provisioner version
that doesn&apos;t match your Coder deployment.
Please upgrade to a newer version.{" "}
<Link href={docs("/")}>Learn more&hellip;</Link>
</p>
)}
</PopoverContent>
</Popover>{" "}
&mdash;{" "}
{provisioner.last_seen_at && (
<span data-chromatic="ignore">
Last seen {createDayString(provisioner.last_seen_at)}
</span>
)}
</>
)}
</span>
</div>
)}
</>
)}
</span>
</div>
{type === "psk" && (
<PskProvisionerTags tags={provisioner.tags} />
)}
</Stack>
</div>
))}
</div>
Expand DownExpand Up@@ -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}>
Expand All@@ -283,6 +356,7 @@ const BuiltinProvisionerTitle: FC = () => {
</h4>
);
};

const PskProvisionerTitle: FC = () => {
return (
<h4 css={styles.groupTitle}>
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp