mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
fix: adjust ParameterSchema type for workspace creation (#2384)
* add ability to activate users resolves #2254 * added test * PR feedback * guarding against null validation_contains field * fixing type for ParameterSchema resolves #2161
This commit is contained in:
@ -72,7 +72,7 @@ type ParameterSchema struct {
|
|||||||
|
|
||||||
// This is a special array of items provided if the validation condition
|
// This is a special array of items provided if the validation condition
|
||||||
// explicitly states the value must be one of a set.
|
// explicitly states the value must be one of a set.
|
||||||
ValidationContains []string `json:"validation_contains"`
|
ValidationContains []string `json:"validation_contains,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateParameterRequest is used to create a new parameter value for a scope.
|
// CreateParameterRequest is used to create a new parameter value for a scope.
|
||||||
|
@ -190,7 +190,7 @@ export interface ParameterSchema {
|
|||||||
readonly validation_condition: string
|
readonly validation_condition: string
|
||||||
readonly validation_type_system: string
|
readonly validation_type_system: string
|
||||||
readonly validation_value_type: string
|
readonly validation_value_type: string
|
||||||
readonly validation_contains: string[]
|
readonly validation_contains?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
// From codersdk/provisionerdaemons.go:33:6
|
// From codersdk/provisionerdaemons.go:33:6
|
||||||
|
@ -29,7 +29,7 @@ export const ParameterInput: FC<ParameterInputProps> = ({ disabled, onChange, sc
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ParameterField: React.FC<ParameterInputProps> = ({ disabled, onChange, schema }) => {
|
const ParameterField: React.FC<ParameterInputProps> = ({ disabled, onChange, schema }) => {
|
||||||
if (schema.validation_contains.length > 0) {
|
if (schema.validation_contains && schema.validation_contains.length > 0) {
|
||||||
return (
|
return (
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
defaultValue={schema.default_source_value}
|
defaultValue={schema.default_source_value}
|
||||||
|
Reference in New Issue
Block a user