feat: move moons experiment to ga (released) (#11285)

* feat: release moons experiment as ga
This commit is contained in:
Steven Masley
2023-12-19 14:40:22 -06:00
committed by GitHub
parent e8be092af0
commit fbda21a9f2
20 changed files with 57 additions and 205 deletions
-2
View File
@@ -1778,14 +1778,12 @@ export const Entitlements: Entitlement[] = [
// From codersdk/deployment.go
export type Experiment =
| "deployment_health_page"
| "moons"
| "single_tailnet"
| "tailnet_pg_coordinator"
| "template_update_policies"
| "workspace_actions";
export const Experiments: Experiment[] = [
"deployment_health_page",
"moons",
"single_tailnet",
"tailnet_pg_coordinator",
"template_update_policies",
@@ -34,9 +34,7 @@ export const Navbar: FC = () => {
canViewDeployment={canViewDeployment}
canViewAllUsers={canViewAllUsers}
canViewHealth={canViewHealth}
proxyContextValue={
dashboard.experiments.includes("moons") ? proxyContextValue : undefined
}
proxyContextValue={proxyContextValue}
/>
);
};
@@ -38,11 +38,9 @@ export const Sidebar: FC = () => {
<SidebarNavItem href="network" icon={Globe}>
Network
</SidebarNavItem>
{dashboard.experiments.includes("moons") && (
<SidebarNavItem href="workspace-proxies" icon={HubOutlinedIcon}>
Workspace Proxies
</SidebarNavItem>
)}
<SidebarNavItem href="workspace-proxies" icon={HubOutlinedIcon}>
Workspace Proxies
</SidebarNavItem>
<SidebarNavItem href="security" icon={LockRounded}>
Security
</SidebarNavItem>
@@ -94,13 +94,12 @@ describe("optionValue", () => {
option: {
...defaultOption,
name: "Experiments",
value: ["moons"],
value: [],
},
additionalValues: ["single_tailnet", "deployment_health_page"],
expected: {
single_tailnet: false,
deployment_health_page: false,
moons: true,
},
},
{
@@ -116,10 +115,10 @@ describe("optionValue", () => {
option: {
...defaultOption,
name: "Experiments",
value: ["*", "moons", "single_tailnet"],
value: ["*", "single_tailnet"],
},
additionalValues: ["single_tailnet"],
expected: { moons: true, single_tailnet: true },
expected: { single_tailnet: true },
},
{
option: {
+1 -11
View File
@@ -1,7 +1,6 @@
import { useQuery } from "react-query";
import { getWorkspaceProxies, getWorkspaceProxyRegions } from "api/api";
import { Region, WorkspaceProxy } from "api/typesGenerated";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import {
createContext,
FC,
@@ -85,9 +84,6 @@ export const ProxyContext = createContext<ProxyContextValue | undefined>(
* ProxyProvider interacts with local storage to indicate the preferred workspace proxy.
*/
export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
const dashboard = useDashboard();
const experimentEnabled = dashboard?.experiments.includes("moons");
// Using a useState so the caller always has the latest user saved
// proxy.
const [userSavedProxy, setUserSavedProxy] = useState(loadUserSelectedProxy());
@@ -176,13 +172,7 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
proxyLatencies,
refetchProxyLatencies,
userProxy: userSavedProxy,
proxy: experimentEnabled
? proxy
: {
// 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 || []),
},
proxy: proxy,
proxies: proxiesResp,
isLoading: proxiesLoading,
isFetched: proxiesFetched,
+1 -5
View File
@@ -17,11 +17,9 @@ import { Suspense } from "react";
import { HealthIcon } from "./Content";
import { HealthSeverity } from "api/typesGenerated";
import NotificationsOffOutlined from "@mui/icons-material/NotificationsOffOutlined";
import { useDashboard } from "components/Dashboard/DashboardProvider";
export function HealthLayout() {
const theme = useTheme();
const dashboard = useDashboard();
const queryClient = useQueryClient();
const { data: healthStatus } = useQuery({
...health(),
@@ -35,9 +33,7 @@ export function HealthLayout() {
access_url: "Access URL",
websocket: "Websocket",
database: "Database",
workspace_proxy: dashboard.experiments.includes("moons")
? "Workspace Proxy"
: undefined,
workspace_proxy: "Workspace Proxy",
} as const;
const visibleSections = filterVisibleSections(sections);
+3 -7
View File
@@ -13,7 +13,6 @@ import "xterm/css/xterm.css";
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
import { pageTitle } from "utils/page";
import { useProxy } from "contexts/ProxyContext";
import { useDashboard } from "components/Dashboard/DashboardProvider";
import type { Region } from "api/typesGenerated";
import { getLatencyColor } from "utils/latency";
import { ProxyStatusLatency } from "components/ProxyStatusLatency/ProxyStatusLatency";
@@ -67,7 +66,6 @@ const TerminalPage: FC = () => {
const workspaceAgent = workspace.data
? getMatchingAgentOrFirst(workspace.data, workspaceNameParts?.[1])
: undefined;
const dashboard = useDashboard();
const selectedProxy = proxy.proxy;
const latency = selectedProxy ? proxyLatencies[selectedProxy.id] : undefined;
@@ -312,11 +310,9 @@ const TerminalPage: FC = () => {
prevLifecycleState.current === "starting" && <LoadedScriptsAlert />}
{terminalState === "disconnected" && <DisconnectedAlert />}
<div css={styles.terminal} ref={xtermRef} data-testid="terminal" />
{dashboard.experiments.includes("moons") &&
selectedProxy &&
latency && (
<BottomBar proxy={selectedProxy} latency={latency.latencyMS} />
)}
{selectedProxy && latency && (
<BottomBar proxy={selectedProxy} latency={latency.latencyMS} />
)}
</div>
</>
);
+3 -1
View File
@@ -2045,7 +2045,9 @@ export const MockEntitlementsWithUserLimit: TypesGen.Entitlements = {
}),
};
export const MockExperiments: TypesGen.Experiment[] = ["moons"];
export const MockExperiments: TypesGen.Experiment[] = [
"tailnet_pg_coordinator",
];
export const MockAuditLog: TypesGen.AuditLog = {
id: "fbd2116a-8961-4954-87ae-e4575bd29ce0",