feat(connect): deregister account environments from any client #4844
main fromrefs/pull/4844/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
StiensWout(GitHub profile, opens in a new tab) changed the title
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx line 310OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -245,10 +300,11 @@245300 {savedConnection.buttonLabel}246301 </Button>247302 ) : (248- <Button249- size="sm"250- disabled={connectingEnvironmentId !== null}251- onClick={() => void connectEnvironment(environment)}252- >253- {connectingEnvironmentId === environment.environmentId ? "Connecting…" : "Connect"}254- </Button>303+ <div className="flex items-center gap-2">304+ <AlertDialog>305+ <AlertDialogTrigger306+ render={307+ <Button308+ size="sm"309+ variant="destructive-outline"310+ disabled={deregisteringEnvironmentId === environment.environmentId}apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx lines 148 to 149OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -127,3 +143,7 @@127143 });128144 };129145146+ const deregisterRelayEnvironment = async (environment: RelayClientEnvironmentRecord) => {147+ setDeregisteringEnvironmentId(environment.environmentId);148+ const result = await deregisterEnvironment({ environmentId: environment.environmentId });149+ setDeregisteringEnvironmentId(null);
- apps/web/src/components/settings/ConnectionsSettings.tsx line 1525OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -1473,0 +1505,21 @@1505+ This revokes this server’s T3 Connect access, removes its managed tunnel,1506+ and frees one of your three host spaces. Use this if you no longer have1507+ access to the server or do not want it registered to your account.1508+ </AlertDialogDescription>1509+ </AlertDialogHeader>1510+ <AlertDialogFooter>1511+ <AlertDialogClose render={<Button variant="outline">Cancel</Button>} />1512+ <AlertDialogClose1513+ render={1514+ <Button1515+ variant="destructive"1516+ onClick={() => void onDeregister(environmentId)}1517+ >1518+ Deregister server1519+ </Button>1520+ }1521+ />1522+ </AlertDialogFooter>1523+ </AlertDialogPopup>1524+ </AlertDialog>1525+ ) : null}
- apps/web/src/components/settings/ConnectionsSettings.tsx line 1491OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -1471,3 +1478,14 @@14711478 </Tooltip>14721479 ) : (14731480 <>1481+ {environment.relayManaged ? (1482+ <AlertDialog>1483+ <AlertDialogTrigger1484+ render={1485+ <Button1486+ size="xs"1487+ variant="destructive-outline"1488+ disabled={1489+ isConnecting ||1490+ deregisteringEnvironmentId !== null ||1491+ removingEnvironmentId !== null
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/mobile/src/features/connection/CloudEnvironmentRows.tsx line 367OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -238,0 +347,21 @@347+ onDeregister={props.onDeregister}348+ >349+ <CloudEnvironmentRowShell350+ borderTop={props.borderTop}351+ connectionError={presentation.connectionError}352+ connectionErrorTraceId={presentation.connectionErrorTraceId}353+ connectionState={presentation.connectionState}354+ disabled={props.deregisterDisabled}355+ errorExpanded={props.errorExpanded}356+ label={props.environment.environment.label}357+ onValueChange={(enabled) => {358+ if (enabled) {359+ props.onConnect();360+ }361+ }}362+ onToggleError={props.onToggleError}363+ statusText={presentation.statusText}364+ value={false}365+ />366+ </CloudEnvironmentSwipeRow>367+ );
StiensWout(GitHub profile, opens in a new tab) closed this
StiensWout(GitHub profile, opens in a new tab) reopened this
StiensWout(GitHub profile, opens in a new tab) changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- apps/mobile/src/features/settings/SettingsT3ConnectRouteScreen.tsx line 170OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -0,0 +150,21 @@150+ showsVerticalScrollIndicator={false}151+ className="flex-1"152+ contentContainerClassName="px-5 pt-4"153+ contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}154+ refreshControl={155+ environmentsState.accountId ? (156+ <RefreshControl157+ refreshing={environmentsState.isPending}158+ onRefresh={environmentsState.refresh}159+ />160+ ) : undefined161+ }162+ >163+ <View className="gap-1 pb-5">164+ <Text className="text-lg font-t3-bold text-foreground">Account environments</Text>165+ <Text className="text-sm leading-normal text-foreground-muted">166+ Servers registered to your account. Connections on this device stay in Environments.167+ </Text>168+ </View>169+170+ {environmentsState.error ? (
- apps/mobile/src/features/settings/SettingsT3ConnectRouteScreen.tsx line 180OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +160,21 @@160+ ) : undefined161+ }162+ >163+ <View className="gap-1 pb-5">164+ <Text className="text-lg font-t3-bold text-foreground">Account environments</Text>165+ <Text className="text-sm leading-normal text-foreground-muted">166+ Servers registered to your account. Connections on this device stay in Environments.167+ </Text>168+ </View>169+170+ {environmentsState.error ? (171+ <View className="border-y border-danger-border py-4">172+ <Text className="text-base font-t3-medium text-danger-foreground">173+ Could not load T3 Connect environments174+ </Text>175+ <Text className="mt-1 text-sm text-foreground-muted">{environmentsState.error}</Text>176+ </View>177+ ) : environmentsState.accountId === null ? (178+ <Text className="border-y border-border py-6 text-sm text-foreground-muted">179+ Sign in to T3 Connect to manage account environments.180+ </Text>apps/web/src/components/clerk/T3ConnectUserProfilePage.tsx line 197Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +144,21 @@144+ type: "error",145+ title: "Could not deregister server",146+ description: message,147+ data: traceId148+ ? {149+ secondaryActionProps: {150+ children: "Copy trace ID",151+ onClick: () => void navigator.clipboard?.writeText(traceId),152+ },153+ }154+ : undefined,155+ });156+ };157+158+ const removedEnvironmentIds =159+ removedEnvironments.accountId === environmentsState.accountId160+ ? removedEnvironments.ids161+ : new Set<EnvironmentId>();162+ const environments = (environmentsState.data ?? []).filter(163+ (environment) => !removedEnvironmentIds.has(environment.environmentId),164+ );
- apps/mobile/src/features/settings/SettingsT3ConnectRouteScreen.tsx line 41OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -0,0 +21,21 @@21+ useManagedRelayEnvironments,22+} from "../cloud/managedRelayState";23+import { useAtomCommand } from "../../state/use-atom-command";24+25+const linkedAtFormatter = new Intl.DateTimeFormat(undefined, { dateStyle: "medium" });26+27+function linkedAtLabel(value: string): string {28+ const linkedAt = new Date(value);29+ return Number.isNaN(linkedAt.getTime())30+ ? "Link date unavailable"31+ : `Linked ${linkedAtFormatter.format(linkedAt)}`;32+}33+34+function endpointLabel(environment: RelayClientEnvironmentRecord): string {35+ return environment.endpoint.providerKind === "cloudflare_tunnel"36+ ? "Managed tunnel"37+ : "Activity publishing only";38+}39+40+export function SettingsT3ConnectRouteScreen() {41+ const { isLoaded: isAuthLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
- apps/mobile/src/features/settings/SettingsT3ConnectRouteScreen.tsx line 47OutdatedResolvedby StiensWout(GitHub profile, opens in a new tab)@@ -0,0 +27,21 @@27+28+function linkedAtLabel(value: string): string {29+ const linkedAt = new Date(value);30+ return Number.isNaN(linkedAt.getTime())31+ ? "Link date unavailable"32+ : `Linked ${linkedAtFormatter.format(linkedAt)}`;33+}34+35+function endpointLabel(environment: RelayClientEnvironmentRecord): string {36+ return environment.endpoint.providerKind === "cloudflare_tunnel"37+ ? "Managed tunnel"38+ : "Activity publishing only";39+}40+41+export function SettingsT3ConnectRouteScreen() {42+ const navigation = useNavigation();43+44+ useLayoutEffect(() => {45+ if (!hasCloudPublicConfig()) {46+ navigation.dispatch(StackActions.replace("SettingsContent"));47+ }
juliusmarminge merged thisd0b8d63
juliusmarminge closed this
Sign in to join this conversation.




Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
5ee20843-a7f5-4622-8c81-661bd2ec64c8You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share