Skip to content

Commit 8909dac

Browse files
authored
fix(ui): disable Capella connection option until supported (#330)
1 parent 4aa9392 commit 8909dac

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/CodingWithCalvin.CouchbaseExplorer/Dialogs/ConnectionDialog.xaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,17 @@
326326
<RadioButton Content="Couchbase Server"
327327
IsChecked="{Binding IsCouchbaseServer}"
328328
Margin="0,0,0,8" />
329-
<RadioButton Content="Couchbase Capella"
330-
IsChecked="{Binding IsCouchbaseCapella}" />
329+
<StackPanel Orientation="Horizontal">
330+
<RadioButton Content="Couchbase Capella"
331+
IsChecked="{Binding IsCouchbaseCapella}"
332+
IsEnabled="False" />
333+
<TextBlock Text="Coming Soon!"
334+
FontSize="11"
335+
FontStyle="Italic"
336+
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.GrayTextKey}}"
337+
VerticalAlignment="Center"
338+
Margin="8,0,0,0" />
339+
</StackPanel>
331340
</StackPanel>
332341
</GroupBox>
333342

src/CodingWithCalvin.CouchbaseExplorer/ViewModels/ConnectionDialogViewModel.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,26 +240,28 @@ public ConnectionDialogViewModel(HashSet<string> existingConnectionNames = null,
240240
_useSsl = existingConnection.UseSsl;
241241

242242
_password = CredentialManagerService.GetPassword(existingConnection.Id);
243-
244-
// Detect if it's Capella based on URL
245-
if (!string.IsNullOrEmpty(_host) && _host.Contains(".cloud.couchbase.com"))
246-
{
247-
_isCouchbaseCapella = true;
248-
_isCouchbaseServer = false;
249-
}
250243
}
251244

252245
TestConnectionCommand = new RelayCommand(async _ => await TestConnectionAsync(), CanTestConnection);
253246
SaveCommand = new RelayCommand(_ => Save(), _ => CanSave());
254247
CancelCommand = new RelayCommand(_ => Cancel());
255248
}
256249

257-
private void DetectCapellaUrl()
250+
private bool IsCapellaUrl(string host)
258251
{
259-
if (!string.IsNullOrEmpty(Host) && Host.Contains(".cloud.couchbase.com"))
252+
if (string.IsNullOrEmpty(host))
260253
{
261-
IsCouchbaseCapella = true;
254+
return false;
262255
}
256+
257+
return host.Contains(".cloud.couchbase.com") ||
258+
host.StartsWith("couchbases://", StringComparison.OrdinalIgnoreCase);
259+
}
260+
261+
private void DetectCapellaUrl()
262+
{
263+
// Re-validate host when URL changes to show Capella error if needed
264+
ValidateHost();
263265
}
264266

265267
private void ValidateConnectionName()
@@ -285,6 +287,10 @@ private void ValidateHost()
285287
{
286288
HostError = "Host is required";
287289
}
290+
else if (IsCapellaUrl(Host))
291+
{
292+
HostError = "Couchbase Capella connections are not supported yet";
293+
}
288294
else
289295
{
290296
HostError = null;

0 commit comments

Comments
 (0)