Skip to content

Commit

Permalink
fix: add undefined type to useResourceSlotsDetails (#2526)
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby authored and agatha197 committed Sep 19, 2024
1 parent c55752d commit 77422f2
Show file tree
Hide file tree
Showing 23 changed files with 67 additions and 62 deletions.
33 changes: 7 additions & 26 deletions react/src/components/ImportFromHuggingFaceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Form,
FormInstance,
Input,
InputNumber,
Switch,
theme,
Typography,
Expand All @@ -34,7 +33,7 @@ const ImportFromHuggingFaceModal: React.FC<ImportFromHuggingFaceModalProps> = ({
const { t } = useTranslation();
const { token } = theme.useToken();
const formRef = useRef<FormInstance<Service>>(null);
const [isStartService, { toggle: toggleStartService }] = useToggle(false);
const [isImportOnly, { toggle: toggleIsImportOnly }] = useToggle(false);

const handleOnClick = () => {
formRef.current
Expand All @@ -52,9 +51,9 @@ const ImportFromHuggingFaceModal: React.FC<ImportFromHuggingFaceModalProps> = ({
centered
footer={
<Button type="primary" htmlType="submit" onClick={handleOnClick}>
{isStartService
? t('data.modelStore.ImportAndStartService')
: t('data.modelStore.Import')}
{isImportOnly
? t('data.modelStore.Import')
: t('data.modelStore.ImportAndStartService')}
</Button>
}
onCancel={onRequestClose}
Expand Down Expand Up @@ -93,31 +92,13 @@ const ImportFromHuggingFaceModal: React.FC<ImportFromHuggingFaceModalProps> = ({
style={{ marginTop: token.marginLG, marginBottom: token.marginLG }}
>
<Switch
checked={isStartService}
checked={isImportOnly}
onChange={(e) => {
toggleStartService();
toggleIsImportOnly();
}}
/>
<Typography.Text>{t('data.modelStore.StartService')}</Typography.Text>
<Typography.Text>{t('data.modelStore.ImportOnly')}</Typography.Text>
</Flex>
{isStartService ? (
<Card>
<Form.Item
name="inference_engine_version"
label={t('data.modelStore.InferenceEngineVersion')}
rules={[{ required: isStartService }]}
>
<Input />
</Form.Item>
<Form.Item
name="replica_number"
label={t('data.modelStore.ReplicaNumber')}
rules={[{ required: isStartService }]}
>
<InputNumber style={{ width: '100%' }} />
</Form.Item>
</Card>
) : null}
</Form>
</BAIModal>
);
Expand Down
4 changes: 2 additions & 2 deletions react/src/hooks/backendai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export const useResourceSlotsDetails = (resourceGroupName?: string) => {
const [key, checkUpdate] = useUpdatableState('first');
const baiRequestWithPromise = useBaiSignedRequestWithPromise();
const baiClient = useSuspendedBackendaiClient();
const { data: resourceSlots } = useTanQuery<{
[key: string]: ResourceSlotDetail | undefined;
let { data: resourceSlots } = useTanQuery<{
[key: string]: ResourceSlotDetail;
}>({
queryKey: ['useResourceSlots', resourceGroupName, key],
queryFn: () => {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Neuer Ordnername",
"modelStore": {
"ImportFromHuggingFace": "Aus Hugging Face importieren",
"ImportFromHuggingFace": "Import aus Hugging Face",
"Import": "Importieren",
"StartService": "Dienst starten",
"InferenceEngineVersion": "Version der Inferenz-Engine",
"ReplicaNumber": "Replikatnummer",
"ImportAndStartService": "Dienst importieren und starten",
"huggingFaceUrlPlaceholder": "Geben Sie die URL Hugging Face ein"
"huggingFaceUrlPlaceholder": "Geben Sie die URL Hugging Face ein",
"ImportOnly": "Nur importieren"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@
"InferenceEngineVersion": "Έκδοση Inference Engine",
"ReplicaNumber": "Αριθμός αντιγράφου",
"ImportAndStartService": "Εισαγωγή και έναρξη υπηρεσίας",
"huggingFaceUrlPlaceholder": "Εισαγάγετε τη διεύθυνση URL Hugging Face."
"huggingFaceUrlPlaceholder": "Εισαγάγετε τη διεύθυνση URL Hugging Face.",
"ImportOnly": "Μόνο εισαγωγή"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,8 @@
"InferenceEngineVersion": "Inference Engine Version",
"ReplicaNumber": "Replica Number",
"ImportAndStartService": "Import & Start Service",
"huggingFaceUrlPlaceholder": "Input Hugging Face URL"
"huggingFaceUrlPlaceholder": "Input Hugging Face URL",
"ImportOnly": "Import only"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@
"InferenceEngineVersion": "Versión del motor de inferencia",
"ReplicaNumber": "Número de réplica",
"ImportAndStartService": "Servicio de importación e inicio",
"huggingFaceUrlPlaceholder": "Introduzca la URL Hugging Face"
"huggingFaceUrlPlaceholder": "Introduzca la URL Hugging Face",
"ImportOnly": "Sólo importar"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Uusi kansion nimi",
"modelStore": {
"ImportFromHuggingFace": "Tuo hugging Face sta",
"ImportFromHuggingFace": "Tuo Hugging Facesta",
"Import": "Tuonti",
"StartService": "Aloita palvelu",
"InferenceEngineVersion": "Päättele moottorin versio",
"ReplicaNumber": "Replikan numero",
"ImportAndStartService": "Tuo ja käynnistä palvelu",
"huggingFaceUrlPlaceholder": "Syötä Hugging Face-URL-osoite"
"huggingFaceUrlPlaceholder": "Syötä Hugging Face-URL-osoite",
"ImportOnly": "Vain tuonti"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Nouveau nom de dossier",
"modelStore": {
"ImportFromHuggingFace": "Importer à partir de Hugging Face",
"ImportFromHuggingFace": "Importer depuis Hugging Face",
"Import": "Importer",
"StartService": "Démarrer le service",
"InferenceEngineVersion": "Version du moteur d'inférence",
"ReplicaNumber": "Numéro de réplique",
"ImportAndStartService": "Service d'importation et de démarrage",
"huggingFaceUrlPlaceholder": "Saisissez l'URL Hugging Face"
"huggingFaceUrlPlaceholder": "Saisissez l'URL Hugging Face",
"ImportOnly": "Importer uniquement"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -780,13 +780,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Nama folder baru",
"modelStore": {
"ImportFromHuggingFace": "Impor Dari Hugging Face",
"ImportFromHuggingFace": "Impor dari Hugging Face",
"Import": "Impor",
"StartService": "Memulai layanan",
"InferenceEngineVersion": "Versi Mesin Inferensi",
"ReplicaNumber": "Nomor Replika",
"ImportAndStartService": "Impor dan Mulai Layanan",
"huggingFaceUrlPlaceholder": "Masukkan URL Hugging Face"
"huggingFaceUrlPlaceholder": "Masukkan URL Hugging Face",
"ImportOnly": "Impor saja"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@
"InferenceEngineVersion": "Versione del motore di inferenza",
"ReplicaNumber": "Numero di replica",
"ImportAndStartService": "Importa e avvia il servizio",
"huggingFaceUrlPlaceholder": "Inserisci l'URL Hugging Face."
"huggingFaceUrlPlaceholder": "Inserisci l'URL Hugging Face.",
"ImportOnly": "Solo importazione"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "新しいフォルダ名",
"modelStore": {
"ImportFromHuggingFace": "「ハグフェイス」からインポート",
"ImportFromHuggingFace": "ハグフェイスからインポート",
"Import": "輸入",
"StartService": "サービスを開始する",
"InferenceEngineVersion": "推論エンジンのバージョン",
"ReplicaNumber": "レプリカ番号",
"ImportAndStartService": "サービスのインポートと開始",
"huggingFaceUrlPlaceholder": "Hugging Faceの URL を入力してください"
"huggingFaceUrlPlaceholder": "Hugging Faceの URL を入力してください",
"ImportOnly": "輸入のみ"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,8 @@
"InferenceEngineVersion": "추론 엔진 버전",
"ReplicaNumber": "복제 번호",
"ImportAndStartService": "가져오기 및 서비스 시작",
"huggingFaceUrlPlaceholder": "Hugging Face URL을 입력하세요."
"huggingFaceUrlPlaceholder": "Hugging Face URL을 입력하세요.",
"ImportOnly": "가져오기만 허용"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/mn.json
Original file line number Diff line number Diff line change
Expand Up @@ -781,13 +781,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Шинэ фолдерын нэр",
"modelStore": {
"ImportFromHuggingFace": "Hugging Face хэсгээс импортлох",
"ImportFromHuggingFace": "Hugging Face-аас импортлох",
"Import": "Импорт",
"StartService": "Үйлчилгээг эхлүүлэх",
"InferenceEngineVersion": "Дүгнэлт хөдөлгүүрийн хувилбар",
"ReplicaNumber": "Хуулбарын дугаар",
"ImportAndStartService": "Импорт хийх ба эхлүүлэх үйлчилгээ",
"huggingFaceUrlPlaceholder": "Hugging Face URL-г оруулна уу"
"huggingFaceUrlPlaceholder": "Hugging Face URL-г оруулна уу",
"ImportOnly": "Зөвхөн импортлох"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Nama folder baharu",
"modelStore": {
"ImportFromHuggingFace": "Import Dari Hugging Face",
"ImportFromHuggingFace": "Import daripada Hugging Face",
"Import": "Import",
"StartService": "Mulakan Perkhidmatan",
"InferenceEngineVersion": "Versi Enjin Inferens",
"ReplicaNumber": "Nombor Replika",
"ImportAndStartService": "Import dan Mulakan Perkhidmatan",
"huggingFaceUrlPlaceholder": "Masukkan URL Hugging Face"
"huggingFaceUrlPlaceholder": "Masukkan URL Hugging Face",
"ImportOnly": "Import sahaja"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@
"InferenceEngineVersion": "Wersja silnika wnioskowania",
"ReplicaNumber": "Numer repliki",
"ImportAndStartService": "Importuj i uruchamiaj usługę",
"huggingFaceUrlPlaceholder": "Wpisz adres URL Hugging Face"
"huggingFaceUrlPlaceholder": "Wpisz adres URL Hugging Face",
"ImportOnly": "Tylko importuj"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Novo nome da pasta",
"modelStore": {
"ImportFromHuggingFace": "Importar de Hugging Face",
"ImportFromHuggingFace": "Importar do Hugging Face",
"Import": "Importar",
"StartService": "Começar serviço",
"InferenceEngineVersion": "Versão do mecanismo de inferência",
"ReplicaNumber": "Número da réplica",
"ImportAndStartService": "Importar e iniciar serviço",
"huggingFaceUrlPlaceholder": "Insira o URL Hugging Face"
"huggingFaceUrlPlaceholder": "Insira o URL Hugging Face",
"ImportOnly": "Somente importação"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Novo nome da pasta",
"modelStore": {
"ImportFromHuggingFace": "Importar de Hugging Face",
"ImportFromHuggingFace": "Importar do Hugging Face",
"Import": "Importar",
"StartService": "Começar serviço",
"InferenceEngineVersion": "Versão do mecanismo de inferência",
"ReplicaNumber": "Número da réplica",
"ImportAndStartService": "Importar e iniciar serviço",
"huggingFaceUrlPlaceholder": "Insira o URL Hugging Face"
"huggingFaceUrlPlaceholder": "Insira o URL Hugging Face",
"ImportOnly": "Somente importação"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Новое имя папки",
"modelStore": {
"ImportFromHuggingFace": "Импорт из Hugging Face",
"ImportFromHuggingFace": "Импорт из «Hugging Face»",
"Import": "Импортировать",
"StartService": "Запустить службу",
"InferenceEngineVersion": "Версия механизма вывода",
"ReplicaNumber": "Номер реплики",
"ImportAndStartService": "Импортировать и запустить службу",
"huggingFaceUrlPlaceholder": "Введите URL-адрес Hugging Face"
"huggingFaceUrlPlaceholder": "Введите URL-адрес Hugging Face",
"ImportOnly": "Только импорт"
}
},
"dialog": {
Expand Down
6 changes: 5 additions & 1 deletion resources/i18n/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,11 @@
"Add": "เพิ่ม",
"CloningIsOnlyPossibleSameHost": "ปัจจุบันการโคลนสามารถทำได้เฉพาะบนโฮสต์เดียวกัน",
"userQuotaScopeId": "รหัสขอบเขตโควตาผู้ใช้",
"NewFolderName": "ชื่อโฟลเดอร์ใหม่"
"NewFolderName": "ชื่อโฟลเดอร์ใหม่",
"modelStore": {
"ImportFromHuggingFace": "นำเข้าจาก Hugging Face",
"ImportOnly": "นำเข้าเท่านั้น"
}
},
"dialog": {
"warning": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Yeni klasör adı",
"modelStore": {
"ImportFromHuggingFace": "Hugging Face İçe Aktar",
"ImportFromHuggingFace": "Hugging Face'ten içe aktar",
"Import": "İçe aktarmak",
"StartService": "Hizmeti Başlat",
"InferenceEngineVersion": "Çıkarım Motoru Sürümü",
"ReplicaNumber": "Çoğaltma Numarası",
"ImportAndStartService": "Hizmeti İçe Aktarma ve Başlatma",
"huggingFaceUrlPlaceholder": "Hugging Face URL'sini girin"
"huggingFaceUrlPlaceholder": "Hugging Face URL'sini girin",
"ImportOnly": "Yalnızca içe aktar"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "Tên thư mục mới",
"modelStore": {
"ImportFromHuggingFace": "Nhập Từ Hugging Face",
"ImportFromHuggingFace": "Nhập từ Hugging Face",
"Import": "Nhập khẩu",
"StartService": "Bắt đầu dịch vụ",
"InferenceEngineVersion": "Phiên bản công cụ suy luận",
"ReplicaNumber": "Số bản sao",
"ImportAndStartService": "Dịch vụ nhập và bắt đầu",
"huggingFaceUrlPlaceholder": "Nhập URL Hugging Face"
"huggingFaceUrlPlaceholder": "Nhập URL Hugging Face",
"ImportOnly": "Chỉ nhập khẩu"
}
},
"dialog": {
Expand Down
5 changes: 3 additions & 2 deletions resources/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,14 @@
"userQuotaScopeId": "Quota Scope ID",
"NewFolderName": "新文件夹名称",
"modelStore": {
"ImportFromHuggingFace": "从Hugging Face导入",
"ImportFromHuggingFace": "从 Hugging Face 导入",
"Import": "进口",
"StartService": "启动服务",
"InferenceEngineVersion": "推理引擎版本",
"ReplicaNumber": "副本号",
"ImportAndStartService": "导入并启动服务",
"huggingFaceUrlPlaceholder": "输入Hugging Face网址"
"huggingFaceUrlPlaceholder": "输入Hugging Face网址",
"ImportOnly": "仅导入"
}
},
"dialog": {
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@
"InferenceEngineVersion": "推理引擎版本",
"ReplicaNumber": "副本號",
"ImportAndStartService": "導入並啟動服務",
"huggingFaceUrlPlaceholder": "輸入Hugging Face網址"
"huggingFaceUrlPlaceholder": "輸入Hugging Face網址",
"ImportOnly": "僅導入"
}
},
"dialog": {
Expand Down

0 comments on commit 77422f2

Please sign in to comment.