add commenting on issues
This commit is contained in:
@@ -390,21 +390,12 @@ namespace Blueberry.Redmine
|
||||
{
|
||||
issue = new
|
||||
{
|
||||
notes = comment
|
||||
}
|
||||
};
|
||||
var privatePayload = new
|
||||
{
|
||||
issue = new
|
||||
{
|
||||
private_notes = comment
|
||||
notes = comment,
|
||||
private_notes = isPrivate
|
||||
}
|
||||
};
|
||||
|
||||
if(isPrivate)
|
||||
await SendRequestAsync<object>(HttpMethod.Put, path, privatePayload, token: token);
|
||||
else
|
||||
await SendRequestAsync<object>(HttpMethod.Put, path, payload, token: token);
|
||||
await SendRequestAsync<object>(HttpMethod.Put, path, payload, token: token);
|
||||
}
|
||||
|
||||
public async Task<List<TimeOnIssue.TimeEntry>> GetTimeOnIssueAsync(int issueId, int limit = 25, IProgress<(int, int)>? progress = null, CancellationToken? token = null)
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
@@ -130,7 +131,14 @@
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="y" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Grid.Row="0" Height="4" Margin="0, 0, 0, 4" RadiusX="2" RadiusY="2" HorizontalAlignment="Stretch" Fill="{Binding NameColor}" />
|
||||
<ui:TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding User}" FontSize="10" Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}" FontWeight="Bold" />
|
||||
<Grid Grid.Row="1" Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Column="0" Text="{Binding User}" FontSize="10" Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}" FontWeight="Bold" />
|
||||
<ui:SymbolIcon Symbol="LockClosed24" Grid.Column="1" Visibility="{Binding LockVisibility}" Margin="5, 0, 0, 0" FontSize="12" Foreground="Orange" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
<ui:TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Date}" FontSize="10" Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}" />
|
||||
<ui:TextBlock Grid.Row="2" Grid.ColumnSpan="3" Text="{Binding Content}" Foreground="{Binding StatusColor}" TextWrapping="Wrap" FontSize="12" />
|
||||
</Grid>
|
||||
@@ -140,6 +148,23 @@
|
||||
</ui:ListView>
|
||||
</Grid>
|
||||
</ui:Card>
|
||||
<Grid Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBox Grid.RowSpan="2" Margin="10, 10, 5, 10" x:Name="commentTextBox" AcceptsReturn="True" MinLines="2" />
|
||||
<ui:Button Grid.Column="1" Content="Küldés" Margin="5, 10, 10, 5" x:Name="commentButton" Click="commentButton_Click">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Send24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:ToggleSwitch x:Name="privateToggle" Grid.Row="1" Grid.Column="1" OnContent="Privát" OffContent="Privát" Margin="5, 5, 10, 10" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Blueberry.Redmine.Dto;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Windows.Networking.NetworkOperators;
|
||||
@@ -14,7 +15,7 @@ namespace Blueberry
|
||||
/// </summary>
|
||||
public partial class IssueWindow : FluentWindow
|
||||
{
|
||||
private readonly DetailedIssue.Issue _issue;
|
||||
private DetailedIssue.Issue _issue;
|
||||
private readonly RedmineManager _manager;
|
||||
private readonly RedmineConfig _config;
|
||||
private readonly List<JournalDisplay> _journalDisplays = [];
|
||||
@@ -38,15 +39,27 @@ namespace Blueberry
|
||||
iCreatedTextBox.Text = _issue.CreatedOn.ToString("yyyy-MM-dd");
|
||||
iUpdatedTextBox.Text = _issue.UpdatedOn.ToString("yyyy-MM-dd");
|
||||
iSpentTimeTextBox.Text = _issue.SpentHours.ToString();
|
||||
await DownloadJournals();
|
||||
}
|
||||
|
||||
private async Task DownloadJournals()
|
||||
{
|
||||
Journals.Clear();
|
||||
journalProgressRing.Visibility = Visibility.Visible;
|
||||
|
||||
List<TimeOnIssue.TimeEntry> hours = [];
|
||||
try
|
||||
{
|
||||
var id = _issue.Id;
|
||||
var newIssue = await _manager.GetIssueAsync(id);
|
||||
if(newIssue != null)
|
||||
_issue = newIssue;
|
||||
hours = await _manager.GetTimeOnIssue(_issue.Id, progress: UpdateProgress(), token: _tokenSource.Token);
|
||||
} catch { }
|
||||
}
|
||||
catch { }
|
||||
_journalDisplays.Clear();
|
||||
_journalDisplays.AddRange(await ProcessJournal(_issue.Journals, hours));
|
||||
if(!_journalDisplays.Any(x=>!x.IsData))
|
||||
if (!_journalDisplays.Any(x => !x.IsData))
|
||||
detailsToggleSwitch.IsChecked = true;
|
||||
await LoadJournal();
|
||||
journalProgressRing.Visibility = Visibility.Hidden;
|
||||
@@ -98,6 +111,19 @@ namespace Blueberry
|
||||
{
|
||||
_tokenSource.Cancel();
|
||||
}
|
||||
|
||||
private async void commentButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var comment = commentTextBox.Text;
|
||||
if (string.IsNullOrWhiteSpace(comment))
|
||||
return;
|
||||
|
||||
var isPrivate = privateToggle.IsChecked ?? false;
|
||||
|
||||
await _manager.AddComment(_issue.Id, comment, isPrivate);
|
||||
commentTextBox.Text = "";
|
||||
await DownloadJournals();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class IssueWindow
|
||||
@@ -252,6 +278,7 @@ namespace Blueberry
|
||||
return Application.Current.TryFindResource(resourceKey) as Brush;
|
||||
}
|
||||
}
|
||||
public Visibility LockVisibility => IsPrivate ? Visibility.Visible : Visibility.Hidden;
|
||||
|
||||
public SolidColorBrush NameColor => StringToColorConverter.GetColorFromName(User);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user