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(aa): refactor Automated Analysis Recording Setting #1014

Merged
merged 10 commits into from
May 5, 2023
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
2 changes: 1 addition & 1 deletion locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"DESCRIPTION": "Description",
"DEVELOPMENT": "DEVELOPMENT",
"DOWNLOAD": "Download",
"EDIT": "Edit",
"FILTER_NAME": "Name",
"HELP": "Help",
"HOUR": "Hour",
Expand Down Expand Up @@ -54,7 +55,6 @@
"SUBMITTING": "Submitting",
"SUGGESTED": "Suggested",
"TEMPLATE": "Template",
"TEMPLATE_HELPER_TEXT_INVALID": "Template must be selected",
"TIME": "Time",
"UPLOAD": "Upload",
"USER_SUBMITTED": "User-submitted",
Expand Down
9 changes: 8 additions & 1 deletion locales/en/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@
}
},
"AutomatedAnalysisConfigForm": {
"ERROR_TITLE": "Error displaying recording configuration settings",
"CURRENT_CONFIG": "Current Configuration",
"FORM_TITLE": "Profiling Recording Configuration",
"FORMATTED_TEMPLATE": "Name: {{template.name}}, Type: {{template.type}}",
"MAXIMUM_AGE": "Maximum age ({{unit}})",
"MAXIMUM_SIZE": "Maximum size ({{unit}})",
"SAVE_CHANGES": "Save changes",
"TEMPLATE_HELPER_TEXT": "The Event Template to be applied to Automated Analysis recordings.",
"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."
},
Expand Down Expand Up @@ -230,6 +234,9 @@
"ERROR_MESSAGE": "Reason: {{message}}",
"RESOLVE_MESSAGE": "Reload the page and try again. If the error still persists, see the list of <issue>{{knownIssue}}</issue> or <report>{{fileReport}}</report>."
},
"ErrorView": {
"EVENT_TEMPLATES": "Error retrieving event templates"
},
"JvmDetailsCard": {
"CARD_DESCRIPTION": "Display details about the selected target JVM.",
"CARD_DESCRIPTION_FULL": "View information such as the connection URL, labels, and annotations belonging to the selected target JVM.",
Expand Down
7 changes: 6 additions & 1 deletion src/app/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,12 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
>
{children}
</Page>
<AuthModal visible={showAuthModal} onDismiss={dismissAuthModal} onSave={authModalOnSave} />
<AuthModal
visible={showAuthModal}
onDismiss={dismissAuthModal}
onSave={authModalOnSave}
targetObs={serviceContext.target.target()}
/>
<SslErrorModal visible={showSslErrorModal} onDismiss={dismissSslErrorModal} />
</CryostatJoyride>
</GlobalQuickStartDrawer>
Expand Down
12 changes: 6 additions & 6 deletions src/app/AppLayout/AuthModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,22 @@
* SOFTWARE.
*/
import { ServiceContext } from '@app/Shared/Services/Services';
import { NO_TARGET } from '@app/Shared/Services/Target.service';
import { NO_TARGET, Target } from '@app/Shared/Services/Target.service';
import { useSubscriptions } from '@app/utils/useSubscriptions';
import { Modal, ModalVariant, Text } from '@patternfly/react-core';
import * as React from 'react';
import { Link } from 'react-router-dom';
import { filter, first, map, mergeMap } from 'rxjs';
import { Observable, filter, first, map, mergeMap } from 'rxjs';
import { CredentialAuthForm } from './CredentialAuthForm';

export interface AuthModalProps {
visible: boolean;
onDismiss: () => void;
onSave: () => void;
targetObs: Observable<Target>;
}

export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onPropsSave, ...props }) => {
export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onPropsSave, targetObs, ...props }) => {
const context = React.useContext(ServiceContext);
const [loading, setLoading] = React.useState(false);
const addSubscription = useSubscriptions();
Expand All @@ -59,8 +60,7 @@ export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onProps
(username: string, password: string) => {
setLoading(true);
addSubscription(
context.target
.target()
targetObs
.pipe(
filter((target) => target !== NO_TARGET),
first(),
Expand All @@ -75,7 +75,7 @@ export const AuthModal: React.FC<AuthModalProps> = ({ onDismiss, onSave: onProps
})
);
},
[addSubscription, context.authCredentials, context.target, setLoading, onPropsSave]
[addSubscription, context.authCredentials, targetObs, setLoading, onPropsSave]
);

return (
Expand Down
Loading