Skip to content

feat: move proxy settings page to deployment options #8246

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

Merged
merged 30 commits into from
Jun 30, 2023

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 28, 2023

The Workspace proxy settings page was not showing any more information, so it was moved to the "Deployment" page only viewable by admins. More details can be shown there.

Closes #8153

Images

Regular user (member)

Screenshot from 2023-06-28 09-16-13

Admin

Screenshot from 2023-06-28 09-16-18

Notice the more accurate badges. Instead of just Healthy and Unhealthy. Not shown are the error messages that cause those errors. Need to figure out a way to include them with good styling.

Screenshot from 2023-06-28 09-14-50

Additional Changes

  • Typesgenerated: I added functionality for generic slices
  • ServerSide rendering: Return Region or WorkspaceProxy based on the user's perms

Future work

Each workspace proxy has 0 or more warnings and errors. We should show these, I just do not know the best way to style it 😢.

@bpmct
Copy link
Member

bpmct commented Jun 28, 2023

Does this close #8153?

@Emyrk
Copy link
Member Author

Emyrk commented Jun 28, 2023

Does this close #8153?

Yes

@Emyrk Emyrk requested review from BrunoQuaresma and Kira-Pilot and removed request for BrunoQuaresma and Kira-Pilot June 29, 2023 12:37
Comment on lines +212 to +217
case "recursive_inline":
// recursive_inline is a helper to make recursive tables look nicer.
// It skips prefixing the parent name to the child name. If you do this,
// make sure the child name is unique across all nested structs in the parent.
recursiveOpt = true
skipParentNameOpt = true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to do this to make the table names nice. Otherwise it is like Proxy Region Url instead of just URL

Comment on lines -72 to -75
onSelectRegion={onSelect}
preferred={
preferredProxy ? proxy.id === preferredProxy.id : false
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deployment page removes the ability to select a proxy. That is all done in the dropdown now.

Comment on lines +1 to +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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typesgenerated addition just allows this.

Comment on lines +20 to +28
// 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"`
//}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might get to this later in another PR. I do not need this in this PR.

Comment on lines 694 to 708
return TypescriptType{ValueType: underlying.ValueType + "[]", AboveTypeLine: underlying.AboveTypeLine}, nil
var genValue = ""
if underlying.GenericValue != "" {
genValue = underlying.GenericValue + "[]"
}
return TypescriptType{
ValueType: underlying.ValueType + "[]",
GenericValue: genValue,
AboveTypeLine: underlying.AboveTypeLine,
GenericTypes: underlying.GenericTypes,
}, nil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason this did not exist is because we did not need it yet. It's a trivial addition.

Copy link
Member

@bpmct bpmct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the description for workspace proxies in the dropdown? Users may not know what this region does (is it where I provision workspaces, is it my preferred DERP when I ssh, etc?)

Workspace proxies are used to reduce the latency of web-based connections to your workspaces.

@Emyrk
Copy link
Member Author

Emyrk commented Jun 29, 2023

Can you add the description for workspace proxies in the dropdown? Users may not know what this region does (is it where I provision workspaces, is it my preferred DERP when I ssh, etc?)

Workspace proxies are used to reduce the latency of web-based connections to your workspaces.

Can you add the description for workspace proxies in the dropdown? Users may not know what this region does (is it where I provision workspaces, is it my preferred DERP when I ssh, etc?)

Workspace proxies are used to reduce the latency of web-based connections to your workspaces.

@bpmct I added that to this ticket: #8155

This PR has already grown a lot and I am stuck on how to style some dropdown additions.

@Emyrk Emyrk requested a review from Kira-Pilot June 29, 2023 18:42
},
}
out, err := cliui.DisplayTable(inlineIn, "", []string{"name", "age"})
log.Println("rendered table:\n" + out)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this log intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's helpful to build the expected output. Test logs only log in the error case by default (unless you do go test -v)

warnBadge: {
border: `1px solid ${theme.palette.warning.light}`,
backgroundColor: theme.palette.warning.dark,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We do now support writing styled components as opposed to classes, which we may want to lean into so we can get rid of makeStyles eventually. Not something that needs to be changed here - just a heads up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh TIL. Will have to see some examples in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 124 to 135
let query = async (): Promise<Region[]> => {
const resp = await getWorkspaceProxyRegions()
return resp.regions
}

if (permissions.editWorkspaceProxies) {
// Admins should query the more detailed endpoint.
query = async (): Promise<Region[]> => {
const resp = await getWorkspaceProxies()
return resp.regions
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let query = async (): Promise<Region[]> => {
const resp = await getWorkspaceProxyRegions()
return resp.regions
}
if (permissions.editWorkspaceProxies) {
// Admins should query the more detailed endpoint.
query = async (): Promise<Region[]> => {
const resp = await getWorkspaceProxies()
return resp.regions
}
}
const query = async (): Promise<Region[]> => {
const endpoint = permissions.editWorkspaceProxies ? getWorkspaceProxies : getWorkspaceProxyRegions
const resp = await endpoint()
return resp.regions
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is always a smaller way 😄

Copy link
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled down - seems to be working smoothly!

@Emyrk Emyrk merged commit f0bd258 into main Jun 30, 2023
@Emyrk Emyrk deleted the stevenmasley/proxy_page_move branch June 30, 2023 15:32
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move "Proxy Settings" to Deployment page and add "WorkspaceProxy" label to dropdown
3 participants