Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some missing catches in UI #1096

Merged
merged 5 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions roles/database/files/sql/idempotent/fworch-texts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ INSERT INTO txt VALUES ('Months', 'German', 'Monat(e)');
INSERT INTO txt VALUES ('Months', 'English', 'Month(s)');
INSERT INTO txt VALUES ('Years', 'German', 'Jahr(e)');
INSERT INTO txt VALUES ('Years', 'English', 'Year(s)');
INSERT INTO txt VALUES ('schedule_fetch', 'German', 'Abholen der Termine');
INSERT INTO txt VALUES ('schedule_fetch', 'English', 'Report Schedule Fetch');
INSERT INTO txt VALUES ('save_scheduled_report','German', 'Termin speichern');
INSERT INTO txt VALUES ('save_scheduled_report','English', 'Save scheduled report');
INSERT INTO txt VALUES ('edit_scheduled_report','German', 'Termin bearbeiten');
Expand All @@ -356,6 +358,8 @@ INSERT INTO txt VALUES ('download_as_html', 'German', 'Herunterladen als HTML'
INSERT INTO txt VALUES ('download_as_html', 'English', 'Download as HTML');
INSERT INTO txt VALUES ('download_as_json', 'German', 'Herunterladen als JSON');
INSERT INTO txt VALUES ('download_as_json', 'English', 'Download as JSON');
INSERT INTO txt VALUES ('archive_fetch', 'German', 'Abholen der archivierten Reports');
INSERT INTO txt VALUES ('archive_fetch', 'English', 'Archived Reports Fetch');
INSERT INTO txt VALUES ('fetch_report', 'German', 'Erstellten Report holen');
INSERT INTO txt VALUES ('fetch_report', 'English', 'Fetch downloads of generated report');
INSERT INTO txt VALUES ('delete_report', 'German', 'Erstellten Report löschen');
Expand Down
9 changes: 8 additions & 1 deletion roles/ui/files/FWO_UI/Pages/Reporting/Archive.razor
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@

protected override async Task OnInitializedAsync()
{
archivedReports = (await apiConnection.SendQueryAsync<ReportFile[]>(ReportQueries.getGeneratedReports)).ToList();
try
{
archivedReports = (await apiConnection.SendQueryAsync<ReportFile[]>(ReportQueries.getGeneratedReports)).ToList();
}
catch (Exception exception)
{
DisplayMessageInUi(exception, userConfig.GetText("archive_fetch"), null, true);
}
}

private async Task GetGeneratedReportContent(int reportId)
Expand Down
15 changes: 11 additions & 4 deletions roles/ui/files/FWO_UI/Pages/Reporting/Schedule.razor
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,17 @@

protected override async Task OnInitializedAsync()
{
scheduledReports = (await apiConnection.SendQueryAsync<ScheduledReport[]>(ReportQueries.getReportSchedules)).ToList();
reportTemplates = await apiConnection.SendQueryAsync<ReportTemplate[]>(ReportQueries.getReportTemplates);
uiUserDbId = userConfig.User.DbId;
authenticationState = await authenticationStateTask;
try
{
scheduledReports = (await apiConnection.SendQueryAsync<ScheduledReport[]>(ReportQueries.getReportSchedules)).ToList();
reportTemplates = await apiConnection.SendQueryAsync<ReportTemplate[]>(ReportQueries.getReportTemplates);
uiUserDbId = userConfig.User.DbId;
authenticationState = await authenticationStateTask;
}
catch (Exception exception)
{
DisplayMessageInUi(exception, userConfig.GetText("schedule_fetch"), null, true);
}
}

private async Task SaveScheduledReport()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@

protected override void OnInitialized()
{
config = new ConfigDbAccess(apiConnection, 0);
try
{
config = new ConfigDbAccess(apiConnection, 0);
selectedDefaultLanguage = config.Get(GlobalConfig.kDefaultLanguage);
Log.WriteDebug("Default language", $"got language: {selectedDefaultLanguage}");
}
Expand Down
19 changes: 13 additions & 6 deletions roles/ui/files/FWO_UI/Pages/Settings/SettingsPasswordPolicy.razor
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,20 @@

protected override void OnInitialized()
{
config = new ConfigDbAccess(apiConnection, 0);
try
{
config = new ConfigDbAccess(apiConnection, 0);

GetIntSetting(ref minLength, GlobalConfig.kPwMinLength);
GetBoolSetting(ref upperCaseRequired, GlobalConfig.kPwUpperCaseRequired);
GetBoolSetting(ref lowerCaseRequired, GlobalConfig.kPwLowerCaseRequired);
GetBoolSetting(ref numberRequired, GlobalConfig.kPwNumberRequired);
GetBoolSetting(ref specialCharactersRequired, GlobalConfig.kPwSpecialCharactersRequired);
GetIntSetting(ref minLength, GlobalConfig.kPwMinLength);
GetBoolSetting(ref upperCaseRequired, GlobalConfig.kPwUpperCaseRequired);
GetBoolSetting(ref lowerCaseRequired, GlobalConfig.kPwLowerCaseRequired);
GetBoolSetting(ref numberRequired, GlobalConfig.kPwNumberRequired);
GetBoolSetting(ref specialCharactersRequired, GlobalConfig.kPwSpecialCharactersRequired);
}
catch (Exception exception)
{
DisplayMessageInUi(exception, userConfig.GetText("read_config"), null, true);
}
}

private void GetIntSetting(ref int value, string setting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
protected override async Task OnInitializedAsync()
{
AuthenticationState authState = await authenticationStateTask;
UiUsersDbAccess uiUser = new UiUsersDbAccess(authState, apiConnection);
config = new ConfigDbAccess(apiConnection, uiUser.UiUser.DbId);
try
{
UiUsersDbAccess uiUser = new UiUsersDbAccess(authState, apiConnection);
config = new ConfigDbAccess(apiConnection, uiUser.UiUser.DbId);
string settingsValue = config.Get(GlobalConfig.kRecertificationDisplayPeriod);
if (settingsValue != "")
{
Expand Down
4 changes: 2 additions & 2 deletions roles/ui/files/FWO_UI/Pages/Settings/SettingsReport.razor
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
protected override async Task OnInitializedAsync()
{
AuthenticationState authState = await authenticationStateTask;
UiUsersDbAccess uiUser = new UiUsersDbAccess(authState, apiConnection);
config = new ConfigDbAccess(apiConnection, uiUser.UiUser.DbId);
try
{
UiUsersDbAccess uiUser = new UiUsersDbAccess(authState, apiConnection);
config = new ConfigDbAccess(apiConnection, uiUser.UiUser.DbId);
string settingsValue = config.Get(GlobalConfig.kElementsPerFetch);
if (settingsValue != "")
{
Expand Down