Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ export interface BAIImportArtifactModalProps
extends Omit<ModalProps, 'onOk' | 'onCancel'> {
selectedArtifactFrgmt: BAIImportArtifactModalArtifactFragment$key | null;
selectedArtifactRevisionFrgmt: BAIImportArtifactModalArtifactRevisionFragment$key;
onOk: (e: React.MouseEvent<HTMLElement>) => void;
onOk: (
e: React.MouseEvent<HTMLElement>,
tasks: {
taskId: string;
version: string;
artifact_id: string;
}[],
) => void;
onCancel: (e: React.MouseEvent<HTMLElement>) => void;
}

Expand Down Expand Up @@ -124,7 +131,6 @@ const BAIImportArtifactModal = ({
title={t('comp:BAIImportArtifactModal.PullVersion')}
centered
onOk={(e) => {
onOk(e);
importArtifacts({
variables: {
input: {
Expand All @@ -148,7 +154,14 @@ const BAIImportArtifactModal = ({
count: res.importArtifacts.artifactRevisions.edges.length,
}),
);
onOk(e);
onOk(
e,
res.importArtifacts.tasks.map((task) => ({
taskId: task.taskId,
version: task.artifactRevision.version,
artifact_id: toLocalId(selectedArtifact!.id),
})),
);
},
onError: (err) => {
message.error(
Expand Down
1 change: 0 additions & 1 deletion packages/backend.ai-ui/src/locale/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
"Create": "생성",
"Delete": "삭제",
"Remove": "제거",

"Upload": "업로드"
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/backend.ai-ui/src/locale/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
"general": {
"NSelected": "{{count}} dipilih",
"TotalItems": "Jumlah {{total}} item",

"button": {
"Cancel": "Batalkan",
"Close": "Tutup",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend.ai-ui/src/locale/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@
"general": {
"NSelected": "{{count}}",
"TotalItems": "Total {{total}}",

"button": {
"Cancel": "Anulować",
"Close": "Zamknąć",
"CopyAll": "Kopiuj wszystko",
"Create": "Tworzyć",
"Delete": "Usuwać",
"Remove": "Usunąć",

"Upload": "Wgrywać"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/backend.ai-ui/src/locale/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Updated": "Atualizado",
"Version": "Versão"
},

"comp:BAIArtifactTable": {
"Action": "Ação",
"PullLatestVersion": "Puxe a versão mais recente",
Expand Down Expand Up @@ -121,7 +122,6 @@
"general": {
"NSelected": "{{count}} selecionado",
"TotalItems": "Total {{total}} itens",

"button": {
"Cancel": "Cancelar",
"Close": "Fechar",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend.ai-ui/src/locale/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Updated": "Atualizado",
"Version": "Versão"
},

"comp:BAIArtifactTable": {
"Action": "Ação",
"PullLatestVersion": "Puxe a versão mais recente",
Expand Down Expand Up @@ -122,7 +123,6 @@
"general": {
"NSelected": "{{count}} selecionado",
"TotalItems": "Total {{total}} itens",

"button": {
"Cancel": "Cancelar",
"Close": "Fechar",
Expand Down
1 change: 0 additions & 1 deletion packages/backend.ai-ui/src/locale/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
"general": {
"NSelected": "{{count}} выбрал",
"TotalItems": "Total {{total}} элементы",

"button": {
"Cancel": "Отмена",
"Close": "Закрывать",
Expand Down
1 change: 0 additions & 1 deletion packages/backend.ai-ui/src/locale/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
"general": {
"NSelected": "{{count}} เลือก",
"TotalItems": "รวม {{total}} รายการ",

"button": {
"Cancel": "ยกเลิก",
"Close": "ปิด",
Expand Down
1 change: 0 additions & 1 deletion packages/backend.ai-ui/src/locale/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
"general": {
"NSelected": "{{count}} seçildi",
"TotalItems": "Total {{total}} öğeleri",

"button": {
"Cancel": "İptal etmek",
"Close": "Kapalı",
Expand Down
1 change: 0 additions & 1 deletion packages/backend.ai-ui/src/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
"general": {
"NSelected": "{{count}}选择",
"TotalItems": "总计{{total}}项目",

"button": {
"Cancel": "取消",
"Close": "关闭",
Expand Down
1 change: 1 addition & 0 deletions packages/backend.ai-ui/src/locale/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Updated": "更新",
"Version": "版本"
},

"comp:BAIArtifactTable": {
"Action": "行動",
"PullLatestVersion": "拉最新版本",
Expand Down
30 changes: 29 additions & 1 deletion react/src/pages/ReservoirArtifactDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import BAIFetchKeyButton from 'src/components/BAIFetchKeyButton';
import BAIText from 'src/components/BAIText';
import { INITIAL_FETCH_KEY, useUpdatableState } from 'src/hooks';
import { useBAIPaginationOptionStateOnSearchParam } from 'src/hooks/reactPaginationQueryOptions';
import { useSetBAINotification } from 'src/hooks/useBAINotification';
import { useDeferredQueryParams } from 'src/hooks/useDeferredQueryParams';
import { JsonParam, withDefault } from 'use-query-params';

Expand All @@ -46,6 +47,7 @@ type RevisionNode = NonNullable<
const ReservoirArtifactDetailPage = () => {
const { token } = theme.useToken();
const { t } = useTranslation();
const { upsertNotification } = useSetBAINotification();

const { artifactId } = useParams<{ artifactId: string }>();

Expand Down Expand Up @@ -516,8 +518,34 @@ const ReservoirArtifactDetailPage = () => {
selectedArtifactFrgmt={artifact ?? null}
selectedArtifactRevisionFrgmt={selectedRevisions}
open={!!artifact && !_.isEmpty(selectedRevisions)}
onOk={() => {
onOk={(_e, tasks) => {
setSelectedRevisions([]);
tasks.forEach((task) => {
upsertNotification({
message: `Pulling artifact version: ${task.version}`,
open: true,
duration: 0,
backgroundTask: {
status: 'pending',
taskId: task.taskId,
promise: null,
percent: 0,
onChange: {
resolved: (_data, _notification) => {
return {
type: 'success',
message: `Successfully pulled artifact version: ${task.version}`,
toText: 'Go to Artifact',
to: `/reservoir/${task.artifact_id}`,
};
},
rejected: (_data, _notification) => {
return 'Failed to pull artifact versions: ';
},
},
},
});
});
updateFetchKey();
}}
onCancel={() => {
Expand Down
30 changes: 29 additions & 1 deletion react/src/pages/ReservoirPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ import {
ReservoirPageQuery$variables,
} from 'src/__generated__/ReservoirPageQuery.graphql';
import BAIFetchKeyButton from 'src/components/BAIFetchKeyButton';
import { useSetBAINotification } from 'src/hooks/useBAINotification';
import { withDefault, JsonParam } from 'use-query-params';

const ReservoirPage: React.FC = () => {
const { t } = useTranslation();
const { token } = theme.useToken();
const navigate = useNavigate();
const { upsertNotification } = useSetBAINotification();

const [selectedArtifact, setSelectedArtifact] =
useState<BAIImportArtifactModalArtifactFragmentKey | null>(null);
Expand Down Expand Up @@ -325,9 +327,35 @@ const ReservoirPage: React.FC = () => {
selectedArtifactFrgmt={selectedArtifact}
selectedArtifactRevisionFrgmt={selectedRevision}
open={!!selectedArtifact && !_.isEmpty(selectedRevision)}
onOk={() => {
onOk={(_e, tasks) => {
setSelectedArtifact(null);
setSelectedRevision([]);
tasks.forEach((task) => {
upsertNotification({
message: `Pulling artifact version: ${task.version}`,
open: true,
duration: 0,
backgroundTask: {
status: 'pending',
taskId: task.taskId,
promise: null,
percent: 0,
onChange: {
resolved: (_data, _notification) => {
return {
type: 'success',
message: `Successfully pulled artifact version: ${task.version}`,
toText: 'Go to Artifact',
to: `/reservoir/${task.artifact_id}`,
};
},
rejected: (_data, _notification) => {
return 'Failed to pull artifact versions: ';
},
},
},
});
});
}}
onCancel={() => {
setSelectedArtifact(null);
Expand Down