Skip to content

Commit

Permalink
some small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abarz722 committed May 29, 2024
1 parent f0794a5 commit e78f512
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 34 deletions.
8 changes: 4 additions & 4 deletions roles/database/files/sql/idempotent/fworch-texts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2817,10 +2817,8 @@ INSERT INTO txt VALUES ('E5291', 'English', 'Owner could not be saved');
INSERT INTO txt VALUES ('E5292', 'German', 'Dn oder Gruppe muss gefüllt sein');
INSERT INTO txt VALUES ('E5292', 'English', 'Dn or group has to be filled');

INSERT INTO txt VALUES ('E5301', 'German', 'Konfiguration für Standardsprache konnte nicht gelesen werden: Wert auf Englisch gesetzt');
INSERT INTO txt VALUES ('E5301', 'English', 'Error reading Config for default language: taking default English');
INSERT INTO txt VALUES ('E5302', 'German', 'Konfiguration konnte nicht gelesen werden, Standardwert gesetzt: ');
INSERT INTO txt VALUES ('E5302', 'English', 'Error reading Config, taking default: ');
INSERT INTO txt VALUES ('E5301', 'German', 'Konfiguration konnte nicht gelesen oder verarbeitet werden.');
INSERT INTO txt VALUES ('E5301', 'English', 'Error reading or processing Config.');

INSERT INTO txt VALUES ('E5401', 'German', 'Bitte das alte Passwort eintragen');
INSERT INTO txt VALUES ('E5401', 'English', 'Please insert the old password');
Expand Down Expand Up @@ -2927,6 +2925,8 @@ INSERT INTO txt VALUES ('E9015', 'German', 'Schnittstelle kann beantragte nicht
INSERT INTO txt VALUES ('E9015', 'English', 'Interface cannot replace requested one: Wrong type.');
INSERT INTO txt VALUES ('E9016', 'German', 'Beantragte Schnittstelle kann nicht gelöscht werden.');
INSERT INTO txt VALUES ('E9016', 'English', 'Requested interface cannot be deleted.');
INSERT INTO txt VALUES ('E9101', 'German', 'Fehler bei externer Auftragserzeugung.');
INSERT INTO txt VALUES ('E9101', 'English', 'Error at external ticket creation.');

-- errors from Api
INSERT INTO txt VALUES ('A0001', 'German', 'Ungültige Anmeldedaten. Nutzername darf nicht leer sein');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="col-sm-11 border rounded m-2 p-2">
<h5>@(userConfig.GetText("app_server"))</h5>
<div class="form-group row">
<div class="col-sm-9">
<div class="col-sm-10">
<DraggableList AllElements="AppRoleHandler.AppServersInArea" @bind-SelectedElements="selectedAppServers"
HandleDragStart="HandleDragStart" Display="@(x => x.DisplayWithIcon())" MaxHeight="50"/>
</div>
Expand Down
14 changes: 13 additions & 1 deletion roles/ui/files/FWO.UI/Pages/NetworkModelling/EditAppServer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
{
<AuthorizeView Roles="@Roles.Admin">
<Authorized>
<button type="button" class="btn btn-sm btn-danger" @onclick="async () => {if(await AppServerHandler.Save()) Close();}">@(userConfig.GetText("save"))</button>
<button type="button" class="btn btn-sm btn-danger" @onclick="Save">@(userConfig.GetText("save"))</button>
</Authorized>
<NotAuthorized>
<button type="button" class="btn btn-sm btn-danger" disabled>@(userConfig.GetText("save"))</button>
Expand Down Expand Up @@ -91,6 +91,9 @@
[Parameter]
public ModellingAppServerHandler AppServerHandler { get; set; }
[Parameter]
public EventCallback<ModellingAppServerHandler> AppServerHandlerChanged { get; set; }
private List<AppServerType> appServerTypes = new();
private AppServerType actAppServerType = new();
private bool firstTry = true;
Expand Down Expand Up @@ -131,6 +134,15 @@
Close();
}

private async Task Save()
{
if(await AppServerHandler.Save())
{
await AppServerHandlerChanged.InvokeAsync(AppServerHandler);
Close();
}
}

private void Close()
{
Display = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<button type="button" class="btn btn-sm btn-primary" @onclick="Close">@(userConfig.GetText("ok"))</button>
</Footer>
</PopUp>
<EditAppServer @bind-Display="appServerListHandler.EditAppServerMode" AppServerHandler="appServerListHandler.AppServerHandler"/>
<EditAppServer @bind-Display="appServerListHandler.EditAppServerMode" @bind-AppServerHandler="appServerListHandler.AppServerHandler"/>
<ConfirmDelete @bind-Display="appServerListHandler.DeleteAppServerMode" PerformAction="async () => {await appServerListHandler.DeleteAppServer(); StateHasChanged();}"
Title="@userConfig.GetText("delete_app_server")" DeleteMessage="@appServerListHandler.Message"/>
<Confirm @bind-Display="appServerListHandler.ReactivateAppServerMode" PerformAction="async () => {await appServerListHandler.ReactivateAppServer(); StateHasChanged();}"
Expand Down Expand Up @@ -89,7 +89,7 @@
private bool firstTry = true;


protected override async Task OnInitializedAsync()
protected override void OnInitialized()
{
try
{
Expand All @@ -107,7 +107,7 @@

protected override async Task OnParametersSetAsync()
{
if (Display && firstTry)
if (Display && firstTry && appServerListHandler != null)
{
workInProgress = true;
await appServerListHandler.Init(Application);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,24 +262,13 @@ Roles.Auditor });
return;

// read external ticketing system information from config
ConfigData? configData;
List<ExternalTicketSystem> extTicketSystems = new();

try
{
configData = await globalConfig.GetEditableConfig();
extTicketSystems = System.Text.Json.JsonSerializer.Deserialize<List<ExternalTicketSystem>>(configData.ExtTicketSystems) ?? new();
}
catch (Exception exception)
{
DisplayMessageInUi(exception, userConfig.GetText("read_config"), userConfig.GetText("E5301"), false);
}
List<ExternalTicketSystem> extTicketSystems = System.Text.Json.JsonSerializer.Deserialize<List<ExternalTicketSystem>>(userConfig.ExtTicketSystems) ?? new();

// build ticket
SCTicket ticket = new(appHandler.Connections, "test ticket 1", TicketPriority.High);

// create external ticket
if (extTicketSystems.Count()>0)
if (extTicketSystems.Count() > 0)
{
try
{
Expand All @@ -295,7 +284,7 @@ Roles.Auditor });
}
catch (Exception exception)
{
DisplayMessageInUi(exception, userConfig.GetText("ext_ticket_fail"), userConfig.GetText("E5301"), false);
DisplayMessageInUi(exception, userConfig.GetText("ext_ticket_fail"), userConfig.GetText("E9101"), false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@attribute [Authorize(Roles = $"{Roles.Admin}, {Roles.Auditor}, {Roles.Modeller}")]

@inject ApiConnection apiConnection
@inject GlobalConfig globalConfig
@inject UserConfig userConfig

<div class="input-group">
Expand Down Expand Up @@ -56,7 +57,7 @@ else
{
try
{
configData = await userConfig.GetEditableConfig();
configData = await globalConfig.GetEditableConfig();
}
catch (Exception exception)
{
Expand All @@ -69,7 +70,7 @@ else
{
if (configData != null)
{
await userConfig.WriteToDatabase(configData, apiConnection);
await globalConfig.WriteToDatabase(configData, apiConnection);
DisplayMessageInUi(null, userConfig.GetText("modelling_settings"), userConfig.GetText("U5301"), false);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@attribute [Authorize(Roles = $"{Roles.Admin}, {Roles.Recertifier}, {Roles.Auditor}")]

@inject ApiConnection apiConnection
@inject GlobalConfig globalConfig
@inject UserConfig userConfig

<div class="input-group">
Expand Down Expand Up @@ -47,7 +48,7 @@ else
{
try
{
configData = await userConfig.GetEditableConfig();
configData = await globalConfig.GetEditableConfig();
}
catch (Exception exception)
{
Expand All @@ -61,7 +62,7 @@ else
{
if (configData != null)
{
await userConfig.WriteToDatabase(configData, apiConnection);
await globalConfig.WriteToDatabase(configData, apiConnection);
DisplayMessageInUi(null, userConfig.GetText("recert_settings"), userConfig.GetText("U5301"), false);
}
else
Expand Down
5 changes: 3 additions & 2 deletions roles/ui/files/FWO.UI/Pages/Settings/SettingsReport.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@attribute [Authorize(Roles = $"{Roles.Admin}, {Roles.Reporter}, {Roles.ReporterViewAll}, {Roles.Recertifier}, {Roles.Auditor}, {Roles.FwAdmin}")]

@inject ApiConnection apiConnection
@inject GlobalConfig globalConfig
@inject UserConfig userConfig

<div class="input-group">
Expand Down Expand Up @@ -80,7 +81,7 @@ else
{
try
{
configData = await userConfig.GetEditableConfig();
configData = await globalConfig.GetEditableConfig();
}
catch (Exception exception)
{
Expand All @@ -94,7 +95,7 @@ else
{
if (configData != null)
{
await userConfig.WriteToDatabase(configData, apiConnection);
await globalConfig.WriteToDatabase(configData, apiConnection);
DisplayMessageInUi(null, userConfig.GetText("report_settings"), userConfig.GetText("U5301"), false);
}
else
Expand Down
27 changes: 22 additions & 5 deletions roles/ui/files/FWO.UI/Shared/ConnectionTable.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@
{
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("owner"))" Field="@(x => x.App.Name)" Sortable="true" Filterable="true" />
}
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true" />
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true" >
<Template>
@((MarkupString)DisplayConditional(context, context.Name))
</Template>
</Column>
<Column TableItem="ModellingConnection" Title="@(Connections.Count > 0 && Connections.First().IsInterface ? userConfig.GetText("interface_description") : userConfig.GetText("func_reason"))"
Field="@(x => x.Reason)" Sortable="true" Filterable="true" />
Field="@(x => x.Reason)" Sortable="true" Filterable="true" >
<Template>
@((MarkupString)DisplayConditional(context, context.Reason))
</Template>
</Column>
<Column TableItem="ModellingConnection" Title="@(userConfig.GetText("source"))" Field="@(x => x.Id)" Sortable="true" Filterable="false" >
<Template>
<ExpandableList2 Elements="AppHandler.GetSrcNames(context)" Context="src" AlwaysShowElements="@userConfig.OverviewDisplayLines">
Expand Down Expand Up @@ -106,13 +114,22 @@

private string getTableRowClass(ModellingConnection conn)
{
if(conn.IsRequested)
@* if(conn.IsRequested)
{
return "td-bg-light-grey";
}
} *@
return "";
}

private string DisplayConditional(ModellingConnection conn, string content)
{
if(conn.IsRequested)
{
return $"<span class=\"text-secondary\">{content}</span>";
}
return content;
}

public string DisplayState(ModellingConnection connection)
{
List<string> relevantProps = [];
Expand All @@ -136,6 +153,6 @@
}
}
}
return string.Join(",", relevantProps);
return relevantProps.Count > 0 ? string.Join(",", relevantProps) : $"<span style=\"color:green\">{GlobalConfig.ShowBool(true)}</span>";
}
}

0 comments on commit e78f512

Please sign in to comment.