feat(ui): external services tab with Azure DevOps PAT, draft PR button and link in company repos
This commit is contained in:
@@ -40,6 +40,15 @@ public sealed partial class TicketSettingsTabViewModel : ViewModelBase
|
||||
// Never shows the stored token — TicketSettingsDto only ever carries the bool.
|
||||
public string TokenPlaceholder => TokenSet ? Loc.T("settings.tickets.tokenSet") : "";
|
||||
|
||||
/// <summary>Azure DevOps PAT being typed; never shows the stored one.</summary>
|
||||
[ObservableProperty] private string _azdoToken = "";
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(AzdoTokenPlaceholder))]
|
||||
private bool _azdoTokenSet;
|
||||
[ObservableProperty] private string _azdoStatusMessage = "";
|
||||
|
||||
public string AzdoTokenPlaceholder => AzdoTokenSet ? Loc.T("settings.tickets.tokenSet") : "";
|
||||
|
||||
public ObservableCollection<FallbackListOption> FallbackLists { get; } = new();
|
||||
[ObservableProperty] private FallbackListOption? _selectedFallbackList;
|
||||
|
||||
@@ -54,6 +63,7 @@ public sealed partial class TicketSettingsTabViewModel : ViewModelBase
|
||||
|
||||
public async Task LoadAsync()
|
||||
{
|
||||
AzdoTokenSet = (await _worker.GetAzureDevOpsSettingsAsync())?.TokenSet ?? false;
|
||||
var dto = await _worker.GetTicketSettingsAsync();
|
||||
if (dto is null)
|
||||
{
|
||||
@@ -86,6 +96,40 @@ public sealed partial class TicketSettingsTabViewModel : ViewModelBase
|
||||
}
|
||||
if (_fallbackLoaded)
|
||||
await _worker.SetTicketFallbackListAsync(SelectedFallbackList?.Id);
|
||||
if (!string.IsNullOrWhiteSpace(AzdoToken))
|
||||
{
|
||||
await _worker.SetAzureDevOpsTokenAsync(AzdoToken);
|
||||
AzdoToken = "";
|
||||
AzdoTokenSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task TestAzdoConnection()
|
||||
{
|
||||
IsBusy = true;
|
||||
AzdoStatusMessage = "";
|
||||
try
|
||||
{
|
||||
await SaveAsync();
|
||||
var result = await _worker.TestAzureDevOpsConnectionAsync();
|
||||
AzdoStatusMessage = result is { Ok: true }
|
||||
? Loc.T("vm.tickets.azdoConnectionOk", result.Repo!, result.DefaultBranch!)
|
||||
: result?.Error ?? Loc.T("vm.tickets.workerOffline");
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ClearAzdoToken()
|
||||
{
|
||||
await _worker.ClearAzureDevOpsTokenAsync();
|
||||
AzdoToken = "";
|
||||
AzdoTokenSet = false;
|
||||
AzdoStatusMessage = Loc.T("vm.tickets.tokenCleared");
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
||||
Reference in New Issue
Block a user