diff --git a/react/src/components/ContainerRegistryList.tsx b/react/src/components/ContainerRegistryList.tsx index d54f66b38..e5d0b285b 100644 --- a/react/src/components/ContainerRegistryList.tsx +++ b/react/src/components/ContainerRegistryList.tsx @@ -246,7 +246,11 @@ const ContainerRegistryList: React.FC<{ direction="row" justify="end" gap={'sm'} - style={{ padding: token.paddingSM }} + style={{ + padding: token.paddingContentVertical, + paddingLeft: token.paddingContentHorizontalSM, + paddingRight: token.paddingContentHorizontalSM, + }} > + + + localeCompare(a.name, b.name), + }, + { + title: t('resourcePreset.Resources'), + dataIndex: 'resource_slots', + render: (text) => ( + + {!_.isEmpty(text) + ? _.map(JSON.parse(text), (value, key) => ( + + )) + : '-'} + + ), + }, + { + title: t('resourcePreset.SharedMemory'), + dataIndex: 'shared_memory', + render: (text) => + text ? iSizeToSize(text + '', 'g')?.number : '-', + sorter: (a, b) => a.shared_memory - b.shared_memory, + }, + { + title: t('general.Control'), + key: 'control', + fixed: 'right', + render: (text, record) => ( + + + + + // @ts-ignore + iSizeToSize('300p', 'p').number + ) { + return Promise.reject( + new Error( + 'Memory size should be less than 300 PiB', + ), + ); + } + return Promise.resolve(); + }, + }, + ]} + > + {_.includes(resourceSlotKey, 'mem') ? ( + + ) : ( + + )} + + + ))} + + ), + )} + + ({ + validator(__, value) { + if ( + value && + getFieldValue('resource_slots')?.mem && + (iSizeToSize(getFieldValue('resource_slots')?.mem, 'b') + ?.number ?? 0) < + (iSizeToSize(value, 'b')?.number ?? 0) + ) { + return Promise.reject( + t('resourcePreset.MemoryShouldBeLargerThanSHMEM'), + ); + } + return Promise.resolve(); + }, + }), + ]} + > + + + + + + + + ); +}; + +export default ResourcePresetSettingModal; diff --git a/react/src/pages/EnvironmentPage.tsx b/react/src/pages/EnvironmentPage.tsx index 4fc270ee1..c9477709b 100644 --- a/react/src/pages/EnvironmentPage.tsx +++ b/react/src/pages/EnvironmentPage.tsx @@ -1,9 +1,7 @@ import ContainerRegistryList from '../components/ContainerRegistryList'; -import Flex from '../components/Flex'; import FlexActivityIndicator from '../components/FlexActivityIndicator'; -import ImageList from '../components/ImageList'; +import ResourcePresetList from '../components/ResourcePresetList'; import { useSuspendedBackendaiClient } from '../hooks'; -import { theme } from 'antd'; import Card from 'antd/es/card/Card'; import { Suspense } from 'react'; import { useTranslation } from 'react-i18next'; @@ -18,7 +16,6 @@ const EnvironmentPage = () => { const isSupportContainerRegistryGraphQL = baiClient.supports( 'container-registry-gql', ); - const { token } = theme.useToken(); return ( { }, }} > - {curTabKey === 'image' ? ( - - } - > - - - ) : null} - - {/* @ts-ignore */} - - - - - {isSupportContainerRegistryGraphQL ? ( - curTabKey === 'registry' ? ( - - - - ) : null - ) : ( + }> + {curTabKey === 'image' ? ( // @ts-ignore - - )} - + + ) : null} + {curTabKey === 'preset' && } + {curTabKey === 'registry' ? ( + isSupportContainerRegistryGraphQL ? ( + + ) : ( + // @ts-ignore + + ) + ) : null} + ); }; diff --git a/resources/i18n/de.json b/resources/i18n/de.json index 2d284cb77..35eb0a2bb 100644 --- a/resources/i18n/de.json +++ b/resources/i18n/de.json @@ -876,7 +876,9 @@ "SharedMemory": "Gemeinsamer Speicher (GB)", "NoResourcePresetToDisplay": "Keine Ressourcenvoreinstellungen anzeigen", "Deleted": "Die Ressourcenvoreinstellung wurde erfolgreich gelöscht.", - "SHMEMShouldBeSmallerThanMemory": "Gemeinsamer Speicher muss kleiner sein als der Speicher" + "SHMEMShouldBeSmallerThanMemory": "Gemeinsamer Speicher muss kleiner sein als der Speicher", + "DeleteResourcePreset": "Ressourcenvoreinstellung löschen", + "PresetNameAlreadyExists": "Eine Ressourcenvoreinstellung mit demselben Namen ist bereits vorhanden." }, "usersettings": { "General": "Allgemeines", diff --git a/resources/i18n/el.json b/resources/i18n/el.json index c91dce2f3..235b5c33c 100644 --- a/resources/i18n/el.json +++ b/resources/i18n/el.json @@ -876,7 +876,9 @@ "SharedMemory": "Κοινή μνήμη (GB)", "NoResourcePresetToDisplay": "Δεν εμφανίζονται Προεπιλογές πόρων", "Deleted": "Η προεπιλογή πόρων διαγράφηκε επιτυχώς.", - "SHMEMShouldBeSmallerThanMemory": "Η κοινόχρηστη μνήμη πρέπει να είναι μικρότερη από τη μνήμη" + "SHMEMShouldBeSmallerThanMemory": "Η κοινόχρηστη μνήμη πρέπει να είναι μικρότερη από τη μνήμη", + "DeleteResourcePreset": "Διαγραφή προκαθορισμένων πόρων", + "PresetNameAlreadyExists": "Υπάρχει ήδη μια προεπιλογή πόρων με το ίδιο όνομα." }, "usersettings": { "General": "Γενικός", diff --git a/resources/i18n/en.json b/resources/i18n/en.json index 5429140a9..00d39bb24 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -976,9 +976,9 @@ "ModifyImageResourceLimitReinstallRequired": "

If you modify an image that has already been installed, you will need to reinstall the image.

Modifications will not be applied until the image is reinstalled. \n

", "NoImagesAreSelected": "No images are selected", "AlreadyInstalledImage": "Already installed image", - "InstalledImagesAreExcluded": "Installed images are excluded." , + "InstalledImagesAreExcluded": "Installed images are excluded.", "CheckImageInstallation": "Installing an image?", - "SearchImages":"Search images" + "SearchImages": "Search images" }, "resourcePreset": { "ResourcePresets": "Resource Presets", @@ -1001,7 +1001,9 @@ "MinimumShmemUnit": "The minimum unit for shared memory is 0.01 GB.", "RAM": "RAM (GB)", "SharedMemory": "Shared memory (GB)", - "SHMEMShouldBeSmallerThanMemory": "Shared memory must be smaller than memory" + "SHMEMShouldBeSmallerThanMemory": "Shared memory must be smaller than memory", + "DeleteResourcePreset": "Delete resource preset", + "PresetNameAlreadyExists": "A resource preset with the same name already exists." }, "usersettings": { "General": "General", diff --git a/resources/i18n/es.json b/resources/i18n/es.json index 51bd064a6..ca2140a81 100644 --- a/resources/i18n/es.json +++ b/resources/i18n/es.json @@ -983,7 +983,9 @@ "Resources": "Recursos", "SharedMemory": "Memoria compartida (GB)", "Updated": "Preajuste de recursos actualizado", - "SHMEMShouldBeSmallerThanMemory": "La memoria compartida debe ser menor que la memoria" + "SHMEMShouldBeSmallerThanMemory": "La memoria compartida debe ser menor que la memoria", + "DeleteResourcePreset": "Eliminar recurso preestablecido", + "PresetNameAlreadyExists": "Ya existe un recurso preestablecido con el mismo nombre." }, "session": { "Agent": "Agente", diff --git a/resources/i18n/fi.json b/resources/i18n/fi.json index f45159752..a4f6db416 100644 --- a/resources/i18n/fi.json +++ b/resources/i18n/fi.json @@ -980,7 +980,9 @@ "Resources": "Resurssit", "SharedMemory": "Jaettu muisti (GB)", "Updated": "Resurssien esiasetus päivitetty", - "SHMEMShouldBeSmallerThanMemory": "Jaetun muistin on oltava pienempi kuin muistin" + "SHMEMShouldBeSmallerThanMemory": "Jaetun muistin on oltava pienempi kuin muistin", + "DeleteResourcePreset": "Poista resurssin esiasetus", + "PresetNameAlreadyExists": "Resurssin esiasetus samalla nimellä on jo olemassa." }, "session": { "Agent": "Agentti", diff --git a/resources/i18n/fr.json b/resources/i18n/fr.json index a1edfb1e7..a7b99be9f 100644 --- a/resources/i18n/fr.json +++ b/resources/i18n/fr.json @@ -876,7 +876,9 @@ "SharedMemory": "Mémoire partagée (Go)", "Deleted": "Le préréglage des ressources a été supprimé avec succès.", "NoResourcePresetToDisplay": "Pas de préréglages de ressources à afficher", - "SHMEMShouldBeSmallerThanMemory": "La mémoire partagée doit être plus petite que la mémoire" + "SHMEMShouldBeSmallerThanMemory": "La mémoire partagée doit être plus petite que la mémoire", + "DeleteResourcePreset": "Supprimer le préréglage de ressources", + "PresetNameAlreadyExists": "Un préréglage de ressources portant le même nom existe déjà." }, "usersettings": { "General": "Général", diff --git a/resources/i18n/id.json b/resources/i18n/id.json index d4879b218..5ea70de44 100644 --- a/resources/i18n/id.json +++ b/resources/i18n/id.json @@ -877,7 +877,9 @@ "SharedMemory": "Memori bersama (GB)", "Deleted": "Preset sumber daya berhasil dihapus.", "NoResourcePresetToDisplay": "Tidak ada Preset Sumber Daya yang akan ditampilkan", - "SHMEMShouldBeSmallerThanMemory": "Memori bersama harus lebih kecil dari memori" + "SHMEMShouldBeSmallerThanMemory": "Memori bersama harus lebih kecil dari memori", + "DeleteResourcePreset": "Hapus preset sumber daya", + "PresetNameAlreadyExists": "Prasetel sumber daya dengan nama yang sama sudah ada." }, "usersettings": { "General": "Umum", diff --git a/resources/i18n/it.json b/resources/i18n/it.json index e494f1033..a1377c705 100644 --- a/resources/i18n/it.json +++ b/resources/i18n/it.json @@ -877,7 +877,9 @@ "SharedMemory": "Memoria condivisa (GB)", "NoResourcePresetToDisplay": "Nessuna preimpostazione di risorse da visualizzare", "Deleted": "La preimpostazione della risorsa è stata eliminata con successo.", - "SHMEMShouldBeSmallerThanMemory": "La memoria condivisa deve essere più piccola della memoria" + "SHMEMShouldBeSmallerThanMemory": "La memoria condivisa deve essere più piccola della memoria", + "DeleteResourcePreset": "Elimina la preimpostazione della risorsa", + "PresetNameAlreadyExists": "Esiste già una risorsa preimpostata con lo stesso nome." }, "usersettings": { "General": "Generale", diff --git a/resources/i18n/ja.json b/resources/i18n/ja.json index f659204e0..402005462 100644 --- a/resources/i18n/ja.json +++ b/resources/i18n/ja.json @@ -876,7 +876,9 @@ "SharedMemory": "共有メモリ(GB)", "NoResourcePresetToDisplay": "リソースプリセット情報がありません。", "Deleted": "リソースプリセットの削除に成功しました", - "SHMEMShouldBeSmallerThanMemory": "共有メモリはメモリより小さくなければならない" + "SHMEMShouldBeSmallerThanMemory": "共有メモリはメモリより小さくなければならない", + "DeleteResourcePreset": "リソースプリセットの削除", + "PresetNameAlreadyExists": "同じ名前のリソース プリセットがすでに存在します。" }, "usersettings": { "General": "一般", diff --git a/resources/i18n/ko.json b/resources/i18n/ko.json index 0027fd1ec..68393662e 100644 --- a/resources/i18n/ko.json +++ b/resources/i18n/ko.json @@ -961,11 +961,11 @@ "DescImageResourceModified": "리소스 제한이 수정되었습니다.", "DescImagePortsModified": "이미지 포트가 수정되었습니다.", "ModifyImageResourceLimitReinstallRequired": "

이미 설치된 이미지를 수정하는 경우, 이미지 재설치가 필요합니다.

<

수정내용은 이미지가 재설치되기 전까지 적용되지 않습니다.

", - "NoImagesAreSelected":"선택된 이미지가 없습니다.", - "AlreadyInstalledImage":"이미 설치된 이미지입니다.", - "InstalledImagesAreExcluded":"설치된 이미지는 제외되었습니다.", - "CheckImageInstallation":"다음 이미지를 설치하시겠습니까?", - "SearchImages":"이미지 검색" + "NoImagesAreSelected": "선택된 이미지가 없습니다.", + "AlreadyInstalledImage": "이미 설치된 이미지입니다.", + "InstalledImagesAreExcluded": "설치된 이미지는 제외되었습니다.", + "CheckImageInstallation": "다음 이미지를 설치하시겠습니까?", + "SearchImages": "이미지 검색" }, "resourcePreset": { "ResourcePresets": "자원 프리셋", @@ -988,7 +988,9 @@ "MinimumShmemUnit": "공유메모리 최소 단위는 0.01 GB 입니다.", "RAM": "메모리 (GB)", "SharedMemory": "공유메모리 (GB)", - "Deleted": "자원 프리셋을 성공적으로 삭제하였습니다" + "Deleted": "자원 프리셋을 성공적으로 삭제하였습니다", + "DeleteResourcePreset": "자원 프리셋 삭제", + "PresetNameAlreadyExists": "동일한 이름의 자원 프리셋이 이미 존재합니다." }, "usersettings": { "General": "일반", @@ -1680,4 +1682,4 @@ "SelectEndpoint": "엔드포인트 선택", "SyncInput": "입력 연동" } -} \ No newline at end of file +} diff --git a/resources/i18n/mn.json b/resources/i18n/mn.json index 722a27708..8f0a346b1 100644 --- a/resources/i18n/mn.json +++ b/resources/i18n/mn.json @@ -878,7 +878,9 @@ "SharedMemory": "Хуваалцсан санах ой (GB)", "Deleted": "Нөөцийн урьдчилсан тохируулгыг амжилттай устгалаа.", "NoResourcePresetToDisplay": "Харуулах нөөцийн урьдчилсан тохиргоо байхгүй", - "SHMEMShouldBeSmallerThanMemory": "Хуваалцсан санах ой санах ойноос бага байх ёстой" + "SHMEMShouldBeSmallerThanMemory": "Хуваалцсан санах ой санах ойноос бага байх ёстой", + "DeleteResourcePreset": "Урьдчилсан нөөцийг устгах", + "PresetNameAlreadyExists": "Ижил нэртэй нөөцийн урьдчилсан тохируулга аль хэдийн байна." }, "usersettings": { "General": "Ерөнхий", diff --git a/resources/i18n/ms.json b/resources/i18n/ms.json index 1f27cce33..aa5371583 100644 --- a/resources/i18n/ms.json +++ b/resources/i18n/ms.json @@ -876,7 +876,9 @@ "SharedMemory": "Memori bersama (GB)", "NoResourcePresetToDisplay": "Tiada Pratetap Sumber untuk dipaparkan", "Deleted": "Pratetap sumber berjaya dipadamkan.", - "SHMEMShouldBeSmallerThanMemory": "Memori yang dikongsi mestilah lebih kecil daripada memori" + "SHMEMShouldBeSmallerThanMemory": "Memori yang dikongsi mestilah lebih kecil daripada memori", + "DeleteResourcePreset": "Padamkan pratetap sumber", + "PresetNameAlreadyExists": "Pratetap sumber dengan nama yang sama sudah wujud." }, "usersettings": { "General": "Am", diff --git a/resources/i18n/pl.json b/resources/i18n/pl.json index ad8520837..6cde4ea30 100644 --- a/resources/i18n/pl.json +++ b/resources/i18n/pl.json @@ -876,7 +876,9 @@ "SharedMemory": "Pamięć współdzielona (GB)", "NoResourcePresetToDisplay": "Brak ustawień wstępnych zasobów do wyświetlenia", "Deleted": "Ustawienie wstępne zasobu zostało pomyślnie usunięte.", - "SHMEMShouldBeSmallerThanMemory": "Pamięć współdzielona musi być mniejsza niż pamięć" + "SHMEMShouldBeSmallerThanMemory": "Pamięć współdzielona musi być mniejsza niż pamięć", + "DeleteResourcePreset": "Usuń ustawienie wstępne zasobu", + "PresetNameAlreadyExists": "Wstępne ustawienie zasobu o tej samej nazwie już istnieje." }, "usersettings": { "General": "Generał", diff --git a/resources/i18n/pt-BR.json b/resources/i18n/pt-BR.json index 9937fad53..5485ecf25 100644 --- a/resources/i18n/pt-BR.json +++ b/resources/i18n/pt-BR.json @@ -876,7 +876,9 @@ "SharedMemory": "Memória compartilhada (GB)", "NoResourcePresetToDisplay": "Não há predefinições de recursos a apresentar", "Deleted": "A predefinição de recurso foi eliminada com êxito.", - "SHMEMShouldBeSmallerThanMemory": "A memória partilhada deve ser mais pequena do que a memória" + "SHMEMShouldBeSmallerThanMemory": "A memória partilhada deve ser mais pequena do que a memória", + "DeleteResourcePreset": "Excluir predefinição de recurso", + "PresetNameAlreadyExists": "Já existe uma predefinição de recurso com o mesmo nome." }, "usersettings": { "General": "Em geral", diff --git a/resources/i18n/pt.json b/resources/i18n/pt.json index 296f05a85..a297f8013 100644 --- a/resources/i18n/pt.json +++ b/resources/i18n/pt.json @@ -876,7 +876,9 @@ "SharedMemory": "Memória compartilhada (GB)", "NoResourcePresetToDisplay": "Não há predefinições de recursos a apresentar", "Deleted": "A predefinição de recurso foi eliminada com êxito.", - "SHMEMShouldBeSmallerThanMemory": "A memória partilhada deve ser mais pequena do que a memória" + "SHMEMShouldBeSmallerThanMemory": "A memória partilhada deve ser mais pequena do que a memória", + "DeleteResourcePreset": "Excluir predefinição de recurso", + "PresetNameAlreadyExists": "Já existe uma predefinição de recurso com o mesmo nome." }, "usersettings": { "General": "Em geral", diff --git a/resources/i18n/ru.json b/resources/i18n/ru.json index f16656d22..c2a77e43f 100644 --- a/resources/i18n/ru.json +++ b/resources/i18n/ru.json @@ -876,7 +876,9 @@ "SharedMemory": "Общая память (ГБ)", "Deleted": "Предварительная настройка ресурса успешно удалена.", "NoResourcePresetToDisplay": "Отсутствие отображения предустановок ресурсов", - "SHMEMShouldBeSmallerThanMemory": "Общая память должна быть меньше памяти" + "SHMEMShouldBeSmallerThanMemory": "Общая память должна быть меньше памяти", + "DeleteResourcePreset": "Удалить набор ресурсов", + "PresetNameAlreadyExists": "Предустановка ресурса с таким именем уже существует." }, "usersettings": { "General": "Общий", diff --git a/resources/i18n/th.json b/resources/i18n/th.json index cff23542d..1ead62aad 100644 --- a/resources/i18n/th.json +++ b/resources/i18n/th.json @@ -996,7 +996,9 @@ "MinimumShmemUnit": "หน่วยต่ำสุดสำหรับหน่วยความจำร่วมคือ 0.01 GB", "RAM": "RAM (GB)", "SharedMemory": "หน่วยความจำร่วม (GB)", - "SHMEMShouldBeSmallerThanMemory": "หน่วยความจำร่วมต้องน้อยกว่าหน่วยความจำ" + "SHMEMShouldBeSmallerThanMemory": "หน่วยความจำร่วมต้องน้อยกว่าหน่วยความจำ", + "DeleteResourcePreset": "ลบการตั้งค่าทรัพยากรล่วงหน้า", + "PresetNameAlreadyExists": "มีทรัพยากรที่ตั้งไว้ล่วงหน้าซึ่งมีชื่อเดียวกันอยู่แล้ว" }, "usersettings": { "General": "ทั่วไป", diff --git a/resources/i18n/tr.json b/resources/i18n/tr.json index 00b18a17f..f8f7e187a 100644 --- a/resources/i18n/tr.json +++ b/resources/i18n/tr.json @@ -876,7 +876,9 @@ "SharedMemory": "Paylaşılan bellek (GB)", "NoResourcePresetToDisplay": "Görüntülenecek Kaynak Ön Ayarı yok", "Deleted": "Kaynak ön ayarı başarıyla silindi.", - "SHMEMShouldBeSmallerThanMemory": "Paylaşılan bellek, bellekten daha küçük olmalıdır" + "SHMEMShouldBeSmallerThanMemory": "Paylaşılan bellek, bellekten daha küçük olmalıdır", + "DeleteResourcePreset": "Kaynak ön ayarını sil", + "PresetNameAlreadyExists": "Aynı ada sahip bir kaynak ön ayarı zaten mevcut." }, "usersettings": { "General": "Genel", diff --git a/resources/i18n/vi.json b/resources/i18n/vi.json index de70f850e..c8dd813ed 100644 --- a/resources/i18n/vi.json +++ b/resources/i18n/vi.json @@ -876,7 +876,9 @@ "SharedMemory": "Bộ nhớ dùng chung (GB)", "NoResourcePresetToDisplay": "Không có cài đặt trước tài nguyên nào để hiển thị", "Deleted": "Cài đặt trước tài nguyên đã được xóa thành công.", - "SHMEMShouldBeSmallerThanMemory": "Bộ nhớ dùng chung phải nhỏ hơn bộ nhớ" + "SHMEMShouldBeSmallerThanMemory": "Bộ nhớ dùng chung phải nhỏ hơn bộ nhớ", + "DeleteResourcePreset": "Xóa cài đặt trước tài nguyên", + "PresetNameAlreadyExists": "Đã tồn tại một tài nguyên đặt trước có cùng tên." }, "usersettings": { "General": "Chung", diff --git a/resources/i18n/zh-CN.json b/resources/i18n/zh-CN.json index 2490cfeac..b8e4317ce 100644 --- a/resources/i18n/zh-CN.json +++ b/resources/i18n/zh-CN.json @@ -876,7 +876,9 @@ "SharedMemory": "共享内存 (GB)", "NoResourcePresetToDisplay": "无资源预置显示", "Deleted": "资源预置已成功删除。", - "SHMEMShouldBeSmallerThanMemory": "共享内存必须小于内存" + "SHMEMShouldBeSmallerThanMemory": "共享内存必须小于内存", + "DeleteResourcePreset": "删除资源预设", + "PresetNameAlreadyExists": "已存在同名的资源预设。" }, "usersettings": { "General": "一般的", diff --git a/resources/i18n/zh-TW.json b/resources/i18n/zh-TW.json index 7ae505e75..745776ec6 100644 --- a/resources/i18n/zh-TW.json +++ b/resources/i18n/zh-TW.json @@ -875,7 +875,9 @@ "SharedMemory": "共享內存 (GB)", "NoResourcePresetToDisplay": "无资源预置显示", "Deleted": "资源预置已成功删除。", - "SHMEMShouldBeSmallerThanMemory": "共享内存必须小于内存" + "SHMEMShouldBeSmallerThanMemory": "共享内存必须小于内存", + "DeleteResourcePreset": "刪除資源預設", + "PresetNameAlreadyExists": "已存在同名的資源預設。" }, "usersettings": { "General": "一般的",