Skip to content

Commit ea3055a

Browse files
fix(aa): refactor Automated Analysis Recording Setting (#1014) (#1018)
* show current config Signed-off-by: Max Cao <[email protected]> * prevent setting empty template Signed-off-by: Max Cao <[email protected]> * add reset Signed-off-by: Max Cao <[email protected]> * fix some handling Signed-off-by: Max Cao <[email protected]> * redesign Signed-off-by: Max Cao <[email protected]> * redesign 2 Signed-off-by: Max Cao <[email protected]> * update tests and add confirmation Signed-off-by: Max Cao <[email protected]> * re: fixes Signed-off-by: Max Cao <[email protected]> * fix tests Signed-off-by: Max Cao <[email protected]> * localize Signed-off-by: Max Cao <[email protected]> --------- Signed-off-by: Max Cao <[email protected]> (cherry picked from commit 093e003) Co-authored-by: Max Cao <[email protected]>
1 parent f92767b commit ea3055a

File tree

13 files changed

+458
-307
lines changed

13 files changed

+458
-307
lines changed

locales/en/common.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"DESCRIPTION": "Description",
2121
"DEVELOPMENT": "DEVELOPMENT",
2222
"DOWNLOAD": "Download",
23+
"EDIT": "Edit",
2324
"FILTER_NAME": "Name",
2425
"HELP": "Help",
2526
"HOUR": "Hour",
@@ -54,7 +55,6 @@
5455
"SUBMITTING": "Submitting",
5556
"SUGGESTED": "Suggested",
5657
"TEMPLATE": "Template",
57-
"TEMPLATE_HELPER_TEXT_INVALID": "Template must be selected",
5858
"TIME": "Time",
5959
"UPLOAD": "Upload",
6060
"USER_SUBMITTED": "User-submitted",

locales/en/public.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@
7272
}
7373
},
7474
"AutomatedAnalysisConfigForm": {
75-
"ERROR_TITLE": "Error displaying recording configuration settings",
75+
"CURRENT_CONFIG": "Current Configuration",
7676
"FORM_TITLE": "Profiling Recording Configuration",
77+
"FORMATTED_TEMPLATE": "Name: {{template.name}}, Type: {{template.type}}",
78+
"MAXIMUM_AGE": "Maximum age ({{unit}})",
79+
"MAXIMUM_SIZE": "Maximum size ({{unit}})",
80+
"SAVE_CHANGES": "Save changes",
7781
"TEMPLATE_HELPER_TEXT": "The Event Template to be applied to Automated Analysis recordings.",
7882
"TEMPLATE_INVALID_WARNING": "WARNING: Setting a Target Template as a default template type configuration may not apply to all Target JVMs if the JVMs do not support them."
7983
},
@@ -230,6 +234,9 @@
230234
"ERROR_MESSAGE": "Reason: {{message}}",
231235
"RESOLVE_MESSAGE": "Reload the page and try again. If the error still persists, see the list of <issue>{{knownIssue}}</issue> or <report>{{fileReport}}</report>."
232236
},
237+
"ErrorView": {
238+
"EVENT_TEMPLATES": "Error retrieving event templates"
239+
},
233240
"JvmDetailsCard": {
234241
"CARD_DESCRIPTION": "Display details about the selected target JVM.",
235242
"CARD_DESCRIPTION_FULL": "View information such as the connection URL, labels, and annotations belonging to the selected target JVM.",

src/app/AppLayout/AppLayout.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,12 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
619619
>
620620
{children}
621621
</Page>
622-
<AuthModal visible={showAuthModal} onDismiss={dismissAuthModal} onSave={authModalOnSave} />
622+
<AuthModal
623+
visible={showAuthModal}
624+
onDismiss={dismissAuthModal}
625+
onSave={authModalOnSave}
626+
targetObs={serviceContext.target.target()}
627+
/>
623628
<SslErrorModal visible={showSslErrorModal} onDismiss={dismissSslErrorModal} />
624629
</CryostatJoyride>
625630
</GlobalQuickStartDrawer>

src/app/AppLayout/AuthModal.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,22 @@
3636
* SOFTWARE.
3737
*/
3838
import { ServiceContext } from '@app/Shared/Services/Services';
39-
import { NO_TARGET } from '@app/Shared/Services/Target.service';
39+
import { NO_TARGET, Target } from '@app/Shared/Services/Target.service';
4040
import { useSubscriptions } from '@app/utils/useSubscriptions';
4141
import { Modal, ModalVariant, Text } from '@patternfly/react-core';
4242
import * as React from 'react';
4343
import { Link } from 'react-router-dom';
44-
import { filter, first, map, mergeMap } from 'rxjs';
44+
import { Observable, filter, first, map, mergeMap } from 'rxjs';
4545
import { CredentialAuthForm } from './CredentialAuthForm';
4646

4747
export interface AuthModalProps {
4848
visible: boolean;
4949
onDismiss: () => void;
5050
onSave: () => void;
51+
targetObs: Observable<Target>;
5152
}
5253

53-
export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onPropsSave, ...props }) => {
54+
export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onPropsSave, targetObs, ...props }) => {
5455
const context = React.useContext(ServiceContext);
5556
const [loading, setLoading] = React.useState(false);
5657
const addSubscription = useSubscriptions();
@@ -59,8 +60,7 @@ export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onProps
5960
(username: string, password: string) => {
6061
setLoading(true);
6162
addSubscription(
62-
context.target
63-
.target()
63+
targetObs
6464
.pipe(
6565
filter((target) => target !== NO_TARGET),
6666
first(),
@@ -75,7 +75,7 @@ export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onProps
7575
})
7676
);
7777
},
78-
[addSubscription, context.authCredentials, context.target, setLoading, onPropsSave]
78+
[addSubscription, context.authCredentials, targetObs, setLoading, onPropsSave]
7979
);
8080

8181
return (

0 commit comments

Comments
 (0)