Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zjy365 committed Feb 23, 2024
1 parent 4c05ada commit bc9f927
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
1 change: 0 additions & 1 deletion frontend/desktop/src/pages/api/notification/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)

if (listCrd.body?.items) {
listCrd.body.items.sort(compareByTimestamp);
console.log(listCrd.body.items[0]);
if (listCrd.body.items[0]) {
return jsonRes(res, { data: listCrd.body.items[0] });
}
Expand Down
42 changes: 41 additions & 1 deletion frontend/providers/template/src/pages/deploy/components/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import MyIcon from '@/components/Icon';
import MySelect from '@/components/Select';
import type { QueryType } from '@/types';
import { FormSourceInput } from '@/types/app';
import { Box, Flex, FormControl, Input, Text, useTheme } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import { useEffect, useMemo, useRef, useState } from 'react';
import { useMemo } from 'react';
import { UseFormReturn } from 'react-hook-form';

const Form = ({
Expand Down Expand Up @@ -54,6 +55,45 @@ const Form = ({
{isShowContent ? (
<Box px={'42px'} py={'24px'}>
{formSource?.inputs?.map((item: FormSourceInput, index: number) => {
if (item.type === 'choice' && item.options) {
return (
<FormControl key={item?.key} mb={7} isInvalid={!!errors.appName}>
<Flex alignItems={'center'} align="stretch">
<Flex
position={'relative'}
w="200px"
className="template-dynamic-label"
color={'#333'}
userSelect={'none'}
>
{item?.label}
{item?.required && (
<Text ml="2px" color={'#E53E3E'}>
*
</Text>
)}
</Flex>
<Box maxW={'500px'} ml={'17px'} w={'100%'}>
<MySelect
w={'100%'}
bg={'transparent'}
borderRadius={'2px'}
value={formHook.getValues(item.key) || item.default}
list={item.options?.map((option) => {
return {
value: option,
label: option
};
})}
onchange={(val: any) => {
formHook.setValue(item.key, val);
}}
/>
</Box>
</Flex>
</FormControl>
);
}
return (
<FormControl key={item?.key} mb={7} isInvalid={!!errors.appName}>
<Flex alignItems={'center'} align="stretch">
Expand Down

0 comments on commit bc9f927

Please sign in to comment.