-
-
- {currentApp?.name}
-
-
-
+
+
+
+
+ {currentApp?.name}
+
{
currentApp?.phase !== APP_PHASE_STATUS.Stopped &&
currentApp?.phase !== APP_PHASE_STATUS.Started
}
- variant={"text"}
+ color={"grayModern.600"}
+ bg={"none"}
+ _hover={{ color: "primary.600" }}
onClick={() => {
updateCurrentApp(
currentApp!,
@@ -85,7 +86,9 @@ const AppEnvList = () => {
className="mr-2"
fontWeight={"semibold"}
size={"sm"}
- variant={"text"}
+ color={"grayModern.600"}
+ bg={"none"}
+ _hover={{ color: "primary.600" }}
onClick={(event: any) => {
event?.preventDefault();
updateCurrentApp(currentApp!, APP_STATUS.Stopped);
@@ -102,25 +105,34 @@ const AppEnvList = () => {
navigate(Routes.dashboard);
}}
>
-
-
-
+
+
{
key: t("Spec.RAM"),
value: `${currentApp?.bundle?.resource.limitMemory} ${t("Unit.MB")}`,
},
- ]}
- rightData={[
{
key: t("Spec.Database"),
value: `${currentApp?.bundle?.resource.databaseCapacity! / 1024} ${t("Unit.GB")}`,
@@ -140,6 +150,7 @@ const AppEnvList = () => {
value: `${currentApp?.bundle?.resource.storageCapacity! / 1024} ${t("Unit.GB")}`,
},
]}
+ className={darkMode ? "w-60" : "w-60 bg-[#F8FAFB]"}
/>
diff --git a/web/src/pages/app/setting/Usage/index.tsx b/web/src/pages/app/setting/Usage/index.tsx
index 817ffb1c42..5f31ac6553 100644
--- a/web/src/pages/app/setting/Usage/index.tsx
+++ b/web/src/pages/app/setting/Usage/index.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Avatar, Button, Center, Spinner, useColorMode } from "@chakra-ui/react";
import { useQuery } from "@tanstack/react-query";
@@ -29,11 +29,17 @@ const DATA_DURATION = 6 * 24 * 60 * 60 * 1000;
export default function Usage() {
const { t } = useTranslation();
const darkMode = useColorMode().colorMode === "dark";
- const [startTime, setStartTime] = React.useState
(
- new Date(new Date().getTime() - DATA_DURATION),
- );
-
- const [endTime, setEndTime] = React.useState(new Date());
+ const [endTime, setEndTime] = React.useState(() => {
+ const today = new Date();
+ today.setHours(23, 59, 59, 999);
+ return today;
+ });
+ const [startTime, setStartTime] = React.useState(() => {
+ const today = new Date();
+ today.setTime(today.getTime() - DATA_DURATION);
+ today.setHours(0, 0, 0, 0);
+ return today;
+ });
const { userInfo } = useGlobalStore((state) => state);
const { data: accountRes } = useAccountQuery();
@@ -42,8 +48,8 @@ export default function Usage() {
["billing", startTime, endTime],
async () => {
return BillingControllerGetExpense({
- startTime: startTime?.toISOString(),
- endTime: endTime?.toISOString(),
+ startTime: startTime?.getTime(),
+ endTime: endTime?.getTime(),
});
},
);
@@ -52,8 +58,8 @@ export default function Usage() {
["chargeOrderAmount", startTime, endTime],
async () => {
return AccountControllerGetChargeOrderAmount({
- startTime: startTime?.toISOString(),
- endTime: endTime?.toISOString(),
+ startTime: startTime?.getTime(),
+ endTime: endTime?.getTime(),
});
},
);
@@ -62,16 +68,22 @@ export default function Usage() {
["billingByDay", startTime, endTime],
async () => {
return BillingControllerGetExpenseByDay({
- startTime: startTime?.toISOString(),
- endTime: endTime?.toISOString(),
+ startTime: startTime?.getTime(),
+ endTime: endTime?.getTime(),
});
},
);
- const chartData = ((billingAmountByDayRes?.data as Array) || []).map((item) => ({
- totalAmount: item.totalAmount,
- date: formatDate(item.day).slice(5, 10),
- }));
+ const chartData = useMemo(
+ () =>
+ ((billingAmountByDayRes?.data as Array) || [])
+ .sort((a, b) => new Date(a.day).getTime() - new Date(b.day).getTime())
+ .map((item) => ({
+ totalAmount: item.totalAmount,
+ date: formatDate(item.day).slice(5, 10),
+ })),
+ [billingAmountByDayRes?.data],
+ );
return (
diff --git a/web/src/pages/app/setting/index.tsx b/web/src/pages/app/setting/index.tsx
index 060098ca67..c22b4cbc08 100644
--- a/web/src/pages/app/setting/index.tsx
+++ b/web/src/pages/app/setting/index.tsx
@@ -61,7 +61,7 @@ const SettingModal = (props: {
},
})}
-
+
diff --git a/web/src/pages/home/mods/StatusBadge/index.tsx b/web/src/pages/home/mods/StatusBadge/index.tsx
index f74b70f876..1716871147 100644
--- a/web/src/pages/home/mods/StatusBadge/index.tsx
+++ b/web/src/pages/home/mods/StatusBadge/index.tsx
@@ -24,7 +24,7 @@ export default function StatusBadge(props: {
}) {
const { statusConditions = APP_PHASE_STATUS.Started, state, className } = props;
return (
-