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(archives): adjust queries and response handling for updated data schema #1221

Merged
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
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
Loading