Skip to content

Commit

Permalink
chore(discovery): use target.agent field for determining connection type
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Aug 9, 2024
1 parent 9dafc5b commit de740ea
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/app/CreateRecording/CustomRecordingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
Target,
KeyValue,
} from '@app/Shared/Services/api.types';
import { isTargetAgentHttp } from '@app/Shared/Services/api.utils';
import { NotificationsContext } from '@app/Shared/Services/Notifications.service';
import { ServiceContext } from '@app/Shared/Services/Services';
import { useSubscriptions } from '@app/utils/hooks/useSubscriptions';
Expand Down Expand Up @@ -286,7 +285,7 @@ export const CustomRecordingForm: React.FC = () => {
setAdvancedRecordingOptions(recordingOptions);
},
error: (error) => {
setErrorMessage(isTargetAgentHttp(target) ? 'Unsupported operation: Create Recordings' : error.message);
setErrorMessage(error.message);
setTemplates([]);
setFormData((old) => ({ ...old, template: undefined }));
setAdvancedRecordingOptions({});
Expand Down
1 change: 1 addition & 0 deletions src/app/Shared/Services/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ export const TEMPLATE_UNSUPPORTED_MESSAGE = 'The template type used in this Reco
export interface Target {
id?: number; // present in responses but we must not include it in requests to create targets
jvmId?: string; // present in responses, but we do not need to provide it in requests
agent: boolean;
connectUrl: string;
alias: string;
labels: KeyValue[];
Expand Down
2 changes: 0 additions & 2 deletions src/app/Shared/Services/api.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ export const indexOfTarget = (arr: Target[], target: Target): number => {
export const getTargetRepresentation = (t: Target) =>
!t.alias || t.alias === t.connectUrl ? `${t.connectUrl}` : `${t.alias} (${t.connectUrl})`;

export const isTargetAgentHttp = (t: Target) => t.connectUrl.startsWith('http');

export const isTargetNode = (node: EnvironmentNode | TargetNode): node is TargetNode => {
return node['target'] !== undefined;
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/Topology/GraphView/CustomNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const CustomNode: React.FC<CustomNodeProps> = ({

const data: TargetNode = element.getData();

const graphic = React.useMemo(() => (data.target.connectUrl.startsWith('http') ? cryostatSvg : openjdkSvg), [data]);
const graphic = React.useMemo(() => (data.target.agent ? cryostatSvg : openjdkSvg), [data]);

const [nodeStatus] = getStatusTargetNode(data);

Expand Down

0 comments on commit de740ea

Please sign in to comment.