Skip to content

Commit

Permalink
fix(archives): adjust queries and response handling for updated data …
Browse files Browse the repository at this point in the history
…schema (#1221)

* fix(archives): adjust queries and response handling for updated data schema
  • Loading branch information
andrewazores committed Apr 13, 2024
1 parent 4acf4a3 commit 9c1a626
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 45 deletions.
28 changes: 15 additions & 13 deletions src/app/Archives/AllTargetsArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const AllTargetsArchivedRecordingsTable: React.FC<AllTargetsArchivedRecor
setArchivesForTargets(
targetNodes.map((node) => {
const target: Target = {
connectUrl: node.target.serviceUri,
connectUrl: node.target.connectUrl,
alias: node.target.alias,
labels: [],
annotations: {
Expand All @@ -123,7 +123,7 @@ export const AllTargetsArchivedRecordingsTable: React.FC<AllTargetsArchivedRecor
return {
target,
targetAsObs: of(target),
archiveCount: node.recordings.archived.aggregate.count,
archiveCount: node.target.recordings.archived.aggregate.count,
};
}),
);
Expand All @@ -148,13 +148,13 @@ export const AllTargetsArchivedRecordingsTable: React.FC<AllTargetsArchivedRecor
`query AllTargetsArchives {
targetNodes {
target {
serviceUri
connectUrl
alias
}
recordings {
archived {
aggregate {
count
recordings {
archived {
aggregate {
count
}
}
}
}
Expand All @@ -178,10 +178,12 @@ export const AllTargetsArchivedRecordingsTable: React.FC<AllTargetsArchivedRecor
`
query ArchiveCountForTarget($connectUrl: String) {
targetNodes(filter: { name: $connectUrl }) {
recordings {
archived {
aggregate {
count
target {
recordings {
archived {
aggregate {
count
}
}
}
}
Expand All @@ -196,7 +198,7 @@ export const AllTargetsArchivedRecordingsTable: React.FC<AllTargetsArchivedRecor
{
target: target,
targetAsObs: of(target),
archiveCount: v.data.targetNodes[0].recordings.archived.aggregate.count,
archiveCount: v.data.targetNodes[0].target.recordings.archived.aggregate.count,
},
];
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/RecordingMetadata/BulkEditLabels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const BulkEditLabels: React.FC<BulkEditLabelsProps> = ({
observable = isUploadsTable
? context.api
.graphql<any>(
`query GetUploadedRecordings($filter: ArchivedRecordingFilterInput) {
`query GetUploadedRecordings($filter: ArchivedRecordingsFilterInput) {
archivedRecordings(filter: $filter) {
data {
name
Expand Down
12 changes: 9 additions & 3 deletions src/app/Recordings/ArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ export const ArchivedRecordingsTable: React.FC<ArchivedRecordingsTableProps> = (
downloadUrl
reportUrl
metadata {
labels
labels {
key
value
}
}
size
}
Expand All @@ -213,14 +216,17 @@ export const ArchivedRecordingsTable: React.FC<ArchivedRecordingsTableProps> = (
const queryUploadedRecordings = React.useCallback(() => {
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
return context.api.graphql<any>(
`query UploadedRecordings($filter: ArchivedRecordingFilterInput){
`query UploadedRecordings($filter: ArchivedRecordingsFilterInput) {
archivedRecordings(filter: $filter) {
data {
name
downloadUrl
reportUrl
metadata {
labels
labels {
key
value
}
}
size
}
Expand Down
58 changes: 30 additions & 28 deletions src/test/Archives/AllTargetsArchivedRecordingsTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,42 +76,42 @@ const mockTargetsAndCountsResponse = {
data: {
targetNodes: [
{
recordings: {
archived: {
aggregate: {
count: mockCount1,
},
},
},
target: {
alias: mockAlias1,
serviceUri: mockConnectUrl1,
},
},
{
recordings: {
archived: {
aggregate: {
count: mockCount2,
connectUrl: mockConnectUrl1,
recordings: {
archived: {
aggregate: {
count: mockCount1,
},
},
},
},
target: {
alias: mockAlias2,
serviceUri: mockConnectUrl2,
},
},
{
recordings: {
archived: {
aggregate: {
count: mockCount3,
target: {
alias: mockAlias2,
connectUrl: mockConnectUrl2,
recordings: {
archived: {
aggregate: {
count: mockCount2,
},
},
},
},
},
{
target: {
alias: mockAlias3,
serviceUri: mockConnectUrl3,
connectUrl: mockConnectUrl3,
recordings: {
archived: {
aggregate: {
count: mockCount3,
},
},
},
},
},
],
Expand All @@ -122,10 +122,12 @@ const mockNewTargetCountResponse = {
data: {
targetNodes: [
{
recordings: {
archived: {
aggregate: {
count: mockNewCount,
target: {
recordings: {
archived: {
aggregate: {
count: mockNewCount,
},
},
},
},
Expand Down

0 comments on commit 9c1a626

Please sign in to comment.