Skip to content

Commit

Permalink
fix(web): fix pods list data & adjust create function ui (#1487)
Browse files Browse the repository at this point in the history
* fix(web): fix pods list data & adjust create function ui

* fix(web): edit function
  • Loading branch information
newfish-cmyk authored Aug 24, 2023
1 parent 6216b32 commit 301982e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
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

0 comments on commit 301982e

Please sign in to comment.