Compare commits
6 Commits
d15e01f253
...
0.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b6df0c508 | |||
| ec077240a4 | |||
| 56fd7a6da7 | |||
| db063e61b1 | |||
| a86ad23774 | |||
| b68c43af38 |
@@ -390,21 +390,12 @@ namespace Blueberry.Redmine
|
|||||||
{
|
{
|
||||||
issue = new
|
issue = new
|
||||||
{
|
{
|
||||||
notes = comment
|
notes = comment,
|
||||||
}
|
private_notes = isPrivate
|
||||||
};
|
|
||||||
var privatePayload = new
|
|
||||||
{
|
|
||||||
issue = new
|
|
||||||
{
|
|
||||||
private_notes = comment
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(isPrivate)
|
await SendRequestAsync<object>(HttpMethod.Put, path, payload, token: token);
|
||||||
await SendRequestAsync<object>(HttpMethod.Put, path, privatePayload, token: token);
|
|
||||||
else
|
|
||||||
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)
|
public async Task<List<TimeOnIssue.TimeEntry>> GetTimeOnIssueAsync(int issueId, int limit = 25, IProgress<(int, int)>? progress = null, CancellationToken? token = null)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
|
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using Blueberry.Redmine.Dto;
|
using Blueberry.Redmine.Dto;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Wpf.Ui.Controls;
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
@@ -28,11 +27,15 @@ namespace Blueberry
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void FluentWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
private async void FluentWindow_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var u = await _manager.GetUsersAsync();
|
userComboBox.IsEnabled =
|
||||||
|
searchButton.IsEnabled =
|
||||||
|
dateButton.IsEnabled = false;
|
||||||
|
var u = await _manager.GetUsersAsync(progress: UpdateProgress());
|
||||||
var current = await _manager.GetCurrentUserAsync();
|
var current = await _manager.GetCurrentUserAsync();
|
||||||
hoursProgress.Visibility = Visibility.Hidden;
|
hoursProgress.Visibility = Visibility.Hidden;
|
||||||
|
hoursProgress.IsIndeterminate = true;
|
||||||
_users.Clear();
|
_users.Clear();
|
||||||
_users.AddRange(u);
|
_users.AddRange(u);
|
||||||
userComboBox.Items.Clear();
|
userComboBox.Items.Clear();
|
||||||
@@ -40,14 +43,63 @@ namespace Blueberry
|
|||||||
userComboBox.Items.Add(user);
|
userComboBox.Items.Add(user);
|
||||||
|
|
||||||
userComboBox.SelectedItem = current;
|
userComboBox.SelectedItem = current;
|
||||||
|
userComboBox.IsEnabled =
|
||||||
|
searchButton.IsEnabled =
|
||||||
|
dateButton.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dateButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
private IProgress<(int, int)> UpdateProgress()
|
||||||
|
{
|
||||||
|
var p = new Progress<(int current, int total)>((x) =>
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
hoursProgress.IsIndeterminate = false;
|
||||||
|
var percent = (int)((double)x.current / x.total * 100);
|
||||||
|
hoursProgress.Progress = percent;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dateButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
calendarFlyout.IsOpen = true;
|
calendarFlyout.IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void searchButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void UpdateProgressI()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
var percent = (int)((double)loadI / totalI * 100);
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
hoursProgress.Progress = percent;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private int loadInternalI = 0;
|
||||||
|
private object _lock = new();
|
||||||
|
private int loadI { get
|
||||||
|
{
|
||||||
|
var result = 0;
|
||||||
|
lock(_lock)
|
||||||
|
{
|
||||||
|
result = loadInternalI;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
loadInternalI = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int totalI = 0;
|
||||||
|
private async void searchButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var user = userComboBox.SelectedItem as UserInfo.User;
|
var user = userComboBox.SelectedItem as UserInfo.User;
|
||||||
if(user is null)
|
if(user is null)
|
||||||
@@ -64,6 +116,8 @@ namespace Blueberry
|
|||||||
|
|
||||||
for (int i = 0; i < selectedDates.Count; i++)
|
for (int i = 0; i < selectedDates.Count; i++)
|
||||||
{
|
{
|
||||||
|
hoursProgress.IsIndeterminate = false;
|
||||||
|
totalI = selectedDates.Count;
|
||||||
var date = selectedDates[i];
|
var date = selectedDates[i];
|
||||||
tasks[i] = Task.Run(async () =>
|
tasks[i] = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
@@ -83,12 +137,16 @@ namespace Blueberry
|
|||||||
};
|
};
|
||||||
hours.Add(dh);
|
hours.Add(dh);
|
||||||
}
|
}
|
||||||
|
loadI++;
|
||||||
|
UpdateProgressI();
|
||||||
});
|
});
|
||||||
await Task.Delay(10);
|
await Task.Delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
|
|
||||||
|
hoursProgress.IsIndeterminate = true;
|
||||||
|
|
||||||
var newTickets = await _manager.GetIssuesAsync(user.Id, createdFrom: selectedDates.First(), createdTo: selectedDates.Last());
|
var newTickets = await _manager.GetIssuesAsync(user.Id, createdFrom: selectedDates.First(), createdTo: selectedDates.Last());
|
||||||
var closedTickets = await _manager.GetIssuesAsync(user.Id, isOpen: false, updatedFrom: selectedDates.First(), updatedTo: selectedDates.Last());
|
var closedTickets = await _manager.GetIssuesAsync(user.Id, isOpen: false, updatedFrom: selectedDates.First(), updatedTo: selectedDates.Last());
|
||||||
var currentTickets = await _manager.GetUserOpenIssuesAsync(user.Id);
|
var currentTickets = await _manager.GetUserOpenIssuesAsync(user.Id);
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="1*" />
|
<RowDefinition Height="1*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="1*" />
|
<ColumnDefinition Width="1*" />
|
||||||
@@ -130,7 +131,14 @@
|
|||||||
<ColumnDefinition Width="Auto" SharedSizeGroup="y" />
|
<ColumnDefinition Width="Auto" SharedSizeGroup="y" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Rectangle Grid.Row="0" Height="4" Margin="0, 0, 0, 4" RadiusX="2" RadiusY="2" HorizontalAlignment="Stretch" Fill="{Binding NameColor}" />
|
<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="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" />
|
<ui:TextBlock Grid.Row="2" Grid.ColumnSpan="3" Text="{Binding Content}" Foreground="{Binding StatusColor}" TextWrapping="Wrap" FontSize="12" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -140,6 +148,23 @@
|
|||||||
</ui:ListView>
|
</ui:ListView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:Card>
|
</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>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:FluentWindow>
|
</ui:FluentWindow>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Blueberry.Redmine.Dto;
|
using Blueberry.Redmine.Dto;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Windows.Networking.NetworkOperators;
|
using Windows.Networking.NetworkOperators;
|
||||||
@@ -14,7 +15,7 @@ namespace Blueberry
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class IssueWindow : FluentWindow
|
public partial class IssueWindow : FluentWindow
|
||||||
{
|
{
|
||||||
private readonly DetailedIssue.Issue _issue;
|
private DetailedIssue.Issue _issue;
|
||||||
private readonly RedmineManager _manager;
|
private readonly RedmineManager _manager;
|
||||||
private readonly RedmineConfig _config;
|
private readonly RedmineConfig _config;
|
||||||
private readonly List<JournalDisplay> _journalDisplays = [];
|
private readonly List<JournalDisplay> _journalDisplays = [];
|
||||||
@@ -38,15 +39,27 @@ namespace Blueberry
|
|||||||
iCreatedTextBox.Text = _issue.CreatedOn.ToString("yyyy-MM-dd");
|
iCreatedTextBox.Text = _issue.CreatedOn.ToString("yyyy-MM-dd");
|
||||||
iUpdatedTextBox.Text = _issue.UpdatedOn.ToString("yyyy-MM-dd");
|
iUpdatedTextBox.Text = _issue.UpdatedOn.ToString("yyyy-MM-dd");
|
||||||
iSpentTimeTextBox.Text = _issue.SpentHours.ToString();
|
iSpentTimeTextBox.Text = _issue.SpentHours.ToString();
|
||||||
|
await DownloadJournals();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DownloadJournals()
|
||||||
|
{
|
||||||
|
Journals.Clear();
|
||||||
journalProgressRing.Visibility = Visibility.Visible;
|
journalProgressRing.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
List<TimeOnIssue.TimeEntry> hours = [];
|
List<TimeOnIssue.TimeEntry> hours = [];
|
||||||
try
|
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);
|
hours = await _manager.GetTimeOnIssue(_issue.Id, progress: UpdateProgress(), token: _tokenSource.Token);
|
||||||
} catch { }
|
}
|
||||||
|
catch { }
|
||||||
|
_journalDisplays.Clear();
|
||||||
_journalDisplays.AddRange(await ProcessJournal(_issue.Journals, hours));
|
_journalDisplays.AddRange(await ProcessJournal(_issue.Journals, hours));
|
||||||
if(!_journalDisplays.Any(x=>!x.IsData))
|
if (!_journalDisplays.Any(x => !x.IsData))
|
||||||
detailsToggleSwitch.IsChecked = true;
|
detailsToggleSwitch.IsChecked = true;
|
||||||
await LoadJournal();
|
await LoadJournal();
|
||||||
journalProgressRing.Visibility = Visibility.Hidden;
|
journalProgressRing.Visibility = Visibility.Hidden;
|
||||||
@@ -98,6 +111,19 @@ namespace Blueberry
|
|||||||
{
|
{
|
||||||
_tokenSource.Cancel();
|
_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
|
public partial class IssueWindow
|
||||||
@@ -252,6 +278,7 @@ namespace Blueberry
|
|||||||
return Application.Current.TryFindResource(resourceKey) as Brush;
|
return Application.Current.TryFindResource(resourceKey) as Brush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Visibility LockVisibility => IsPrivate ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
|
||||||
public SolidColorBrush NameColor => StringToColorConverter.GetColorFromName(User);
|
public SolidColorBrush NameColor => StringToColorConverter.GetColorFromName(User);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ui:Button x:Name="updateButton" Content="Frissítés" Grid.Column="1" Margin="2" Visibility="Hidden" Click="updateButton_Click" />
|
<ui:Button x:Name="updateButton" Content="Frissítés" FontSize="8" Grid.Column="1" Margin="2" Visibility="Hidden" Click="updateButton_Click" />
|
||||||
<ui:TextBlock x:Name="versionTextBlock" Grid.Column="2" HorizontalAlignment="Right" FontSize="8" Text="0.0.0" Margin="10" />
|
<ui:TextBlock x:Name="versionTextBlock" Grid.Column="2" HorizontalAlignment="Right" FontSize="8" Text="0.0.0" Margin="10" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Blueberry
|
|||||||
public static class UpdateManager
|
public static class UpdateManager
|
||||||
{
|
{
|
||||||
private const string releaseUrl = "https://git.technopunk.space/api/v1/repos/tomi/Blueberry/releases/latest";
|
private const string releaseUrl = "https://git.technopunk.space/api/v1/repos/tomi/Blueberry/releases/latest";
|
||||||
public const string CurrentVersion = "0.1.8";
|
public const string CurrentVersion = "0.2.2";
|
||||||
private static readonly string appDir = AppDomain.CurrentDomain.BaseDirectory;
|
private static readonly string appDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
private static readonly string zipPath = Path.Combine(appDir, "blueberry_update.zip");
|
private static readonly string zipPath = Path.Combine(appDir, "blueberry_update.zip");
|
||||||
private static readonly HttpClient client = new();
|
private static readonly HttpClient client = new();
|
||||||
|
|||||||
Reference in New Issue
Block a user