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

feat:launchpad support multiple containers #4380

Merged
merged 2 commits into from Dec 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -159,5 +159,7 @@
"common": {
"Used": "Used",
"Surplus": "Surplus"
}
},
"Store At Least One": "Store At Least One",
"Network port conflict": "Network port conflict"
}
Expand Up @@ -202,5 +202,6 @@
},
"user": {
"Insufficient account balance": "账号余额不足~"
}
},
"Store At Least One": "存储最少保留一个"
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -117,7 +117,7 @@ const Header = ({
flex={1}
h={'40px'}
borderColor={'myGray.200'}
leftIcon={<MyIcon name="detail" w={'14px'} h={'14px'} transform={'translateY(3px)'} />}
leftIcon={<MyIcon name="detail" w="16px" h="16px" />}
variant={'base'}
bg={'white'}
onClick={() => setShowSlider(true)}
Expand Down Expand Up @@ -180,7 +180,7 @@ const Header = ({
borderColor={'myGray.200'}
variant={'base'}
bg={'white'}
leftIcon={<MyIcon name="restart" w={'14px'} h={'14px'} />}
leftIcon={<MyIcon name="restart" w={'16px'} h={'16px'} />}
onClick={openRestartConfirm(handleRestartApp)}
isLoading={loading}
>
Expand Down
Expand Up @@ -99,7 +99,7 @@ const Logs = ({
);
}, []);

const { isLoading } = useQuery(['init'], () => getPodEvents(pod.podName), {
const { isLoading } = useQuery(['initPodEvents'], () => getPodEvents(pod.podName), {
refetchInterval: 3000,
onSuccess(res) {
setEvents(res);
Expand Down
Expand Up @@ -10,7 +10,9 @@ import {
Td,
TableContainer,
Flex,
MenuButton
MenuButton,
Tooltip,
Center
} from '@chakra-ui/react';
import { sealosApp } from 'sealos-desktop-sdk/app';
import { restartPodByName } from '@/api/app';
Expand Down Expand Up @@ -135,70 +137,68 @@ const Pods = ({
title: 'Operation',
key: 'control',
render: (item: PodDetailType, i: number) => (
<Flex>
<Button
mr={3}
leftIcon={<MyIcon name="log" />}
variant={'base'}
px={3}
onClick={() => setLogsPodIndex(i)}
>
{t('Log')}
</Button>
<MyMenu
width={100}
Button={
<MenuButton
w={'32px'}
h={'32px'}
borderRadius={'sm'}
_hover={{
bg: 'myWhite.400',
color: 'hover.iconBlue'
}}
>
<MyIcon name={'more'} px={3} />
</MenuButton>
}
menuList={[
{
child: (
<>
<MyIcon name={'terminal'} w={'14px'} />
<Box ml={2}>{t('Terminal')}</Box>
</>
),
onClick: () => {
const defaultCommand = `kubectl exec -it ${item.podName} -c ${appName} -- sh -c "clear; (bash || ash || sh)"`;
sealosApp.runEvents('openDesktopApp', {
appKey: 'system-terminal',
query: {
defaultCommand
},
messageData: { type: 'new terminal', command: defaultCommand }
});
}
},
{
child: (
<>
<MyIcon name={'detail'} w={'14px'} />
<Box ml={2}>{t('Details')}</Box>
</>
),
onClick: () => setDetailPodIndex(i)
},
{
child: (
<>
<MyIcon name={'restart'} />
<Box ml={2}>{t('Restart')} </Box>
</>
),
onClick: openConfirmRestart(() => handleRestartPod(item.podName))
}
]}
/>
<Flex alignItems={'center'}>
<MyTooltip label={t('Log')} offset={[0, 10]}>
<Center
p="6px"
_hover={{
bg: '#F4F6F8'
}}
cursor={'pointer'}
borderRadius={'4px'}
onClick={() => setLogsPodIndex(i)}
>
<MyIcon name="log" w="20px" h="20px" />
</Center>
</MyTooltip>
<MyTooltip offset={[0, 10]} label={t('Terminal')}>
<Center
p="6px"
_hover={{
bg: '#F4F6F8'
}}
cursor={'pointer'}
borderRadius={'4px'}
onClick={() => {
const defaultCommand = `kubectl exec -it ${item.podName} -c ${appName} -- sh -c "clear; (bash || ash || sh)"`;
sealosApp.runEvents('openDesktopApp', {
appKey: 'system-terminal',
query: {
defaultCommand
},
messageData: { type: 'new terminal', command: defaultCommand }
});
}}
>
<MyIcon name={'terminal'} w="20px" h="20px" />
</Center>
</MyTooltip>
<MyTooltip offset={[0, 10]} label={t('Details')}>
<Center
p="6px"
_hover={{
bg: '#F4F6F8'
}}
cursor={'pointer'}
borderRadius={'4px'}
onClick={() => setDetailPodIndex(i)}
>
<MyIcon name={'detail'} w="20px" h="20px" />
</Center>
</MyTooltip>
<MyTooltip offset={[0, 10]} label={t('Restart')}>
<Center
p="6px"
_hover={{
bg: '#F4F6F8'
}}
cursor={'pointer'}
borderRadius={'4px'}
onClick={openConfirmRestart(() => handleRestartPod(item.podName))}
>
<MyIcon name={'restart'} w="20px" h="20px" />
</Center>
</MyTooltip>
</Flex>
)
}
Expand Down
Expand Up @@ -56,6 +56,7 @@ import { obj2Query } from '@/api/tools';
import { throttle } from 'lodash';
import { ProtocolList, noGpuSliderKey } from '@/constants/app';
import { sliderNumber2MarkList } from '@/utils/adapt';
import { useToast } from '@/hooks/useToast';

const labelWidth = 120;

Expand All @@ -79,6 +80,7 @@ const Form = ({
const { formSliderListConfig } = useGlobalStore();
const { userSourcePrice } = useUserStore();
const router = useRouter();
const { toast } = useToast();
const { name } = router.query as QueryType;
const theme = useTheme();
const isEdit = useMemo(() => !!name, [name]);
Expand Down Expand Up @@ -1101,7 +1103,16 @@ const Form = ({
className={styles.deleteIcon}
ml={3}
cursor={'pointer'}
onClick={() => removeStoreList(index)}
onClick={() => {
if (storeList.length === 1) {
toast({
title: t('Store At Least One'),
status: 'error'
});
} else {
removeStoreList(index);
}
}}
>
<MyIcon name="delete" w={'16px'} h={'16px'} />
</Box>
Expand Down