mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
feat: move proxy settings page to deployment options (#8246)
* feat: Move workspace proxy page to deployment options Workspace proxy settings page is now an admin feature * WorkspaceProxy response extends region
This commit is contained in:
@@ -584,7 +584,7 @@ type TypescriptType struct {
|
||||
// Example: 'C = comparable'.
|
||||
GenericTypes map[string]string
|
||||
// GenericValue is the value using the Generic name, rather than the constraint.
|
||||
// This is only usedful if you can use the generic syntax. Things like maps
|
||||
// This is only useful if you can use the generic syntax. Things like maps
|
||||
// don't currently support this, and will use the ValueType instead.
|
||||
// Example:
|
||||
// Given the Golang
|
||||
@@ -667,9 +667,14 @@ func (g *Generator) typescriptType(ty types.Type) (TypescriptType, error) {
|
||||
}
|
||||
aboveTypeLine = aboveTypeLine + valueType.AboveTypeLine
|
||||
|
||||
mergeGens := keyType.GenericTypes
|
||||
for k, v := range valueType.GenericTypes {
|
||||
mergeGens[k] = v
|
||||
}
|
||||
return TypescriptType{
|
||||
ValueType: fmt.Sprintf("Record<%s, %s>", keyType.ValueType, valueType.ValueType),
|
||||
AboveTypeLine: aboveTypeLine,
|
||||
GenericTypes: mergeGens,
|
||||
}, nil
|
||||
case *types.Slice, *types.Array:
|
||||
// Slice/Arrays are pretty much the same.
|
||||
@@ -691,7 +696,16 @@ func (g *Generator) typescriptType(ty types.Type) (TypescriptType, error) {
|
||||
if err != nil {
|
||||
return TypescriptType{}, xerrors.Errorf("array: %w", err)
|
||||
}
|
||||
return TypescriptType{ValueType: underlying.ValueType + "[]", AboveTypeLine: underlying.AboveTypeLine}, nil
|
||||
genValue := ""
|
||||
if underlying.GenericValue != "" {
|
||||
genValue = underlying.GenericValue + "[]"
|
||||
}
|
||||
return TypescriptType{
|
||||
ValueType: underlying.ValueType + "[]",
|
||||
GenericValue: genValue,
|
||||
AboveTypeLine: underlying.AboveTypeLine,
|
||||
GenericTypes: underlying.GenericTypes,
|
||||
}, nil
|
||||
}
|
||||
case *types.Named:
|
||||
n := ty
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package genericmap
|
||||
|
||||
type Foo struct {
|
||||
Bar string `json:"bar"`
|
||||
}
|
||||
|
||||
type Buzz struct {
|
||||
Foo `json:"foo"`
|
||||
Bazz string `json:"bazz"`
|
||||
}
|
||||
|
||||
type Custom interface {
|
||||
Foo | Buzz
|
||||
}
|
||||
|
||||
type FooBuzz[R Custom] struct {
|
||||
Something []R `json:"something"`
|
||||
}
|
||||
|
||||
// Not yet supported
|
||||
//type FooBuzzMap[R Custom] struct {
|
||||
// Something map[string]R `json:"something"`
|
||||
//}
|
||||
|
||||
// Not yet supported
|
||||
//type FooBuzzAnonymousUnion[R Foo | Buzz] struct {
|
||||
// Something []R `json:"something"`
|
||||
//}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Code generated by 'make site/src/api/typesGenerated.ts'. DO NOT EDIT.
|
||||
|
||||
// From codersdk/genericmap.go
|
||||
export interface Buzz {
|
||||
readonly foo: Foo
|
||||
readonly bazz: string
|
||||
}
|
||||
|
||||
// From codersdk/genericmap.go
|
||||
export interface Foo {
|
||||
readonly bar: string
|
||||
}
|
||||
|
||||
// From codersdk/genericmap.go
|
||||
export interface FooBuzz<R extends Custom> {
|
||||
readonly something: R[]
|
||||
}
|
||||
|
||||
// From codersdk/genericmap.go
|
||||
export type Custom = Foo | Buzz
|
||||
Reference in New Issue
Block a user