Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: Drop application host call, default to regions for info#7457

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 3 commits intomainfromstevenmasley/drop_app_host
May 9, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionscoderd/apidoc/docs.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

1 change: 1 addition & 0 deletionscoderd/apidoc/swagger.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

1 change: 1 addition & 0 deletionscoderd/workspaceapps.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ import (
// @Tags Applications
// @Success 200 {object} codersdk.AppHostResponse
// @Router /applications/host [get]
// @Deprecated use api/v2/regions and see the primary proxy.
func (api *API) appHost(rw http.ResponseWriter, r *http.Request) {
host := api.AppHostname
if host != "" && api.AccessURL.Port() != "" {
Expand Down
32 changes: 8 additions & 24 deletionssite/src/contexts/ProxyContext.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import { useQuery } from "@tanstack/react-query"
import {getApplicationsHost,getWorkspaceProxies } from "api/api"
import { getWorkspaceProxies } from "api/api"
import { Region } from "api/typesGenerated"
import { useDashboard } from "components/Dashboard/DashboardProvider"
import {
Expand DownExpand Up@@ -70,7 +70,6 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
onSuccess: (resp) => {
setAndSaveProxy(proxy.selectedProxy, resp.regions)
},
enabled: experimentEnabled,
})

const setAndSaveProxy = (
Expand All@@ -93,35 +92,20 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
setProxy(preferred)
}

// ******************************* //
// ** This code can be removed **
// ** when the experimental is **
// ** dropped ** //
const appHostQueryKey = ["get-application-host"]
const {
data: applicationHostResult,
error: appHostError,
isLoading: appHostLoading,
isFetched: appHostFetched,
} = useQuery({
queryKey: appHostQueryKey,
queryFn: getApplicationsHost,
enabled: !experimentEnabled,
})

return (
<ProxyContext.Provider
value={{
proxy: experimentEnabled
? proxy
: {
...getPreferredProxy([]),
preferredWildcardHostname: applicationHostResult?.host || "",
// If the experiment is disabled, then call 'getPreferredProxy' with the regions from
// the api call. The default behavior is to use the `primary` proxy.
...getPreferredProxy(proxiesResp?.regions || []),
},
proxies:experimentEnabled ?proxiesResp?.regions : [],
isLoading:experimentEnabled ?proxiesLoading : appHostLoading,
isFetched:experimentEnabled ?proxiesFetched : appHostFetched,
error:experimentEnabled ?proxiesError : appHostError,
proxies: proxiesResp?.regions,
isLoading: proxiesLoading,
isFetched: proxiesFetched,
error: proxiesError,
// A function that takes the new proxies and selected proxy and updates
// the state with the appropriate urls.
setProxy: setAndSaveProxy,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp