Skip to content

Commit

Permalink
fix: splee errpr
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Sep 4, 2023
1 parent abc7dd7 commit 13545ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frontend/packages/client-sdk/src/types/user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type Session = {
kubeconfig: KubeConfig;
};

export type UserQuoteItemType = {
export type UserQuotaItemType = {
type: 'cpu' | 'memory' | 'storage' | 'gpu';
used: number;
limit: number;
Expand Down
4 changes: 2 additions & 2 deletions frontend/packages/client-sdk/src/utils/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -161,7 +161,7 @@ async function applyYamlList({
return CreateYaml(kc, formatYaml);
}

async function getUserQuota(kc: k8s.KubeConfig, namespace: string): Promise<UserQuoteItemType[]> {
async function getUserQuota(kc: k8s.KubeConfig, namespace: string): Promise<UserQuotaItemType[]> {
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

const {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,7 +11,7 @@ import MyTooltip from '../MyTooltip';
export default function Quota() {
const { t } = useTranslation();
const { data } = useQuery(['quota'], () =>
request<any, ApiResp<{ quota: UserQuoteItemType[] }>>('/api/getQuota')
request<any, ApiResp<{ quota: UserQuotaItemType[] }>>('/api/getQuota')
);
const quota = (data?.data?.quota || []).flatMap((_quota) => {
const x = valuationMap.get(_quota.type);
Expand Down
4 changes: 2 additions & 2 deletions frontend/providers/costcenter/src/pages/api/getQuota.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -78,7 +78,7 @@ export const memoryFormatToMi = (memory: string) => {
export async function getUserQuota(
kc: k8s.KubeConfig,
namespace: string
): Promise<UserQuoteItemType[]> {
): Promise<UserQuotaItemType[]> {
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

const data = await k8sApi.readNamespacedResourceQuota(`quota-${namespace}`, namespace);
Expand Down

0 comments on commit 13545ab

Please sign in to comment.