Compare commits

...

2 Commits

Author SHA1 Message Date
e98e52bb9e Logical delete of berths and ships in RoleEditor.
The deleted rows will still be shown however a little grayed out
2023-12-20 08:10:33 +01:00
4961641fa2 Changed labels for test version 2023-12-20 07:34:07 +01:00
15 changed files with 62 additions and 29 deletions

View File

@ -3582,7 +3582,7 @@ namespace BreCalClient.misc.Client
{ {
Proxy = null; Proxy = null;
UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp");
BasePath = "https://brecaldevel.bsmd-emswe.eu"; BasePath = "https://brecaltest.bsmd-emswe.eu";
DefaultHeaders = new ConcurrentDictionary<string, string>(); DefaultHeaders = new ConcurrentDictionary<string, string>();
ApiKey = new ConcurrentDictionary<string, string>(); ApiKey = new ConcurrentDictionary<string, string>();
ApiKeyPrefix = new ConcurrentDictionary<string, string>(); ApiKeyPrefix = new ConcurrentDictionary<string, string>();
@ -3590,7 +3590,7 @@ namespace BreCalClient.misc.Client
{ {
{ {
new Dictionary<string, object> { new Dictionary<string, object> {
{"url", "https://brecaldevel.bsmd-emswe.eu"}, {"url", "https://brecaltest.bsmd-emswe.eu"},
{"description", "Test server hosted on vcup"}, {"description", "Test server hosted on vcup"},
} }
} }
@ -3609,7 +3609,7 @@ namespace BreCalClient.misc.Client
IDictionary<string, string> defaultHeaders, IDictionary<string, string> defaultHeaders,
IDictionary<string, string> apiKey, IDictionary<string, string> apiKey,
IDictionary<string, string> apiKeyPrefix, IDictionary<string, string> apiKeyPrefix,
string basePath = "https://brecaldevel.bsmd-emswe.eu") : this() string basePath = "https://brecaltest.bsmd-emswe.eu") : this()
{ {
if (string.IsNullOrWhiteSpace(basePath)) if (string.IsNullOrWhiteSpace(basePath))
throw new ArgumentException("The provided basePath is invalid.", "basePath"); throw new ArgumentException("The provided basePath is invalid.", "basePath");

View File

@ -11,10 +11,10 @@
<applicationSettings> <applicationSettings>
<BreCalClient.Properties.Settings> <BreCalClient.Properties.Settings>
<setting name="API_URL" serializeAs="String"> <setting name="API_URL" serializeAs="String">
<value>https://brecaldevel.bsmd-emswe.eu</value> <value>https://brecaltest.bsmd-emswe.eu</value>
</setting> </setting>
<setting name="BG_COLOR" serializeAs="String"> <setting name="BG_COLOR" serializeAs="String">
<value>#1D751F</value> <value>#751D1F</value>
</setting> </setting>
<setting name="APP_TITLE" serializeAs="String"> <setting name="APP_TITLE" serializeAs="String">
<value>!!Bremen calling Testversion!!</value> <value>!!Bremen calling Testversion!!</value>

View File

@ -13,7 +13,7 @@
<Title>Bremen calling client</Title> <Title>Bremen calling client</Title>
<Description>A Windows WPF client for the Bremen calling API.</Description> <Description>A Windows WPF client for the Bremen calling API.</Description>
<ApplicationIcon>containership.ico</ApplicationIcon> <ApplicationIcon>containership.ico</ApplicationIcon>
<AssemblyName>BreCalDevelClient</AssemblyName> <AssemblyName>BreCalTestClient</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -34,7 +34,7 @@ namespace BreCalClient.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#1D751F")] [global::System.Configuration.DefaultSettingValueAttribute("#751D1F")]
public string BG_COLOR { public string BG_COLOR {
get { get {
return ((string)(this["BG_COLOR"])); return ((string)(this["BG_COLOR"]));

View File

@ -6,7 +6,7 @@
<Value Profile="(Default)">https://brecal.bsmd-emswe.eu</Value> <Value Profile="(Default)">https://brecal.bsmd-emswe.eu</Value>
</Setting> </Setting>
<Setting Name="BG_COLOR" Type="System.String" Scope="Application"> <Setting Name="BG_COLOR" Type="System.String" Scope="Application">
<Value Profile="(Default)">#1D751F</Value> <Value Profile="(Default)">#751D1F</Value>
</Setting> </Setting>
<Setting Name="APP_TITLE" Type="System.String" Scope="Application"> <Setting Name="APP_TITLE" Type="System.String" Scope="Application">
<Value Profile="(Default)">!!Bremen calling Testversion!!</Value> <Value Profile="(Default)">!!Bremen calling Testversion!!</Value>

View File

@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:sets="clr-namespace:BreCalClient.Properties" xmlns:sets="clr-namespace:BreCalClient.Properties"
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalDevelClient" xmlns:db="clr-namespace:BreCalClient;assembly=BreCalTestClient"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="120" d:DesignWidth="800" Loaded="UserControl_Loaded"> d:DesignHeight="120" d:DesignWidth="800" Loaded="UserControl_Loaded">
<Border BorderBrush="LightGray" Margin="1" BorderThickness="1"> <Border BorderBrush="LightGray" Margin="1" BorderThickness="1">

View File

@ -174,13 +174,13 @@ namespace BreCalClient
switch (this.ShipcallControlModel?.Shipcall?.Type) switch (this.ShipcallControlModel?.Shipcall?.Type)
{ {
case 1: // incoming case 1: // incoming
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/arrow_down_red.png")); this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_down_red.png"));
break; break;
case 2: // outgoing case 2: // outgoing
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/arrow_up_blue.png")); this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_up_blue.png"));
break; break;
case 3: // shifting case 3: // shifting
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/arrow_right_green.png")); this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/arrow_right_green.png"));
break; break;
default: default:
break; break;
@ -189,13 +189,13 @@ namespace BreCalClient
switch(this.ShipcallControlModel?.LightMode) switch(this.ShipcallControlModel?.LightMode)
{ {
case ShipcallControlModel.TrafficLightMode.GREEN: case ShipcallControlModel.TrafficLightMode.GREEN:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/check.png")); this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/check.png"));
break; break;
case ShipcallControlModel.TrafficLightMode.YELLOW: case ShipcallControlModel.TrafficLightMode.YELLOW:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/sign_warning.png")); this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/sign_warning.png"));
break; break;
case ShipcallControlModel.TrafficLightMode.RED: case ShipcallControlModel.TrafficLightMode.RED:
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalDevelClient;component/Resources/delete2.png")); this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/delete2.png"));
break; break;
default: default:
break; break;

View File

@ -8,7 +8,7 @@
<applicationSettings> <applicationSettings>
<RoleEditor.Properties.Settings> <RoleEditor.Properties.Settings>
<setting name="ConnectionString" serializeAs="String"> <setting name="ConnectionString" serializeAs="String">
<value>Server=localhost;User ID=ds;Password=HalloWach_2323XXL!!;Database=bremen_calling_devel;Port=33306</value> <value>Server=localhost;User ID=ds;Password=HalloWach_2323XXL!!;Database=bremen_calling_test;Port=33306</value>
</setting> </setting>
</RoleEditor.Properties.Settings> </RoleEditor.Properties.Settings>
</applicationSettings> </applicationSettings>

View File

@ -260,12 +260,23 @@
<Button Content="Import excel" Margin="2" x:Name="buttonImportBerths" Click="buttonImportBerths_Click" Width="100" HorizontalAlignment="Left" Grid.Row="0"/> <Button Content="Import excel" Margin="2" x:Name="buttonImportBerths" Click="buttonImportBerths_Click" Width="100" HorizontalAlignment="Left" Grid.Row="0"/>
<local:ENIDataGrid x:Name="dataGridBerths" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False" <local:ENIDataGrid x:Name="dataGridBerths" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False"
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<local:ENIDataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Deleted}" Value="1">
<Setter Property="Foreground" Value="DarkGray"/>
</DataTrigger>
</Style.Triggers>
</Style>
</local:ENIDataGrid.RowStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/> <DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" IsReadOnly="True"/> <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" IsReadOnly="True"/>
<DataGridCheckBoxColumn Header="Lock" Binding="{Binding Path=Lock}" IsReadOnly="True"/> <DataGridCheckBoxColumn Header="Lock" Binding="{Binding Path=Lock}" IsReadOnly="True"/>
<DataGridTextColumn Header="Terminal" Binding="{Binding Path=Terminal, Mode=OneWay}" IsReadOnly="True"/> <DataGridTextColumn Header="Terminal" Binding="{Binding Path=Terminal, Mode=OneWay}" IsReadOnly="True"/>
<DataGridTextColumn Header="Authority" Binding="{Binding Path=Authority_Text, Mode=OneWay}" IsReadOnly="True" /> <DataGridTextColumn Header="Authority" Binding="{Binding Path=Authority_Text, Mode=OneWay}" IsReadOnly="True" />
<DataGridTextColumn Header="Deleted" Binding="{Binding Path=Deleted, Mode=OneWay}" IsReadOnly="True" />
</DataGrid.Columns> </DataGrid.Columns>
</local:ENIDataGrid> </local:ENIDataGrid>
</Grid> </Grid>
@ -279,6 +290,15 @@
<Button Content="Import excel" Margin="2" x:Name="buttonImportShipss" Click="buttonImportShipss_Click" Width="100" HorizontalAlignment="Left" Grid.Row="0"/> <Button Content="Import excel" Margin="2" x:Name="buttonImportShipss" Click="buttonImportShipss_Click" Width="100" HorizontalAlignment="Left" Grid.Row="0"/>
<local:ENIDataGrid x:Name="dataGridShips" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False" <local:ENIDataGrid x:Name="dataGridShips" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False"
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<local:ENIDataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding Deleted}" Value="1">
<Setter Property="Foreground" Value="DarkGray"/>
</DataTrigger>
</Style.Triggers>
</Style>
</local:ENIDataGrid.RowStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/> <DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/>
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" IsReadOnly="True"/> <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" IsReadOnly="True"/>
@ -288,6 +308,7 @@
<DataGridTextColumn Header="Callsign" Binding="{Binding Path=Callsign}" IsReadOnly="True"/> <DataGridTextColumn Header="Callsign" Binding="{Binding Path=Callsign}" IsReadOnly="True"/>
<DataGridTextColumn Header="Length" Binding="{Binding Path=Length}" IsReadOnly="True"/> <DataGridTextColumn Header="Length" Binding="{Binding Path=Length}" IsReadOnly="True"/>
<DataGridTextColumn Header="Width" Binding="{Binding Path=Width}" IsReadOnly="True"/> <DataGridTextColumn Header="Width" Binding="{Binding Path=Width}" IsReadOnly="True"/>
<DataGridTextColumn Header="Deleted" Binding="{Binding Path=Deleted, Mode=OneWay}" IsReadOnly="True" />
</DataGrid.Columns> </DataGrid.Columns>
</local:ENIDataGrid> </local:ENIDataGrid>
</Grid> </Grid>

View File

@ -131,10 +131,13 @@ namespace RoleEditor
#region ship context menu callbacks #region ship context menu callbacks
private void DataGridShips_DeleteRequested(DbEntity obj) private async void DataGridShips_DeleteRequested(DbEntity obj)
{ {
if(obj is Ship s) if (obj is Ship s)
{
await s.Delete(this._dbManager);
this._ships.Remove(s); this._ships.Remove(s);
}
} }
private async void DataGridShips_EditRequested(DbEntity obj) private async void DataGridShips_EditRequested(DbEntity obj)
@ -172,10 +175,13 @@ namespace RoleEditor
#region berth context menu callbacks #region berth context menu callbacks
private void DataGridBerths_DeleteRequested(DbEntity obj) private async void DataGridBerths_DeleteRequested(DbEntity obj)
{ {
if(obj is Berth b) if (obj is Berth b)
{
await b.Delete(this._dbManager);
this._berths.Remove(b); this._berths.Remove(b);
}
} }
private async void DataGridBerths_EditRequested(DbEntity obj) private async void DataGridBerths_EditRequested(DbEntity obj)

View File

@ -31,6 +31,8 @@ namespace brecal.model
public string? Authority_Text { get { if (Authority != null) return Authority.Name; else return "n/a"; } } public string? Authority_Text { get { if (Authority != null) return Authority.Name; else return "n/a"; } }
public int? Deleted { get; set; }
#endregion #endregion
#region public static methods #region public static methods
@ -46,7 +48,7 @@ namespace brecal.model
public static void SetLoadQuery(IDbCommand cmd, params object?[] list) public static void SetLoadQuery(IDbCommand cmd, params object?[] list)
{ {
cmd.CommandText = "SELECT id, name, owner_id, authority_id, `lock`, created, modified FROM berth"; cmd.CommandText = "SELECT id, name, owner_id, authority_id, `lock`, created, modified, deleted FROM berth";
} }
public static List<DbEntity> LoadElems(IDataReader reader) public static List<DbEntity> LoadElems(IDataReader reader)
@ -62,6 +64,7 @@ namespace brecal.model
if (!reader.IsDBNull(4)) b.Lock = reader.GetBoolean(4); if (!reader.IsDBNull(4)) b.Lock = reader.GetBoolean(4);
if (!reader.IsDBNull(5)) b.Created = reader.GetDateTime(5); if (!reader.IsDBNull(5)) b.Created = reader.GetDateTime(5);
if (!reader.IsDBNull(6)) b.Modified = reader.GetDateTime(6); if (!reader.IsDBNull(6)) b.Modified = reader.GetDateTime(6);
if (!reader.IsDBNull(7)) b.Deleted = reader.GetInt16(7);
result.Add(b); result.Add(b);
} }
return result; return result;
@ -79,7 +82,7 @@ namespace brecal.model
public override void SetDelete(IDbCommand cmd) public override void SetDelete(IDbCommand cmd)
{ {
cmd.CommandText = "DELETE FROM berth WHERE id = @ID"; cmd.CommandText = "UPDATE berth set Deleted = 1 WHERE id = @ID";
IDataParameter idParam = cmd.CreateParameter(); IDataParameter idParam = cmd.CreateParameter();
idParam.ParameterName = "ID"; idParam.ParameterName = "ID";

View File

@ -26,6 +26,8 @@ namespace brecal.model
public double? Width { get; set; } public double? Width { get; set; }
public int? Deleted { get; set; }
public bool IsTug { get { return Participant_Id != null; } } public bool IsTug { get { return Participant_Id != null; } }
public string? TugCompany public string? TugCompany
@ -48,7 +50,7 @@ namespace brecal.model
public static void SetLoadQuery(IDbCommand cmd, params object?[] list) public static void SetLoadQuery(IDbCommand cmd, params object?[] list)
{ {
cmd.CommandText = "SELECT id, name, imo, callsign, participant_id, length, width, created, modified FROM ship"; cmd.CommandText = "SELECT id, name, imo, callsign, participant_id, length, width, created, modified, deleted FROM ship";
} }
public static List<DbEntity> LoadElems(IDataReader reader) public static List<DbEntity> LoadElems(IDataReader reader)
@ -66,6 +68,7 @@ namespace brecal.model
if (!reader.IsDBNull(6)) s.Width = reader.GetFloat(6); if (!reader.IsDBNull(6)) s.Width = reader.GetFloat(6);
if (!reader.IsDBNull(7)) s.Created = reader.GetDateTime(7); if (!reader.IsDBNull(7)) s.Created = reader.GetDateTime(7);
if (!reader.IsDBNull(8)) s.Modified = reader.GetDateTime(8); if (!reader.IsDBNull(8)) s.Modified = reader.GetDateTime(8);
if (!reader.IsDBNull(9)) s.Deleted = reader.GetInt16(9);
result.Add(s); result.Add(s);
} }
return result; return result;
@ -83,7 +86,7 @@ namespace brecal.model
public override void SetDelete(IDbCommand cmd) public override void SetDelete(IDbCommand cmd)
{ {
cmd.CommandText = "DELETE FROM ship WHERE id = @ID"; cmd.CommandText = "UPDATE ship set Deleted = 1 WHERE id = @ID";
IDataParameter idParam = cmd.CreateParameter(); IDataParameter idParam = cmd.CreateParameter();
idParam.ParameterName = "ID"; idParam.ParameterName = "ID";

View File

@ -61,7 +61,7 @@ def create_app(test_config=None):
app.register_blueprint(user.bp) app.register_blueprint(user.bp)
logging.basicConfig(filename='brecaldevel.log', level=logging.DEBUG, format='%(asctime)s | %(name)s | %(levelname)s | %(message)s') logging.basicConfig(filename='brecaltest.log', level=logging.DEBUG, format='%(asctime)s | %(name)s | %(levelname)s | %(message)s')
local_db.initPool(os.path.dirname(app.instance_path)) local_db.initPool(os.path.dirname(app.instance_path))
logging.info('App started') logging.info('App started')
@ -73,8 +73,8 @@ def create_app(test_config=None):
return app return app
__all__ = [ __all__ = [
"get_project_root", "get_project_root",
"ensure_path", "ensure_path",
"execute_test_with_pytest", "execute_test_with_pytest",
"execute_coverage_test", "execute_coverage_test",
"difference_to_then", "difference_to_then",

View File

@ -11,7 +11,7 @@ def initPool(instancePath):
try: try:
global config_path global config_path
if(config_path == None): if(config_path == None):
config_path = os.path.join(instancePath,'../../../secure/connection_data_devel.json'); config_path = os.path.join(instancePath,'../../../secure/connection_data_test.json');
print (config_path) print (config_path)

View File

@ -2,7 +2,7 @@ import os
import sys import sys
import logging import logging
sys.path.insert(0, '/var/www/brecal_devel/src/server') sys.path.insert(0, '/var/www/brecal_test/src/server')
sys.path.insert(0, '/var/www/venv/lib/python3.10/site-packages/') sys.path.insert(0, '/var/www/venv/lib/python3.10/site-packages/')
import schedule import schedule