Skip to content

Commit 0b82f41

Browse files
authored
feat: allow masking workspace parameter inputs (#18595)
1 parent d22ac1c commit 0b82f41

File tree

11 files changed

+140
-49
lines changed

11 files changed

+140
-49
lines changed

coderd/apidoc/docs.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/db2sdk/db2sdk.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ func PreviewParameter(param previewtypes.Parameter) codersdk.PreviewParameter {
816816
Placeholder: param.Styling.Placeholder,
817817
Disabled: param.Styling.Disabled,
818818
Label: param.Styling.Label,
819+
MaskInput: param.Styling.MaskInput,
819820
},
820821
Mutable: param.Mutable,
821822
DefaultValue: PreviewHCLString(param.DefaultValue),

codersdk/parameters.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type PreviewParameterStyling struct {
9191
Placeholder *string `json:"placeholder,omitempty"`
9292
Disabled *bool `json:"disabled,omitempty"`
9393
Label *string `json:"label,omitempty"`
94+
MaskInput *bool `json:"mask_input,omitempty"`
9495
}
9596

9697
type PreviewParameterOption struct {

docs/reference/api/schemas.md

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/templates.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ require (
483483
require (
484484
github.com/coder/agentapi-sdk-go v0.0.0-20250505131810-560d1d88d225
485485
github.com/coder/aisdk-go v0.0.9
486-
github.com/coder/preview v1.0.1
486+
github.com/coder/preview v1.0.2
487487
github.com/fsnotify/fsnotify v1.9.0
488488
github.com/mark3labs/mcp-go v0.32.0
489489
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ github.com/coder/pq v1.10.5-0.20250630052411-a259f96b6102 h1:ahTJlTRmTogsubgRVGO
916916
github.com/coder/pq v1.10.5-0.20250630052411-a259f96b6102/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
917917
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0 h1:3A0ES21Ke+FxEM8CXx9n47SZOKOpgSE1bbJzlE4qPVs=
918918
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0/go.mod h1:5UuS2Ts+nTToAMeOjNlnHFkPahrtDkmpydBen/3wgZc=
919-
github.com/coder/preview v1.0.1 h1:f6q+RjNelwnkyXfGbmVlb4dcUOQ0z4mPsb2kuQpFHuU=
920-
github.com/coder/preview v1.0.1/go.mod h1:efDWGlO/PZPrvdt5QiDhMtTUTkPxejXo9c0wmYYLLjM=
919+
github.com/coder/preview v1.0.2 h1:ZFfox0PgXcIouB9iWGcZyOtdL0h2a4ju1iPw/dMqsg4=
920+
github.com/coder/preview v1.0.2/go.mod h1:efDWGlO/PZPrvdt5QiDhMtTUTkPxejXo9c0wmYYLLjM=
921921
github.com/coder/quartz v0.2.1 h1:QgQ2Vc1+mvzewg2uD/nj8MJ9p9gE+QhGJm+Z+NGnrSE=
922922
github.com/coder/quartz v0.2.1/go.mod h1:vsiCc+AHViMKH2CQpGIpFgdHIEQsxwm8yCscqKmzbRA=
923923
github.com/coder/retry v1.5.1 h1:iWu8YnD8YqHs3XwqrqsjoBTAVqT9ml6z9ViJ2wlMiqc=

site/src/api/typesGenerated.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/modules/workspaces/DynamicParameter/DynamicParameter.stories.tsx

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ const meta: Meta<typeof DynamicParameter> = {
88
parameters: {
99
layout: "centered",
1010
},
11+
args: {
12+
parameter: MockPreviewParameter,
13+
onChange: () => {},
14+
},
1115
};
1216

1317
export default meta;
1418
type Story = StoryObj<typeof DynamicParameter>;
1519

16-
export const TextInput: Story = {
17-
args: {
18-
parameter: {
19-
...MockPreviewParameter,
20-
},
21-
},
22-
};
20+
export const TextInput: Story = {};
2321

2422
export const TextArea: Story = {
2523
args: {
@@ -230,3 +228,30 @@ export const AllBadges: Story = {
230228
isPreset: true,
231229
},
232230
};
231+
232+
export const MaskedInput: Story = {
233+
args: {
234+
parameter: {
235+
...MockPreviewParameter,
236+
form_type: "input",
237+
styling: {
238+
...MockPreviewParameter.styling,
239+
placeholder: "Tell me a secret",
240+
mask_input: true,
241+
},
242+
},
243+
},
244+
};
245+
246+
export const MaskedTextArea: Story = {
247+
args: {
248+
parameter: {
249+
...MockPreviewParameter,
250+
form_type: "textarea",
251+
styling: {
252+
...MockPreviewParameter.styling,
253+
mask_input: true,
254+
},
255+
},
256+
},
257+
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy