Skip to content

Commit 0383611

Browse files
brunobergherdaniel-lxs
authored andcommitted
Shows a pill with the base Roo Code Cloud URL when not pointing to production
1 parent ae8a639 commit 0383611

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

webview-ui/src/components/cloud/CloudView.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ export const CloudView = ({ userInfo, isAuthenticated, cloudApiUrl, onDone }: Cl
186186
</div>
187187
</>
188188
)}
189+
{cloudApiUrl && cloudApiUrl !== "https://app.roocode.com" && (
190+
<div className="mt-6 flex justify-center">
191+
<div className="inline-flex items-center px-3 py-1 gap-1 rounded-full bg-vscode-badge-background/50 text-vscode-badge-foreground text-xs">
192+
<span className="text-vscode-foreground/75">Roo Code Cloud URL: </span>
193+
<a href="{cloudApiUrl}">{cloudApiUrl}</a>
194+
</div>
195+
</div>
196+
)}
189197
</div>
190198
)
191199
}

webview-ui/src/components/cloud/__tests__/CloudView.spec.tsx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,68 @@ describe("CloudView", () => {
148148
expect(screen.queryByTestId("remote-control-toggle")).not.toBeInTheDocument()
149149
expect(screen.queryByText("Roomote Control")).not.toBeInTheDocument()
150150
})
151+
152+
it("should not display cloud URL pill when pointing to production", () => {
153+
const mockUserInfo = {
154+
name: "Test User",
155+
156+
}
157+
158+
render(
159+
<AccountView
160+
userInfo={mockUserInfo}
161+
isAuthenticated={true}
162+
cloudApiUrl="https://app.roocode.com"
163+
onDone={() => {}}
164+
/>,
165+
)
166+
167+
// Check that the cloud URL pill is NOT displayed for production URL
168+
expect(screen.queryByText(/Roo Code Cloud URL:/)).not.toBeInTheDocument()
169+
})
170+
171+
it("should display cloud URL pill when pointing to non-production environment", () => {
172+
const mockUserInfo = {
173+
name: "Test User",
174+
175+
}
176+
177+
render(
178+
<AccountView
179+
userInfo={mockUserInfo}
180+
isAuthenticated={true}
181+
cloudApiUrl="https://staging.roocode.com"
182+
onDone={() => {}}
183+
/>,
184+
)
185+
186+
// Check that the cloud URL pill is displayed with the staging URL
187+
expect(screen.getByText("Roo Code Cloud URL: https://staging.roocode.com")).toBeInTheDocument()
188+
})
189+
190+
it("should display cloud URL pill for non-authenticated users when not pointing to production", () => {
191+
render(
192+
<AccountView
193+
userInfo={null}
194+
isAuthenticated={false}
195+
cloudApiUrl="https://dev.roocode.com"
196+
onDone={() => {}}
197+
/>,
198+
)
199+
200+
// Check that the cloud URL pill is displayed even when not authenticated
201+
expect(screen.getByText("Roo Code Cloud URL: https://dev.roocode.com")).toBeInTheDocument()
202+
})
203+
204+
it("should not display cloud URL pill when cloudApiUrl is undefined", () => {
205+
const mockUserInfo = {
206+
name: "Test User",
207+
208+
}
209+
210+
render(<AccountView userInfo={mockUserInfo} isAuthenticated={true} onDone={() => {}} />)
211+
212+
// Check that the cloud URL pill is NOT displayed when cloudApiUrl is undefined
213+
expect(screen.queryByText(/Roo Code Cloud URL:/)).not.toBeInTheDocument()
214+
})
151215
})

0 commit comments

Comments
 (0)