diff --git a/frontend/desktop/data/config.json b/frontend/desktop/data/config.json
index a1473a002e9..caf421288e4 100644
--- a/frontend/desktop/data/config.json
+++ b/frontend/desktop/data/config.json
@@ -1,3 +1,3 @@
{
"scripts": []
-}
\ No newline at end of file
+}
diff --git a/frontend/providers/applaunchpad/next-i18next.config.js b/frontend/providers/applaunchpad/next-i18next.config.js
index 1a032fe9ec2..8dca5135fe0 100644
--- a/frontend/providers/applaunchpad/next-i18next.config.js
+++ b/frontend/providers/applaunchpad/next-i18next.config.js
@@ -9,4 +9,4 @@ module.exports = {
locales: ['en', 'zh'],
localeDetection: false
}
-}
+};
diff --git a/frontend/providers/costcenter/next.config.js b/frontend/providers/costcenter/next.config.js
index 2401ff17367..0bd18c8cc8e 100644
--- a/frontend/providers/costcenter/next.config.js
+++ b/frontend/providers/costcenter/next.config.js
@@ -40,6 +40,15 @@ const nextConfig = {
]
}
];
+ },
+ async redirects() {
+ return [
+ {
+ source: '/',
+ destination: '/cost_overview',
+ permanent: true
+ }
+ ];
}
};
diff --git a/frontend/providers/costcenter/src/components/icons/StorageIcon.tsx b/frontend/providers/costcenter/src/components/icons/StorageIcon.tsx
index 9f15a54d40c..03943859435 100644
--- a/frontend/providers/costcenter/src/components/icons/StorageIcon.tsx
+++ b/frontend/providers/costcenter/src/components/icons/StorageIcon.tsx
@@ -13,8 +13,8 @@ export function StorageIcon(props: IconProps) {
);
diff --git a/frontend/providers/costcenter/src/components/valuation/predictCard.tsx b/frontend/providers/costcenter/src/components/valuation/predictCard.tsx
index ee758f443b4..c9b89db729b 100644
--- a/frontend/providers/costcenter/src/components/valuation/predictCard.tsx
+++ b/frontend/providers/costcenter/src/components/valuation/predictCard.tsx
@@ -9,33 +9,50 @@ import { END_TIME, valuationMap } from '@/constants/payment';
import useBillingData from '@/hooks/useBillingData';
import { BillingType, Costs } from '@/types';
import { isSameDay, isSameHour, parseISO, subHours } from 'date-fns';
+
export default function PredictCard() {
const { t } = useTranslation();
+ const NOW_TIME = new Date();
+
const { data } = useBillingData({
type: BillingType.CONSUME,
- endTime: END_TIME,
- startTime: subHours(END_TIME, 1)
+ endTime: NOW_TIME,
+ startTime: subHours(NOW_TIME, 3)
});
const _state = useMemo(() => {
+ let times = 3;
const items = data?.data?.status.item || [];
- if (items.length > 0) {
- const latest = items[0];
- const time = parseISO(latest.time);
- const now = new Date();
- if (isSameDay(time, now) && isSameHour(time, now))
- return {
- ...latest.costs,
- total: latest.amount
- };
- }
- return {
+ let state = {
cpu: 0,
memory: 0,
storage: 0,
network: 0,
port: 0,
+ gpu: 0,
total: 0
};
+ while (times--) {
+ let existSame = false;
+ items.reduce((pre, cur) => {
+ const time = parseISO(cur.time);
+ if (
+ isSameDay(time, subHours(NOW_TIME, 3 - times)) &&
+ isSameHour(time, subHours(NOW_TIME, 3 - times))
+ ) {
+ pre.cpu += cur.costs.cpu;
+ pre.memory += cur.costs.memory;
+ pre.storage += cur.costs.storage;
+ pre.network += cur.costs.network;
+ pre.port += cur.costs.port;
+ pre.gpu += cur.costs.gpu || 0;
+ pre.total += cur.amount;
+ existSame = true;
+ }
+ return pre;
+ }, state);
+ if (existSame) break;
+ }
+ return state;
}, [data?.data?.status.item]);
const currency = useEnvStore((s) => s.currency);
const gpuEnabled = useEnvStore((state) => state.gpuEnabled);
diff --git a/frontend/providers/costcenter/src/hooks/useBillingData.tsx b/frontend/providers/costcenter/src/hooks/useBillingData.tsx
index ca1bbe3d6e3..c17038d716c 100644
--- a/frontend/providers/costcenter/src/hooks/useBillingData.tsx
+++ b/frontend/providers/costcenter/src/hooks/useBillingData.tsx
@@ -23,9 +23,11 @@ export default function useBillingData(props?: {
startTime: formatISO(start, { representation: 'complete' }),
endTime: formatISO(end, { representation: 'complete' }),
page: 1,
- pageSize: props ? props.pageSize : (delta + 1) * 48,
+ pageSize: props?.pageSize ? props.pageSize : (delta + 1) * 48,
type: props?.type ?? -1,
- orderID: ''
+ orderID: '',
+ appType: '',
+ namespace: ''
};
return request, { spec: BillingSpec }>('/api/billing', {
method: 'POST',
diff --git a/frontend/providers/costcenter/src/pages/api/billing/getNamespaceList.tsx b/frontend/providers/costcenter/src/pages/api/billing/getNamespaceList.tsx
index bca183e0e4c..a589e0d6aa4 100644
--- a/frontend/providers/costcenter/src/pages/api/billing/getNamespaceList.tsx
+++ b/frontend/providers/costcenter/src/pages/api/billing/getNamespaceList.tsx
@@ -23,7 +23,6 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
message: 'endTime is invalid'
});
const url = process.env.BILLING_URI + '/account/v1alpha1/namespaces';
- console.log(url);
const res = await (
await fetch(url, {
method: 'POST',
@@ -36,7 +35,6 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
})
})
).json();
- console.log(res);
return jsonRes(resp, {
code: 200,
data: res.data,
diff --git a/frontend/providers/costcenter/src/pages/api/getQuota.ts b/frontend/providers/costcenter/src/pages/api/getQuota.ts
index cee12527879..579cea76374 100644
--- a/frontend/providers/costcenter/src/pages/api/getQuota.ts
+++ b/frontend/providers/costcenter/src/pages/api/getQuota.ts
@@ -70,7 +70,6 @@ export const memoryFormatToMi = (memory: string) => {
} else if (/Ti/gi.test(memory)) {
value = value * 1024 * 1024;
} else {
- console.log('Invalid memory value');
value = 0;
}
diff --git a/frontend/providers/costcenter/src/pages/billing/index.tsx b/frontend/providers/costcenter/src/pages/billing/index.tsx
index df65d388ff0..5a7819cccb4 100644
--- a/frontend/providers/costcenter/src/pages/billing/index.tsx
+++ b/frontend/providers/costcenter/src/pages/billing/index.tsx
@@ -78,7 +78,7 @@ function InOutTabPanel({ namespace }: { namespace: string }) {
const { data, isFetching, isSuccess } = useQuery(
['billing', { currentPage, startTime, endTime, orderID, selectType, namespace, appType }],
() => {
- const spec = {
+ const spec: BillingSpec = {
page: currentPage,
pageSize: pageSize,
type: selectType,
diff --git a/frontend/providers/costcenter/src/types/billing.ts b/frontend/providers/costcenter/src/types/billing.ts
index 19e333f70dc..a3c31a33950 100644
--- a/frontend/providers/costcenter/src/types/billing.ts
+++ b/frontend/providers/costcenter/src/types/billing.ts
@@ -13,7 +13,8 @@ export type BillingSpec =
endTime: string;
type: BillingType; //0为扣费,1为充值;用于billing数据查找:如为-1则查找type为0和1的数据,如果给定type值则查找type为给定值的数据
owner?: string; //用于billing数据中查找的owner字段值
- namespace?: string;
+ namespace: string;
+ appType: string;
}
| {
orderID: string; //如果给定orderId,则查找该id的值,该值为唯一值,因此当orderId给定时忽略其他查找限定值
diff --git a/frontend/providers/template/src/components/Banner/index.tsx b/frontend/providers/template/src/components/Banner/index.tsx
index 3aa13ae9cca..97784a85067 100644
--- a/frontend/providers/template/src/components/Banner/index.tsx
+++ b/frontend/providers/template/src/components/Banner/index.tsx
@@ -69,7 +69,8 @@ export default function Banner() {
'.my-prev-button, .my-next-button': {
opacity: 1
}
- }}>
+ }}
+ >
+ }}
+ >
{SlideData.map((item, index) => (
@@ -91,7 +93,8 @@ export default function Banner() {
bg={item.bg}
borderRadius={item.borderRadius}
p="16px 24px"
- justifyContent={'space-between'}>
+ justifyContent={'space-between'}
+ >
+ border={' 1px solid rgba(255, 255, 255, 0.50)'}
+ >
@@ -125,7 +129,8 @@ export default function Banner() {
bg={SlideData[(index + 1) % SlideData.length].bg}
borderRadius={SlideData[(index + 1) % SlideData.length].borderRadius}
p="16px 24px"
- justifyContent={'space-between'}>
+ justifyContent={'space-between'}
+ >
+ border={' 1px solid rgba(255, 255, 255, 0.50)'}
+ >
+ transform="translateY(-50%) rotate(180deg)"
+ >
+ transform="translateY(-50%)"
+ >
diff --git a/frontend/providers/template/src/components/icons/ArrowRight.tsx b/frontend/providers/template/src/components/icons/ArrowRight.tsx
index e062da39484..dce1d0e663c 100644
--- a/frontend/providers/template/src/components/icons/ArrowRight.tsx
+++ b/frontend/providers/template/src/components/icons/ArrowRight.tsx
@@ -7,7 +7,8 @@ export const ArrowRightIcon = (props: IconProps) => (
viewBox="0 0 21 67"
fill="none"
xmlns="http://www.w3.org/2000/svg"
- {...props}>
+ {...props}
+ >
- {/* */}
+ px="42px"
+ >
{!!FastDeployTemplates?.length ? (
+ onClick={handleDelApp}
+ >
{t('Confirm deletion')}