Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): fix pods list data & adjust create function ui #1487

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,5 +627,6 @@
"CreateApp": "New Application",
"Used": "Used",
"Remaining": "Remaining",
"Pod": "Pod"
"Pod": "Pod",
"EditFunction": "Edit Function"
}
3 changes: 2 additions & 1 deletion web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,5 +627,6 @@
"CreateApp": "新建应用",
"Used": "已使用",
"Remaining": "剩余",
"Pod": "实例"
"Pod": "实例",
"EditFunction": "编辑函数"
}
3 changes: 2 additions & 1 deletion web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,5 +627,6 @@
"CreateApp": "新建应用",
"Used": "已使用",
"Remaining": "剩余",
"Pod": "实例"
"Pod": "实例",
"EditFunction": "编辑函数"
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ const CreateModal = (props: {

<Modal isOpen={isOpen} onClose={onClose} size="3xl">
<ModalOverlay />
<ModalContent m="auto">
<ModalContent m="auto" className="!pb-12">
<ModalHeader>
{isEdit ? t("FunctionPanel.EditFunction") : t("FunctionPanel.AddFunction")}
</ModalHeader>
<ModalCloseButton />

<ModalBody className="mb-4">
<ModalBody className="mb-4 !px-16">
<VStack align="flex-start">
<FormControl isInvalid={!!errors?.name}>
<div className="mb-3 flex h-12 w-full items-center border-b-2">
<div className="my-3 flex h-12 w-full items-center border-b-2">
<input
{...register("name", {
pattern: {
Expand Down Expand Up @@ -245,19 +245,19 @@ const CreateModal = (props: {
isLoading={updateFunctionMutation.isLoading || createFunctionMutation.isLoading}
className="!h-9 w-full !rounded !bg-primary-600 !font-semibold"
>
{t("CreateFunction")}
{!isEdit ? t("CreateFunction") : t("EditFunction")}
</Button>
</VStack>
</ModalBody>
{!isEdit && !aiCode && (
<>
<Divider />
<ModalFooter>
<div className="w-full">
<ModalFooter className="!px-16">
<div className="mt-2 w-full">
<div className="pb-3 text-lg font-medium text-grayModern-700">
{t("Template.Recommended")}
</div>
<div className="mb-7 flex space-x-3">
<div className="mb-11 flex space-x-3">
{!isLoading ? (
(TemplateList?.data.list.length > 0
? TemplateList?.data.list
Expand Down
9 changes: 7 additions & 2 deletions web/src/pages/app/setting/AppMonitor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ export default function AppMonitor() {
const [podsArray, setPodsArray] = useState<string[]>([]);

useEffect(() => {
setPodsArray(cpuUsage.map((item) => item.metric.pod));
}, [cpuUsage]);
setPodsArray(
cpuUsage.map((item) => item.metric.pod).length >
memoryUsage.map((item) => item.metric.pod).length
? cpuUsage.map((item) => item.metric.pod)
: memoryUsage.map((item) => item.metric.pod),
);
}, [cpuUsage, memoryUsage]);

return (
<div className="flex w-full">
Expand Down