Skip to content
Open
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
102 changes: 92 additions & 10 deletions react/src/pages/AdminModelCardListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Copyright (c) 2015-2026 Lablup Inc. All rights reserved.
*/
import type { AdminModelCardListPageBulkDeleteMutation } from '../__generated__/AdminModelCardListPageBulkDeleteMutation.graphql';
import type { AdminModelCardListPageBulkDeleteVFoldersMutation } from '../__generated__/AdminModelCardListPageBulkDeleteVFoldersMutation.graphql';
import type { AdminModelCardListPageDeleteMutation } from '../__generated__/AdminModelCardListPageDeleteMutation.graphql';
import type {
AdminModelCardListPageQuery,
Expand Down Expand Up @@ -89,6 +90,7 @@ const AdminModelCardListPage: React.FC = () => {
useState<ModelCardNode | null>(null);
const [alsoDeleteFolder, setAlsoDeleteFolder] = useState(false);
const [isBulkDeleteOpen, setIsBulkDeleteOpen] = useState(false);
const [alsoDeleteFoldersBulk, setAlsoDeleteFoldersBulk] = useState(false);
const {
baiPaginationOption,
tablePaginationOption,
Expand Down Expand Up @@ -220,6 +222,17 @@ const AdminModelCardListPage: React.FC = () => {
}
`);

const [commitBulkDeleteVFolders] =
useMutation<AdminModelCardListPageBulkDeleteVFoldersMutation>(graphql`
mutation AdminModelCardListPageBulkDeleteVFoldersMutation(
$input: BulkDeleteVFoldersV2Input!
) {
bulkDeleteVfoldersV2(input: $input) {
deletedCount
}
}
`);

const handleDeleteModelCard = (modelCard: ModelCardNode) => {
setDeletingModelCard(modelCard);
};
Expand Down Expand Up @@ -584,8 +597,21 @@ const AdminModelCardListPage: React.FC = () => {
description={t('adminModelCard.ConfirmBulkDelete', {
count: selectedModelCards.length,
})}
extraContent={
<Tooltip title={t('adminModelCard.AlsoDeleteModelFolderTooltip')}>
<Checkbox
checked={alsoDeleteFoldersBulk}
onChange={(e) => setAlsoDeleteFoldersBulk(e.target.checked)}
>
{t('adminModelCard.AlsoDeleteModelFolders')}
</Checkbox>
</Tooltip>
}
onOk={() => {
const ids = selectedModelCards.map((mc) => toLocalId(mc.id));
const vfolderIds = selectedModelCards
.map((mc) => mc.vfolderId)
.filter((id): id is string => !!id);
return new Promise<void>((resolve, reject) => {
commitBulkDeleteModelCards({
variables: { input: { ids } },
Expand All @@ -598,15 +624,68 @@ const AdminModelCardListPage: React.FC = () => {
reject();
return;
}
message.success(
t('adminModelCard.BulkDeleteCompleted', {
count: data.adminDeleteModelCardsV2.deletedCount,
}),
);
setSelectedModelCards([]);
setIsBulkDeleteOpen(false);
updateFetchKey();
resolve();

const finish = (foldersDeleted: boolean) => {
if (foldersDeleted) {
upsertNotification({
type: 'success',
message: t(
'adminModelCard.BulkDeleteModelCardsAndFoldersCompleted',
{ count: data.adminDeleteModelCardsV2.deletedCount },
),
to: {
pathname: '/admin-data',
search: new URLSearchParams({
statusCategory: 'deleted',
}).toString(),
},
toText: t('adminModelCard.GoToTrash'),
open: true,
duration: 4,
extraData: null,
});
} else {
message.success(
t('adminModelCard.BulkDeleteCompleted', {
count: data.adminDeleteModelCardsV2.deletedCount,
}),
);
}
setSelectedModelCards([]);
setIsBulkDeleteOpen(false);
setAlsoDeleteFoldersBulk(false);
updateFetchKey();
resolve();
};

if (alsoDeleteFoldersBulk && vfolderIds.length > 0) {
commitBulkDeleteVFolders({
variables: {
input: { ids: vfolderIds },
},
onCompleted: (_, folderErrors) => {
if (folderErrors && folderErrors.length > 0) {
logger.error(folderErrors[0]);
message.error(
folderErrors[0]?.message ||
t('general.ErrorOccurred'),
);
finish(false);
} else {
finish(true);
}
},
onError: (error) => {
logger.error(error);
message.error(
error?.message || t('general.ErrorOccurred'),
);
finish(false);
},
});
} else {
finish(false);
}
},
onError: (error) => {
logger.error(error);
Expand All @@ -616,7 +695,10 @@ const AdminModelCardListPage: React.FC = () => {
});
});
}}
onCancel={() => setIsBulkDeleteOpen(false)}
onCancel={() => {
setIsBulkDeleteOpen(false);
setAlsoDeleteFoldersBulk(false);
}}
/>
</BAIFlex>
);
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Etikett hinzufügen",
"AlsoDeleteModelFolder": "Zugehörigen Modellordner ebenfalls löschen",
"AlsoDeleteModelFolderTooltip": "Der Modellordner wird in den Papierkorb verschoben. Sie können ihn dauerhaft unter Daten > Papierkorb löschen.",
"AlsoDeleteModelFolders": "Zugehörige Modellordner ebenfalls löschen",
"Architecture": "Architektur",
"ArchitectureTooltip": "Die Modellarchitektur (z. B. Transformer, CNN, RNN).",
"Author": "Autor",
"AuthorTooltip": "Der Ersteller oder Betreuer des Modells.",
"BulkDeleteCompleted": "{{count}} Modellkarte(n) wurden gelöscht.",
"BulkDeleteModelCards": "Modellkarten löschen",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} Modellkarte(n) und ihre Ordner wurden in den Papierkorb verschoben.",
"Category": "Kategorien",
"CategoryPlaceholder": "z.B. LLM",
"CategoryTooltip": "Die Kategorie des Modells (z. B. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Προσθήκη ετικέτας",
"AlsoDeleteModelFolder": "Διαγραφή του συσχετισμένου φακέλου μοντέλου",
"AlsoDeleteModelFolderTooltip": "Ο φάκελος μοντέλου θα μετακινηθεί στα σκουπίδια. Μπορείτε να τον διαγράψετε οριστικά από Δεδομένα > Σκουπίδια.",
"AlsoDeleteModelFolders": "Διαγραφή των συσχετισμένων φακέλων μοντέλου",
"Architecture": "Αρχιτεκτονική",
"ArchitectureTooltip": "Η αρχιτεκτονική μοντέλου (π.χ. Transformer, CNN, RNN).",
"Author": "Συγγραφέας",
"AuthorTooltip": "Ο δημιουργός ή συντηρητής του μοντέλου.",
"BulkDeleteCompleted": "Διαγράφηκαν {{count}} κάρτα(ες) μοντέλου.",
"BulkDeleteModelCards": "Διαγραφή καρτών μοντέλου",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} κάρτα(ες) μοντέλου και οι φάκελοί τους έχουν μετακινηθεί στα σκουπίδια.",
"Category": "Κατηγορίες",
"CategoryPlaceholder": "π.χ., LLM",
"CategoryTooltip": "Η κατηγορία του μοντέλου (π.χ. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Add label",
"AlsoDeleteModelFolder": "Also delete the associated model folder",
"AlsoDeleteModelFolderTooltip": "The model folder will be moved to trash. You can permanently delete it from Data > Trash.",
"AlsoDeleteModelFolders": "Also delete the associated model folders",
"Architecture": "Architecture",
"ArchitectureTooltip": "The model architecture (e.g., Transformer, CNN, RNN).",
"Author": "Author",
"AuthorTooltip": "The creator or maintainer of the model.",
"BulkDeleteCompleted": "{{count}} model card(s) have been deleted.",
"BulkDeleteModelCards": "Delete Model Cards",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} model card(s) and their folders have been moved to trash.",
"Category": "Category",
"CategoryPlaceholder": "e.g., LLM",
"CategoryTooltip": "The category of the model (e.g., LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Agregar etiqueta",
"AlsoDeleteModelFolder": "Eliminar también la carpeta del modelo asociada",
"AlsoDeleteModelFolderTooltip": "La carpeta del modelo se moverá a la papelera. Puede eliminarla permanentemente desde Datos > Papelera.",
"AlsoDeleteModelFolders": "Eliminar también las carpetas del modelo asociadas",
"Architecture": "Arquitectura",
"ArchitectureTooltip": "La arquitectura del modelo (p. ej., Transformer, CNN, RNN).",
"Author": "Autor",
"AuthorTooltip": "El creador o mantenedor del modelo.",
"BulkDeleteCompleted": "Se han eliminado {{count}} tarjeta(s) de modelo.",
"BulkDeleteModelCards": "Eliminar tarjetas de modelo",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} tarjeta(s) de modelo y sus carpetas se han movido a la papelera.",
"Category": "Categorías",
"CategoryPlaceholder": "ej., LLM",
"CategoryTooltip": "La categoría del modelo (p. ej., LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Lisää tunniste",
"AlsoDeleteModelFolder": "Poista myös siihen liittyvä mallinkansio",
"AlsoDeleteModelFolderTooltip": "Mallinkansio siirretään roskakoriin. Voit poistaa sen pysyvästi kohdasta Data > Roskat.",
"AlsoDeleteModelFolders": "Poista myös niihin liittyvät mallikansiot",
"Architecture": "Arkkitehtuuri",
"ArchitectureTooltip": "Malliarkkitehtuuri (esim. Transformer, CNN, RNN).",
"Author": "Tekijä",
"AuthorTooltip": "Mallin luoja tai ylläpitäjä.",
"BulkDeleteCompleted": "{{count}} mallikortti(a) on poistettu.",
"BulkDeleteModelCards": "Poista mallikortit",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} mallikortti(a) ja niiden kansiot on siirretty roskakoriin.",
"Category": "Kategoria",
"CategoryPlaceholder": "esim. LLM",
"CategoryTooltip": "Mallin kategoria (esim. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Ajouter une étiquette",
"AlsoDeleteModelFolder": "Supprimer également le dossier de modèle associé",
"AlsoDeleteModelFolderTooltip": "Le dossier de modèle sera déplacé vers la poubelle. Vous pouvez le supprimer définitivement depuis Données > Poubelle.",
"AlsoDeleteModelFolders": "Supprimer également les dossiers de modèle associés",
"Architecture": "Architecture",
"ArchitectureTooltip": "L'architecture du modèle (ex. : Transformer, CNN, RNN).",
"Author": "Auteur",
"AuthorTooltip": "Le créateur ou le mainteneur du modèle.",
"BulkDeleteCompleted": "{{count}} fiche(s) modèle ont été supprimées.",
"BulkDeleteModelCards": "Supprimer les fiches modèle",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} fiche(s) modèle et leurs dossiers ont été déplacés vers la poubelle.",
"Category": "Catégorie",
"CategoryPlaceholder": "ex. LLM",
"CategoryTooltip": "La catégorie du modèle (ex. : LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Tambah label",
"AlsoDeleteModelFolder": "Hapus juga folder model yang terkait",
"AlsoDeleteModelFolderTooltip": "Folder model akan dipindahkan ke tempat sampah. Anda dapat menghapusnya secara permanen dari Data > Sampah.",
"AlsoDeleteModelFolders": "Hapus juga folder-folder model yang terkait",
"Architecture": "Arsitektur",
"ArchitectureTooltip": "Arsitektur model (mis. Transformer, CNN, RNN).",
"Author": "Pengarang",
"AuthorTooltip": "Pencipta atau pemelihara model.",
"BulkDeleteCompleted": "{{count}} kartu model telah dihapus.",
"BulkDeleteModelCards": "Hapus kartu model",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} kartu model dan folder-foldernya telah dipindahkan ke tempat sampah.",
"Category": "Kategori",
"CategoryPlaceholder": "mis., LLM",
"CategoryTooltip": "Kategori model (mis. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Aggiungi etichetta",
"AlsoDeleteModelFolder": "Elimina anche la cartella del modello associata",
"AlsoDeleteModelFolderTooltip": "La cartella del modello verrà spostata nel cestino. Puoi eliminarla definitivamente da Dati > Rifiuti.",
"AlsoDeleteModelFolders": "Elimina anche le cartelle del modello associate",
"Architecture": "Architettura",
"ArchitectureTooltip": "L'architettura del modello (es. Transformer, CNN, RNN).",
"Author": "Autore",
"AuthorTooltip": "Il creatore o il manutentore del modello.",
"BulkDeleteCompleted": "{{count}} scheda/e modello sono state eliminate.",
"BulkDeleteModelCards": "Elimina schede modello",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} scheda/e modello e le relative cartelle sono state spostate nel cestino.",
"Category": "Categorie",
"CategoryPlaceholder": "es. LLM",
"CategoryTooltip": "La categoria del modello (es. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "ラベルを追加",
"AlsoDeleteModelFolder": "関連するモデルフォルダも削除する",
"AlsoDeleteModelFolderTooltip": "モデルフォルダはゴミ箱に移動されます。データ > ゴミ箱から完全に削除できます。",
"AlsoDeleteModelFolders": "関連するモデルフォルダをすべて削除する",
"Architecture": "アーキテクチャ",
"ArchitectureTooltip": "モデルのアーキテクチャです (例: Transformer, CNN, RNN)。",
"Author": "著者",
"AuthorTooltip": "モデルの作成者またはメンテナーです。",
"BulkDeleteCompleted": "{{count}}件のモデルカードが削除されました。",
"BulkDeleteModelCards": "モデルカードを削除",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}}件のモデルカードとそのフォルダがゴミ箱に移動されました。",
"Category": "カテゴリー",
"CategoryPlaceholder": "例: LLM",
"CategoryTooltip": "モデルのカテゴリです (例: LLM, Vision, Audio)。",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "레이블 추가",
"AlsoDeleteModelFolder": "연결된 모델 폴더도 함께 삭제",
"AlsoDeleteModelFolderTooltip": "모델 폴더가 휴지통으로 이동됩니다. 데이터 > 휴지통에서 영구적으로 삭제할 수 있습니다.",
"AlsoDeleteModelFolders": "연결된 모델 폴더도 함께 삭제",
"Architecture": "아키텍처",
"ArchitectureTooltip": "모델 아키텍처입니다 (예: Transformer, CNN, RNN).",
"Author": "작가",
"AuthorTooltip": "모델의 생성자 또는 관리자입니다.",
"BulkDeleteCompleted": "{{count}}개의 모델 카드가 삭제되었습니다.",
"BulkDeleteModelCards": "모델 카드 삭제",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}}개의 모델 카드와 폴더가 휴지통으로 이동되었습니다.",
"Category": "카테고리",
"CategoryPlaceholder": "예: LLM",
"CategoryTooltip": "모델의 카테고리입니다 (예: LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/mn.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Шошго нэмэх",
"AlsoDeleteModelFolder": "Холбогдох загварын хавтасыг мөн устгах",
"AlsoDeleteModelFolderTooltip": "Загварын хавтас хогийн савд шилжинэ. Дата > Хог хэсгээс байнгын устгах боломжтой.",
"AlsoDeleteModelFolders": "Холбогдох загварын хавтасуудыг мөн устгах",
"Architecture": "Архитектур",
"ArchitectureTooltip": "Загварын архитектур (жнь. Transformer, CNN, RNN).",
"Author": "Зохиогч",
"AuthorTooltip": "Загварын зохиогч эсвэл хариуцагч.",
"BulkDeleteCompleted": "{{count}} загварын карт устгагдлаа.",
"BulkDeleteModelCards": "Загварын картуудыг устгах",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} загварын карт болон тэдгээрийн хавтасууд хогийн савд шилжсэн.",
"Category": "ангилал",
"CategoryPlaceholder": "жнь: LLM",
"CategoryTooltip": "Загварын ангилал (жнь. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Tambah label",
"AlsoDeleteModelFolder": "Padamkan juga folder model yang berkaitan",
"AlsoDeleteModelFolderTooltip": "Folder model akan dipindahkan ke tong sampah. Anda boleh memadamnya secara kekal dari Data > Sampah.",
"AlsoDeleteModelFolders": "Padamkan juga folder-folder model yang berkaitan",
"Architecture": "Seni bina",
"ArchitectureTooltip": "Seni bina model (cth., Transformer, CNN, RNN).",
"Author": "Pengarang",
"AuthorTooltip": "Pencipta atau penyelenggara model.",
"BulkDeleteCompleted": "{{count}} kad model telah dipadam.",
"BulkDeleteModelCards": "Padam kad model",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} kad model dan folder-foldernya telah dipindahkan ke tong sampah.",
"Category": "kategori",
"CategoryPlaceholder": "cth., LLM",
"CategoryTooltip": "Kategori model (cth., LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Dodaj etykietę",
"AlsoDeleteModelFolder": "Usuń również powiązany folder modelu",
"AlsoDeleteModelFolderTooltip": "Folder modelu zostanie przeniesiony do kosza. Możesz go trwale usunąć w sekcji Dane > Śmieci.",
"AlsoDeleteModelFolders": "Usuń również powiązane foldery modelu",
"Architecture": "Architektura",
"ArchitectureTooltip": "Architektura modelu (np. Transformer, CNN, RNN).",
"Author": "Autor",
"AuthorTooltip": "Twórca lub opiekun modelu.",
"BulkDeleteCompleted": "Usunięto {{count}} kartę/karty modelu.",
"BulkDeleteModelCards": "Usuń karty modelu",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} karta/karty modelu i ich foldery zostały przeniesione do kosza.",
"Category": "Kategoria",
"CategoryPlaceholder": "np. LLM",
"CategoryTooltip": "Kategoria modelu (np. LLM, Vision, Audio).",
Expand Down
2 changes: 2 additions & 0 deletions resources/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"AddLabel": "Adicionar rótulo",
"AlsoDeleteModelFolder": "Excluir também a pasta do modelo associada",
"AlsoDeleteModelFolderTooltip": "A pasta do modelo será movida para a lixeira. Você pode excluí-la permanentemente em Dados > Lixo.",
"AlsoDeleteModelFolders": "Excluir também as pastas do modelo associadas",
"Architecture": "Arquitetura",
"ArchitectureTooltip": "A arquitetura do modelo (ex.: Transformer, CNN, RNN).",
"Author": "Autor",
"AuthorTooltip": "O criador ou mantenedor do modelo.",
"BulkDeleteCompleted": "{{count}} cartão(ões) de modelo foram excluídos.",
"BulkDeleteModelCards": "Excluir cartões de modelo",
"BulkDeleteModelCardsAndFoldersCompleted": "{{count}} cartão(ões) de modelo e suas pastas foram movidos para a lixeira.",
"Category": "Categoria",
"CategoryPlaceholder": "ex., LLM",
"CategoryTooltip": "A categoria do modelo (ex.: LLM, Vision, Audio).",
Expand Down
Loading
Loading