From 4b503e2c01896b47ba45fcd849fde419693af03a Mon Sep 17 00:00:00 2001
From: Thuan Vo
Date: Thu, 5 Jan 2023 19:13:01 -0500
Subject: [PATCH 01/24] fix(applayout): fix nested anchor warnings
---
src/app/AppLayout/AppLayout.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/app/AppLayout/AppLayout.tsx b/src/app/AppLayout/AppLayout.tsx
index f5fcf187b..953675f78 100644
--- a/src/app/AppLayout/AppLayout.tsx
+++ b/src/app/AppLayout/AppLayout.tsx
@@ -480,11 +480,12 @@ const AppLayout: React.FC = ({ children }) => {
-
+
+
{HeaderToolbar}
From ed016465ab8e67d3773cd3536559244be7ec490e Mon Sep 17 00:00:00 2001
From: Thuan Vo
Date: Thu, 5 Jan 2023 19:19:23 -0500
Subject: [PATCH 02/24] feat(settings): categorize settings
---
.../AutomatedAnalysisConfigForm.tsx | 64 +++-
src/app/Settings/AutoRefresh.tsx | 1 +
src/app/Settings/AutomatedAnalysisConfig.tsx | 3 +-
src/app/Settings/CredentialsStorage.tsx | 9 +-
src/app/Settings/DeletionDialogControl.tsx | 20 +-
src/app/Settings/FeatureLevels.tsx | 2 +
src/app/Settings/NotificationControl.tsx | 51 +--
src/app/Settings/Settings.tsx | 141 +++++--
src/app/Settings/WebSocketDebounce.tsx | 1 +
src/app/TargetSelect/TargetSelect.tsx | 3 +
src/app/app.css | 8 +
src/test/Settings/CredentialsStorage.test.tsx | 9 -
.../CredentialsStorage.test.tsx.snap | 55 ---
.../__snapshots__/Settings.test.tsx.snap | 348 ++----------------
src/test/TargetSelect/TargetSelect.test.tsx | 18 -
.../__snapshots__/TargetSelect.test.tsx.snap | 215 -----------
16 files changed, 254 insertions(+), 694 deletions(-)
delete mode 100644 src/test/Settings/__snapshots__/CredentialsStorage.test.tsx.snap
delete mode 100644 src/test/TargetSelect/__snapshots__/TargetSelect.test.tsx.snap
diff --git a/src/app/Dashboard/AutomatedAnalysis/AutomatedAnalysisConfigForm.tsx b/src/app/Dashboard/AutomatedAnalysis/AutomatedAnalysisConfigForm.tsx
index 68b7c426a..40e4e8692 100644
--- a/src/app/Dashboard/AutomatedAnalysis/AutomatedAnalysisConfigForm.tsx
+++ b/src/app/Dashboard/AutomatedAnalysis/AutomatedAnalysisConfigForm.tsx
@@ -277,18 +277,9 @@ export const AutomatedAnalysisConfigForm: React.FC
- );
- }
- return (
-
+ >
+ ),
+ [
+ templateName,
+ templateType,
+ templates,
+ isLoading,
+ isSaveLoading,
+ selectedSpecifier,
+ maxSize,
+ maxSizeUnits,
+ maxAge,
+ maxAgeUnits,
+ isFormInvalid,
+ showHelperMessage,
+ createButtonLoadingProps,
+ handleMaxSizeChange,
+ handleMaxAgeChange,
+ handleMaxSizeUnitChange,
+ handleMaxAgeUnitChange,
+ handleSaveConfig,
+ handleSubmit,
+ handleTemplateChange,
+ props.isSettingsForm,
+ saveButtonLoadingProps,
+ ]
+ );
+
+ if (errorMessage != '') {
+ return (
+
+ );
+ }
+ return (
+ <>
+ {props.isSettingsForm ? (
+ formContent
+ ) : (
+
+ )}
+ >
);
};
diff --git a/src/app/Settings/AutoRefresh.tsx b/src/app/Settings/AutoRefresh.tsx
index 647ec36e4..1df31cde8 100644
--- a/src/app/Settings/AutoRefresh.tsx
+++ b/src/app/Settings/AutoRefresh.tsx
@@ -108,4 +108,5 @@ export const AutoRefresh: UserSetting = {
description:
'Set the refresh period for content views. Views normally update dynamically via WebSocket notifications, so this should not be needed unless WebSockets are not working.',
content: Component,
+ category: 'General',
};
diff --git a/src/app/Settings/AutomatedAnalysisConfig.tsx b/src/app/Settings/AutomatedAnalysisConfig.tsx
index 09798b59c..a85fdfc6e 100644
--- a/src/app/Settings/AutomatedAnalysisConfig.tsx
+++ b/src/app/Settings/AutomatedAnalysisConfig.tsx
@@ -72,7 +72,7 @@ const Component = () => {
-
+
Current configuration
@@ -108,4 +108,5 @@ export const AutomatedAnalysisConfig: UserSetting = {
description:
'Set the recording configuration for automated analysis recordings. You may want smaller or larger values for max-age and max-size depending on how recent you want events to be recorded from the analysis.',
content: Component,
+ category: 'Dashboard',
};
diff --git a/src/app/Settings/CredentialsStorage.tsx b/src/app/Settings/CredentialsStorage.tsx
index 956705da3..e4a1efb2f 100644
--- a/src/app/Settings/CredentialsStorage.tsx
+++ b/src/app/Settings/CredentialsStorage.tsx
@@ -37,7 +37,7 @@
*/
import { getFromLocalStorage, saveToLocalStorage } from '@app/utils/LocalStorage';
-import { Select, SelectOption, SelectVariant, Text } from '@patternfly/react-core';
+import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
import * as React from 'react';
import { Link } from 'react-router-dom';
import { UserSetting } from './Settings';
@@ -93,6 +93,8 @@ const Component = () => {
<>
-
-
-
-
-
-
-
-
-
- Feature Levels Description
-
-
-
-
- Feature Levels Component
-
-
-
From 044eb08ae43f69b0a742dda0771363f1841351f0 Mon Sep 17 00:00:00 2001
From: Thuan Vo
Date: Tue, 10 Jan 2023 15:10:32 -0500
Subject: [PATCH 23/24] fix(logout): redirect to / if on /settings
---
src/app/Shared/Services/Login.service.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/app/Shared/Services/Login.service.tsx b/src/app/Shared/Services/Login.service.tsx
index 6f3e960fd..dbd5bf7f2 100644
--- a/src/app/Shared/Services/Login.service.tsx
+++ b/src/app/Shared/Services/Login.service.tsx
@@ -254,7 +254,8 @@ export class LoginService {
private navigateToLoginPage(): void {
this.authMethod.next(AuthMethod.UNKNOWN);
this.removeCacheItem(this.AUTH_METHOD_KEY);
- window.location.href = window.location.href.split('#')[0];
+ const url = new URL(window.location.href.split('#')[0]);
+ window.location.href = url.pathname.match(/\/settings/i) ? '/' : url.pathname;
}
private getTokenFromUrlFragment(): string {
From e7186ef0c0283debdd5a6ad2cb4ab0dba63a5ea8 Mon Sep 17 00:00:00 2001
From: Thuan Vo
Date: Tue, 10 Jan 2023 18:56:43 -0500
Subject: [PATCH 24/24] chore(prettier): apply prettier
---
src/app/Settings/Settings.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/Settings/Settings.tsx b/src/app/Settings/Settings.tsx
index ef905ba42..1d0f1c87f 100644
--- a/src/app/Settings/Settings.tsx
+++ b/src/app/Settings/Settings.tsx
@@ -75,7 +75,7 @@ const _SettingCategories = [
'Advanced',
] as const;
-export type SettingCategory = typeof _SettingCategories[number];
+export type SettingCategory = (typeof _SettingCategories)[number];
export interface SettingGroup {
groupLabel: SettingCategory;