Skip to content

Commit 81e214d

Browse files
committed
feat: update pulling artifact edge after import revisions
1 parent d977e7c commit 81e214d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

packages/backend.ai-ui/src/components/fragments/BAIImportArtifactModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ export interface BAIImportArtifactModalProps
4242
}[],
4343
) => void;
4444
onCancel: (e: React.MouseEvent<HTMLElement>) => void;
45+
connectionIds?: string[];
4546
}
4647

4748
const BAIImportArtifactModal = ({
4849
selectedArtifactFrgmt,
4950
selectedArtifactRevisionFrgmt,
5051
onOk,
5152
onCancel,
53+
connectionIds,
5254
...modalProps
5355
}: BAIImportArtifactModalProps) => {
5456
const { t } = useTranslation();
@@ -81,6 +83,7 @@ const BAIImportArtifactModal = ({
8183
useMutation<BAIImportArtifactModalImportArtifactsMutation>(graphql`
8284
mutation BAIImportArtifactModalImportArtifactsMutation(
8385
$input: ImportArtifactsInput!
86+
$connectionIds: [ID!]!
8487
) {
8588
importArtifacts(input: $input) {
8689
tasks {
@@ -90,7 +93,7 @@ const BAIImportArtifactModal = ({
9093
}
9194
}
9295
artifactRevisions {
93-
edges {
96+
edges @appendEdge(connections: $connectionIds) {
9497
node {
9598
id
9699
status
@@ -138,6 +141,7 @@ const BAIImportArtifactModal = ({
138141
toLocalId(revision.id),
139142
),
140143
},
144+
connectionIds: connectionIds ?? [],
141145
},
142146
onCompleted: (res, errors) => {
143147
if (errors && errors.length > 0) {

react/src/pages/ReservoirArtifactDetailPage.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,15 @@ const ReservoirArtifactDetailPage = () => {
116116
}
117117
updatedAt
118118
pullingArtifactRevisions: revisions(
119+
first: null
120+
last: null
119121
filter: { status: { equals: PULLING } }
120122
orderBy: { field: VERSION, direction: DESC }
121-
) {
123+
)
124+
@connection(
125+
key: "ReservoirArtifactDetailPage_pullingArtifactRevisions"
126+
) {
127+
__id
122128
count
123129
edges {
124130
node {
@@ -518,6 +524,9 @@ const ReservoirArtifactDetailPage = () => {
518524
selectedArtifactFrgmt={artifact ?? null}
519525
selectedArtifactRevisionFrgmt={selectedRevisions}
520526
open={!!artifact && !_.isEmpty(selectedRevisions)}
527+
connectionIds={
528+
artifact ? [artifact.pullingArtifactRevisions.__id] : undefined
529+
}
521530
onOk={(_e, tasks) => {
522531
setSelectedRevisions([]);
523532
tasks.forEach((task) => {
@@ -546,7 +555,6 @@ const ReservoirArtifactDetailPage = () => {
546555
},
547556
});
548557
});
549-
updateFetchKey();
550558
}}
551559
onCancel={() => {
552560
setSelectedRevisions([]);

0 commit comments

Comments
 (0)