Setup history window, fixed a small bug in the yaml and loaded history entries

This commit is contained in:
Daniel Schick 2024-03-28 18:09:57 +01:00
parent 54a5b4bb50
commit e845c919fd
8 changed files with 1538 additions and 28 deletions

File diff suppressed because it is too large Load Diff

View File

@ -435,6 +435,13 @@ paths:
tags:
- static
operationId: historyGet
parameters:
- name: shipcall_id
in: query
required: true
description: '**Id of ship call**. *Example: 52*. Id given in ship call list'
schema:
$ref: '#/components/schemas/shipcallId'
responses:
'200':
description: list of history entries

View File

@ -0,0 +1,21 @@
<Window x:Class="BreCalClient.HistoryDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textChangeHistory}" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="2">
<StackPanel x:Name="stackPanel"/>
</ScrollViewer>
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="1" HorizontalAlignment="Right" />
</Grid>
</Window>

View File

@ -0,0 +1,76 @@
// Copyright (c) 2023 schick Informatik
// Description:
//
using BreCalClient.misc.Api;
using BreCalClient.misc.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for HistoryDialog.xaml
/// </summary>
public partial class HistoryDialog : Window
{
#region Fields
private readonly ConcurrentDictionary<int, ShipcallControlModel> _shipcalls;
private readonly StaticApi _staticApi;
#endregion
#region Construction
public HistoryDialog(ConcurrentDictionary<int, ShipcallControlModel> shipcalls, StaticApi staticApi)
{
InitializeComponent();
_shipcalls = shipcalls;
_staticApi = staticApi;
}
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
RefreshHistory();
}
private void buttonClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
#endregion
#region private methods
private async void RefreshHistory()
{
foreach (int shipcall_id in _shipcalls.Keys)
{
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
System.Diagnostics.Trace.WriteLine($"{shipcallHistory.Count} history elements loaded for shipcall {shipcall_id}");
}
}
#endregion
}
}

View File

@ -32,7 +32,6 @@ namespace BreCalClient
public partial class MainWindow : Window
{
private readonly ILog _log = LogManager.GetLogger(typeof(MainWindow));
private const int SHIPCALL_UPDATE_INTERVAL_SECONDS = 30;
private const int PROGRESS_STEPS = 50;
@ -50,7 +49,7 @@ namespace BreCalClient
private readonly UserApi _userApi;
private readonly TimesApi _timesApi;
private readonly StaticApi _staticApi;
private readonly ShipApi _shipApi;
private readonly ShipApi _shipApi;
private CancellationTokenSource _tokenSource = new();
private LoginResult? _loginResult;
@ -62,6 +61,7 @@ namespace BreCalClient
// private bool _filterChanged = false;
// private bool _sequenceChanged = false;
private HistoryDialog? _historyDialog;
#endregion
@ -353,7 +353,16 @@ namespace BreCalClient
private void buttonHistory_Click(object sender, RoutedEventArgs e)
{
if(_historyDialog == null)
{
_historyDialog = new HistoryDialog(_allShipcallsDict, _staticApi);
_historyDialog.Closed += (sender, e) => { this._historyDialog = null; };
_historyDialog.Show();
}
else
{
_historyDialog.Activate();
}
}
#endregion

View File

@ -384,6 +384,15 @@ namespace BreCalClient.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Change history.
/// </summary>
public static string textChangeHistory {
get {
return ResourceManager.GetString("textChangeHistory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Change password.
/// </summary>

View File

@ -448,6 +448,9 @@
<data name="textTugCompany" xml:space="preserve">
<value>Schlepper-Reederei</value>
</data>
<data name="textChangeHistory" xml:space="preserve">
<value>Verlauf</value>
</data>
<data name="textInfoChangePW" xml:space="preserve">
<value>App Info anzeigen und Passwort ändern</value>
</data>

View File

@ -220,6 +220,9 @@
<data name="textChangeContactInfo" xml:space="preserve">
<value>Update contact info</value>
</data>
<data name="textChangeHistory" xml:space="preserve">
<value>Change history</value>
</data>
<data name="textChangePassword" xml:space="preserve">
<value>Change password</value>
</data>