Skip to content

feat: show user-auth provisioners #14883

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 9 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
display on fe
  • Loading branch information
f0ssel committed Sep 30, 2024
commit a2faf9f665a543720a285d56264883aee3377473
57 changes: 25 additions & 32 deletions site/src/modules/provisioners/ProvisionerGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { createDayString } from "utils/createDayString";
import { docs } from "utils/docs";
import { ProvisionerTag } from "./ProvisionerTag";

type ProvisionerGroupType = "builtin" | "psk" | "key";
type ProvisionerGroupType = "builtin" | "userAuth" | "psk" | "key";

interface ProvisionerGroupProps {
readonly buildInfo: BuildInfoResponse;
Expand Down Expand Up @@ -62,7 +62,6 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
return null;
}

const daemonScope = firstProvisioner.tags.scope || "organization";
const allProvisionersAreSameVersion = provisioners.every(
(it) => it.version === firstProvisioner.version,
);
Expand All @@ -73,9 +72,6 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
provisioners.length === 1
? "1 provisioner"
: `${provisioners.length} provisioners`;
const extraTags = Object.entries(keyTags).filter(
([key]) => key !== "scope" && key !== "owner",
);

let warnings = 0;
let provisionersWithWarnings = 0;
Expand All @@ -102,9 +98,6 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
? "1 provisioner"
: `${provisionersWithWarnings} provisioners`;

const hasMultipleTagVariants =
type === "psk" && provisioners.some((it) => !isSimpleTagSet(it.tags));

return (
<div
css={[
Expand Down Expand Up @@ -142,6 +135,7 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
</span>
</>
)}
{type === "userAuth" && <UserAuthProvisionerTitle />}

{type === "psk" && <PskProvisionerTitle />}
{type === "key" && (
Expand All @@ -168,28 +162,8 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
justifyContent: "right",
}}
>
{!hasMultipleTagVariants ? (
<Tooltip title="Scope">
<Pill
size="lg"
icon={
daemonScope === "organization" ? (
<BusinessIcon />
) : (
<PersonIcon />
)
}
>
<span css={{ textTransform: "capitalize" }}>{daemonScope}</span>
</Pill>
</Tooltip>
) : (
<Pill size="lg" icon={<TagIcon />}>
Multiple tags
</Pill>
)}
{type === "key" &&
extraTags.map(([key, value]) => (
Object.entries(keyTags).map(([key, value]) => (
<ProvisionerTag key={key} tagName={key} tagValue={value} />
))}
</div>
Expand Down Expand Up @@ -248,9 +222,7 @@ export const ProvisionerGroup: FC<ProvisionerGroupProps> = ({
)}
</span>
</div>
{hasMultipleTagVariants && (
<PskProvisionerTags tags={provisioner.tags} />
)}
<PskProvisionerTags tags={provisioner.tags} />
</Stack>
</div>
))}
Expand Down Expand Up @@ -413,6 +385,27 @@ const BuiltinProvisionerTitle: FC = () => {
);
};

const UserAuthProvisionerTitle: FC = () => {
return (
<h4 css={styles.groupTitle}>
<Stack direction="row" alignItems="end" spacing={1}>
<span>User provisioners</span>
<HelpTooltip>
<HelpTooltipTrigger />
<HelpTooltipContent>
<HelpTooltipTitle>User provisioners</HelpTooltipTitle>
<HelpTooltipText>
These provisioners all use user session authentication. User
provisioners can be scoped to the user or organization.{" "}
<Link href={docs("/")}>Learn more&hellip;</Link>
</HelpTooltipText>
</HelpTooltipContent>
</HelpTooltip>
</Stack>
</h4>
);
};

const PskProvisionerTitle: FC = () => {
return (
<h4 css={styles.groupTitle}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ const ViewContent: FC<ViewContentProps> = ({ buildInfo, provisioners }) => {
{provisioners.map((group) => {
const type = getGroupType(group.key);

// We intentionally hide user-authenticated provisioners for now
// because there are 1. some grouping issues on the backend and 2. we
// should ideally group them by the user who authenticated them, and
// not just lump them all together.
if (type === "userAuth") {
return null;
}
// // We intentionally hide user-authenticated provisioners for now
// // because there are 1. some grouping issues on the backend and 2. we
// // should ideally group them by the user who authenticated them, and
// // not just lump them all together.
// if (type === "userAuth") {
// return null;
// }

return (
<ProvisionerGroup
Expand Down
Loading