From 13545ab346b9b018930fa14a464b9941c3c98dc8 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Mon, 4 Sep 2023 16:36:03 +0800 Subject: [PATCH] fix: splee errpr --- frontend/packages/client-sdk/src/types/user.d.ts | 2 +- frontend/packages/client-sdk/src/utils/kubernetes.ts | 4 ++-- .../providers/costcenter/src/components/valuation/quota.tsx | 4 ++-- frontend/providers/costcenter/src/pages/api/getQuota.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/packages/client-sdk/src/types/user.d.ts b/frontend/packages/client-sdk/src/types/user.d.ts index d4a3a206a7cb..74e51abaa8ca 100644 --- a/frontend/packages/client-sdk/src/types/user.d.ts +++ b/frontend/packages/client-sdk/src/types/user.d.ts @@ -19,7 +19,7 @@ export type Session = { kubeconfig: KubeConfig; }; -export type UserQuoteItemType = { +export type UserQuotaItemType = { type: 'cpu' | 'memory' | 'storage' | 'gpu'; used: number; limit: number; diff --git a/frontend/packages/client-sdk/src/utils/kubernetes.ts b/frontend/packages/client-sdk/src/utils/kubernetes.ts index 0591309c8a76..d7e750c6675c 100644 --- a/frontend/packages/client-sdk/src/utils/kubernetes.ts +++ b/frontend/packages/client-sdk/src/utils/kubernetes.ts @@ -2,7 +2,7 @@ import * as k8s from '@kubernetes/client-node'; import * as yaml from 'js-yaml'; import type { V1Deployment, V1StatefulSet } from '@kubernetes/client-node'; import { memoryFormatToMi, cpuFormatToM } from './tools'; -import type { UserQuoteItemType } from '../types'; +import type { UserQuotaItemType } from '../types'; import { IncomingHttpHeaders } from 'http'; import { errLog, infoLog } from './logger'; @@ -161,7 +161,7 @@ async function applyYamlList({ return CreateYaml(kc, formatYaml); } -async function getUserQuota(kc: k8s.KubeConfig, namespace: string): Promise { +async function getUserQuota(kc: k8s.KubeConfig, namespace: string): Promise { const k8sApi = kc.makeApiClient(k8s.CoreV1Api); const { diff --git a/frontend/providers/costcenter/src/components/valuation/quota.tsx b/frontend/providers/costcenter/src/components/valuation/quota.tsx index 2bbfaf49ed3b..09c0ea8be7f8 100644 --- a/frontend/providers/costcenter/src/components/valuation/quota.tsx +++ b/frontend/providers/costcenter/src/components/valuation/quota.tsx @@ -1,5 +1,5 @@ import { valuationMap } from '@/constants/payment'; -import { UserQuoteItemType } from '@/pages/api/getQuota'; +import { UserQuotaItemType } from '@/pages/api/getQuota'; import request from '@/service/request'; import useEnvStore from '@/stores/env'; import { ApiResp } from '@/types'; @@ -11,7 +11,7 @@ import MyTooltip from '../MyTooltip'; export default function Quota() { const { t } = useTranslation(); const { data } = useQuery(['quota'], () => - request>('/api/getQuota') + request>('/api/getQuota') ); const quota = (data?.data?.quota || []).flatMap((_quota) => { const x = valuationMap.get(_quota.type); diff --git a/frontend/providers/costcenter/src/pages/api/getQuota.ts b/frontend/providers/costcenter/src/pages/api/getQuota.ts index f7b4ccff3834..b12b47485d96 100644 --- a/frontend/providers/costcenter/src/pages/api/getQuota.ts +++ b/frontend/providers/costcenter/src/pages/api/getQuota.ts @@ -22,7 +22,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse jsonRes(resp, { code: 500, message: 'get price error' }); } } -export type UserQuoteItemType = { +export type UserQuotaItemType = { type: 'cpu' | 'memory' | 'storage' | 'gpu'; used: number; limit: number; @@ -78,7 +78,7 @@ export const memoryFormatToMi = (memory: string) => { export async function getUserQuota( kc: k8s.KubeConfig, namespace: string -): Promise { +): Promise { const k8sApi = kc.makeApiClient(k8s.CoreV1Api); const data = await k8sApi.readNamespacedResourceQuota(`quota-${namespace}`, namespace);