Skip to content

Commit b07530b

Browse files
committed
FE works!
1 parent 71bc50d commit b07530b

File tree

13 files changed

+106
-31
lines changed

13 files changed

+106
-31
lines changed

coderd/apidoc/docs.go

Lines changed: 3 additions & 3 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 & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

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

codersdk/users.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ type OIDCAuthMethod struct {
223223

224224
type UserParameter struct {
225225
Name string `json:"name"`
226-
Value string `json:"display_name"`
226+
Value string `json:"value"`
227227
LastUsedAt time.Time `json:"last_used"`
228228
}
229229

docs/api/schemas.md

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

docs/api/users.md

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

site/src/api/api.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ export const getAuthenticatedUser = async () => {
129129
return response.data;
130130
};
131131

132+
export const getUserParameters = async () => {
133+
const response = await axios.get<TypesGen.UserParameter[]>(
134+
"/api/v2/users/me/parameters",
135+
);
136+
return response.data;
137+
};
138+
132139
export const getAuthMethods = async (): Promise<TypesGen.AuthMethods> => {
133140
const response = await axios.get<TypesGen.AuthMethods>(
134141
"/api/v2/users/authmethods",

site/src/api/queries/users.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ export const me = (): UseQueryOptions<User> & {
134134
};
135135
};
136136

137+
export const userParameters = () => {
138+
return {
139+
queryKey: ["userParameters"],
140+
queryFn: API.getUserParameters,
141+
};
142+
};
143+
137144
export const hasFirstUser = () => {
138145
return {
139146
queryKey: ["hasFirstUser"],

site/src/api/typesGenerated.ts

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

site/src/components/RichParameterInput/RichParameterInput.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,16 @@ export type RichParameterInputProps = Omit<
137137
"size" | "onChange"
138138
> & {
139139
parameter: TemplateVersionParameter;
140+
// defaultReason is commentary on how the default value was determined.
141+
defaultReason?: JSX.Element;
140142
onChange: (value: string) => void;
141143
size?: Size;
142144
};
143145

144146
export const RichParameterInput: FC<RichParameterInputProps> = ({
145147
parameter,
146148
size = "medium",
149+
defaultReason,
147150
...fieldProps
148151
}) => {
149152
return (
@@ -156,6 +159,11 @@ export const RichParameterInput: FC<RichParameterInputProps> = ({
156159
<ParameterLabel parameter={parameter} />
157160
<div css={{ display: "flex", flexDirection: "column" }}>
158161
<RichParameterField {...fieldProps} size={size} parameter={parameter} />
162+
{defaultReason && (
163+
<div css={{ marginTop: 4, fontSize: 12 }}>
164+
🪄 Autofilling {defaultReason}
165+
</div>
166+
)}
159167
</div>
160168
</Stack>
161169
);

0 commit comments

Comments
 (0)