Skip to content

Commit

Permalink
fix(graphql): adjustments for Dashboard Automated Analysis with new A…
Browse files Browse the repository at this point in the history
…PI schema (#1220)

* fix(graphql): adjustments for Dashboard Automated Analysis with new API schema
  • Loading branch information
andrewazores committed Apr 13, 2024
1 parent cd4bf5a commit 4acf4a3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
36 changes: 22 additions & 14 deletions src/app/Dashboard/AutomatedAnalysis/AutomatedAnalysisCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,23 @@ export const AutomatedAnalysisCard: DashboardCardFC<AutomatedAnalysisCardProps>
`
query ActiveRecordingsForAutomatedAnalysis($connectUrl: String) {
targetNodes(filter: { name: $connectUrl }) {
recordings {
active (filter: {
name: "${automatedAnalysisRecordingName}",
labels: ["origin=${automatedAnalysisRecordingName}"],
}) {
data {
state
name
downloadUrl
reportUrl
metadata {
labels
target {
recordings {
active (filter: {
name: "${automatedAnalysisRecordingName}",
labels: ["origin=${automatedAnalysisRecordingName}"],
}) {
data {
state
name
downloadUrl
reportUrl
metadata {
labels {
key
value
}
}
}
}
}
Expand All @@ -214,7 +219,10 @@ export const AutomatedAnalysisCard: DashboardCardFC<AutomatedAnalysisCardProps>
downloadUrl
reportUrl
metadata {
labels
labels {
key
value
}
}
size
archivedTime
Expand Down Expand Up @@ -358,7 +366,7 @@ export const AutomatedAnalysisCard: DashboardCardFC<AutomatedAnalysisCardProps>
}
}
}),
map((v) => v.data.targetNodes[0].recordings.active.data[0] as Recording),
map((v) => v.data.targetNodes[0].target.recordings.active.data[0] as Recording),
tap((recording) => {
if (recording === null || recording === undefined) {
throw new Error(NO_RECORDINGS_MESSAGE);
Expand Down
10 changes: 9 additions & 1 deletion src/app/Shared/Services/Api.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,16 @@ export class ApiService {
if (archiveOnStop != undefined) {
form.append('archiveOnStop', String(archiveOnStop));
}
const transformedMetadata = {
labels: {},
annotations: {
cryostat: {},
platform: {},
},
};
metadata?.labels.forEach((label) => (transformedMetadata.labels[label.key] = label.value));
if (metadata) {
form.append('metadata', JSON.stringify(metadata));
form.append('metadata', JSON.stringify(transformedMetadata));
}
if (restart != undefined) {
form.append('restart', String(restart));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,19 @@ const mockTargetNode = {

const mockActiveRecordingsResponse = {
data: {
targetNodes: [mockTargetNode],
targetNodes: [{ target: mockTargetNode }],
},
};

const mockEmptyActiveRecordingsResponse = {
data: {
targetNodes: [
{
recordings: {
active: {
data: [],
target: {
recordings: {
active: {
data: [],
},
},
},
},
Expand Down

0 comments on commit 4acf4a3

Please sign in to comment.