8000 feat: allow masking workspace parameter inputs by aslilac · Pull Request #18595 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: allow masking workspace parameter inputs #18595

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
go back
  • Loading branch information
aslilac committed Jun 26, 2025
commit 2ad7afade9c4cf4c94986fa5e130942ee12cabbf
26 changes: 14 additions & 12 deletions site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ import {
TriangleAlert,
} from "lucide-react";
import { type FC, useEffect, useId, useRef, useState } from "react";
import { cn } from "utils/cn";
import type { AutofillBuildParameter } from "utils/richParameters";
import * as Yup from "yup";
import { cn } from "utils/cn";

interface DynamicParameterProps {
parameter: PreviewParameter;
Expand Down Expand Up @@ -82,7 +82,7 @@ export const DynamicParameter: FC<DynamicParameterProps> = ({
/>
<div className="max-w-lg">
{parameter.form_type === "input" ||
parameter.form_type === "textarea" ? (
parameter.form_type === "textarea" ? (
<DebouncedParameterField
id={id}
parameter={parameter}
Expand Down Expand Up @@ -321,8 +321,8 @@ const DebouncedParameterField: FC<DebouncedParameterFieldProps> = ({
className={cn(
"overflow-y-auto max-h-[500px]",
parameter.styling?.mask_input &&
!showMaskedInput &&
"[-webkit-text-security:disc]",
!showMaskedInput &&
"[-webkit-text-security:disc]",
)}
value={localValue}
onChange={(e) => {
Expand Down Expand Up @@ -689,10 +689,11 @@ const ParameterDiagnostics: FC<ParameterDiagnosticsProps> = ({
return (
<div
key={`parameter-diagnostic-${diagnostic.summary}-${index}`}
className={`text-xs px-1 ${diagnostic.severity === "error"
? "text-content-destructive"
: "text-content-warning"
}`}
className={`text-xs px-1 ${
diagnostic.severity === "error"
? "text-content-destructive"
: "text-content-warning"
}`}
>
<p className="font-medium">{diagnostic.summary}</p>
{diagnostic.detail && <p className="m-0">{diagnostic.detail}</p>}
Expand Down Expand Up @@ -949,10 +950,11 @@ export const Diagnostics: FC<DiagnosticsProps> = ({ diagnostics }) => {
<div
key={`diagnostic-${diagnostic.summary}-${index}`}
className={`text-xs font-semibold flex flex-col rounded-md border px-3.5 py-3.5 border-solid
${diagnostic.severity === "error"
? "text-content-primary border-border-destructive bg-content-destructive/15"
: "text-content-primary border-border-warning bg-content-warning/15"
}`}
${
diagnostic.severity === "error"
? "text-content-primary border-border-destructive bg-content-destructive/15"
: "text-content-primary border-border-warning bg-content-warning/15"
}`}
>
<div className="flex flex-row items-start">
{diagnostic.severity === "error" && (
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/TaskPage/TaskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useQuery } from "react-query";
import { useParams } from "react-router-dom";
import { Link as RouterLink } from "react-router-dom";
import { pageTitle } from "utils/page";
import { ellipsizeText } from "utils/text";
import { ellipsizeText } from "utils/ellipsizeText";
import {
ActiveTransition,
WorkspaceBuildProgress,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Nullable } from "./nullable";
import { ellipsizeText, maskText } from "./text";
import { ellipsizeText } from "./ellipsizeText";

describe("ellipsizeText", () => {
it.each([
Expand All @@ -19,9 +19,3 @@ describe("ellipsizeText", () => {
},
);
});

describe("maskText", () => {
test("masks text", () => {
expect(maskText("hello, computer!")).toBe("\u2022".repeat(16));
});
});
File renamed without changes.
Loading
0