Skip to content

Commit

Permalink
refactor:license optimized deployment command form (#4532)
Browse files Browse the repository at this point in the history
* refactor:license optimized deployment command form

Signed-off-by: jingyang <3161362058@qq.com>

* fix

---------

Signed-off-by: jingyang <3161362058@qq.com>
  • Loading branch information
zjy365 authored Feb 29, 2024
1 parent 53ecc9e commit 70b1f5c
Show file tree
Hide file tree
Showing 27 changed files with 4,806 additions and 5,452 deletions.
6 changes: 5 additions & 1 deletion service/license/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"gen:theme-typings": "pnpm chakra-cli tokens ./src/styles/chakraTheme.ts --out node_modules/.pnpm/node_modules/@chakra-ui/styled-system/dist/theming.types.d.ts",
"postinstall": "pnpm run gen:theme-typings"
},
"dependencies": {
"@alicloud/dysmsapi20170525": "^2.0.24",
"@alicloud/openapi-client": "^0.4.6",
"@alicloud/tea-util": "^1.4.7",
"@chakra-ui/anatomy": "^2.2.2",
"@chakra-ui/react": "^2.8.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
Expand Down Expand Up @@ -49,6 +52,7 @@
"zustand": "^4.4.3"
},
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",
"@types/js-cookie": "^3.0.4",
"@types/js-yaml": "^4.0.8",
"@types/jsonwebtoken": "^9.0.4",
Expand Down
8,607 changes: 3,682 additions & 4,925 deletions service/license/pnpm-lock.yaml

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions service/license/src/components/Icon/AddIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Icon, IconProps } from '@chakra-ui/react';

export const AddIcon = (props: IconProps) => {
return (
<Icon
xmlns="http://www.w3.org/2000/svg"
width="18px"
height="18px"
viewBox="0 0 18 18"
fill="#485264"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M9 3C9.41421 3 9.75 3.33579 9.75 3.75V8.25H14.25C14.6642 8.25 15 8.58579 15 9C15 9.41421 14.6642 9.75 14.25 9.75H9.75V14.25C9.75 14.6642 9.41421 15 9 15C8.58579 15 8.25 14.6642 8.25 14.25V9.75H3.75C3.33579 9.75 3 9.41421 3 9C3 8.58579 3.33579 8.25 3.75 8.25H8.25V3.75C8.25 3.33579 8.58579 3 9 3Z"
/>
</Icon>
);
};
19 changes: 19 additions & 0 deletions service/license/src/components/Icon/BookIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Icon, IconProps } from '@chakra-ui/react';
export const BookIcon = (props: IconProps) => {
return (
<Icon
xmlns="http://www.w3.org/2000/svg"
width="12px"
height="13px"
viewBox="0 0 12 13"
fill="#111824"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M2.76076 2.1832L2.99243 2.1832C3.50372 2.18319 3.91951 2.18319 4.25694 2.21076C4.60546 2.23923 4.91673 2.29974 5.20634 2.4473C5.51564 2.6049 5.78572 2.82618 5.99997 3.09456C6.21422 2.82618 6.48429 2.6049 6.7936 2.4473C7.08321 2.29974 7.39448 2.23923 7.74299 2.21076C8.08042 2.18319 8.49621 2.18319 9.0075 2.1832L9.23917 2.1832C9.48728 2.18319 9.70459 2.18318 9.88424 2.19786C10.0749 2.21343 10.2692 2.24814 10.4576 2.3441C10.7353 2.48563 10.9612 2.71147 11.1027 2.98924C11.1987 3.17759 11.2334 3.37193 11.2489 3.56256C11.2636 3.74221 11.2636 3.95952 11.2636 4.20762V8.79236C11.2636 9.04046 11.2636 9.25777 11.2489 9.43742C11.2334 9.62805 11.1987 9.82239 11.1027 10.0107C10.9612 10.2885 10.7353 10.5143 10.4576 10.6559C10.2692 10.7518 10.0749 10.7865 9.88424 10.8021C9.70459 10.8168 9.48727 10.8168 9.23916 10.8168H2.76077C2.51266 10.8168 2.29535 10.8168 2.11569 10.8021C1.92506 10.7865 1.73072 10.7518 1.54238 10.6559C1.2646 10.5143 1.03876 10.2885 0.897231 10.0107C0.801266 9.82239 0.766562 9.62805 0.750987 9.43742C0.736309 9.25777 0.736318 9.04045 0.736329 8.79235V4.20763C0.736318 3.95953 0.736309 3.74221 0.750987 3.56256C0.766562 3.37193 0.801266 3.17759 0.897231 2.98924C1.03876 2.71147 1.2646 2.48563 1.54238 2.3441C1.73072 2.24814 1.92506 2.21343 2.11569 2.19786C2.29534 2.18318 2.51266 2.18319 2.76076 2.1832ZM5.47056 5.74251C5.47056 5.20349 5.47015 4.83107 5.44652 4.54185C5.4234 4.25881 5.3807 4.10239 5.32186 3.98692C5.19107 3.73021 4.98236 3.5215 4.72565 3.3907C4.61018 3.33187 4.45376 3.28917 4.17072 3.26605C3.8815 3.24242 3.50908 3.242 2.97006 3.242H2.78069C2.50681 3.242 2.33324 3.24242 2.20191 3.25315C2.07676 3.26337 2.03726 3.28027 2.02306 3.2875C1.94452 3.32753 1.88066 3.39139 1.84063 3.46993C1.8334 3.48413 1.8165 3.52363 1.80628 3.64878C1.79555 3.78011 1.79514 3.95368 1.79514 4.22756V8.77242C1.79514 9.0463 1.79555 9.21987 1.80628 9.3512C1.8165 9.47635 1.8334 9.51584 1.84063 9.53004C1.88066 9.60859 1.94452 9.67245 2.02306 9.71247C2.03726 9.71971 2.07676 9.73661 2.20191 9.74683C2.33324 9.75756 2.50681 9.75797 2.78069 9.75797H5.47056V5.74251ZM6.52937 9.75797V5.74251C6.52937 5.20349 6.52978 4.83107 6.55341 4.54185C6.57654 4.25881 6.61923 4.10239 6.67807 3.98692C6.80887 3.73021 7.01758 3.5215 7.27429 3.3907C7.38976 3.33187 7.54617 3.28917 7.82921 3.26605C8.11843 3.24242 8.49086 3.242 9.02988 3.242H9.21925C9.49312 3.242 9.66669 3.24242 9.79802 3.25315C9.92317 3.26337 9.96267 3.28027 9.97687 3.2875C10.0554 3.32753 10.1193 3.39139 10.1593 3.46993C10.1665 3.48413 10.1834 3.52363 10.1937 3.64878C10.2044 3.78011 10.2048 3.95368 10.2048 4.22756V8.77242C10.2048 9.0463 10.2044 9.21987 10.1937 9.3512C10.1834 9.47635 10.1665 9.51584 10.1593 9.53004C10.1193 9.60859 10.0554 9.67245 9.97687 9.71247C9.96267 9.71971 9.92317 9.73661 9.79802 9.74683C9.66669 9.75756 9.49312 9.75797 9.21925 9.75797H6.52937Z"
/>
</Icon>
);
};
20 changes: 20 additions & 0 deletions service/license/src/components/Icon/CodeIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Icon, IconProps } from '@chakra-ui/react';
export const CodeIcon = (props: IconProps) => {
return (
<Icon
xmlns="http://www.w3.org/2000/svg"
width="18px"
height="18px"
viewBox="0 0 18 18"
fill="none"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10.6627 1.51785C11.067 1.60771 11.322 2.00834 11.2321 2.41269L8.23214 15.9127C8.14228 16.317 7.74165 16.572 7.3373 16.4821C6.93295 16.3923 6.678 15.9916 6.76786 15.5873L9.76786 2.08729C9.85772 1.68295 10.2583 1.428 10.6627 1.51785ZM5.78033 4.71966C6.07322 5.01256 6.07322 5.48743 5.78033 5.78032L2.56066 8.99999L5.78033 12.2197C6.07322 12.5126 6.07322 12.9874 5.78033 13.2803C5.48744 13.5732 5.01256 13.5732 4.71967 13.2803L0.96967 9.53032C0.676777 9.23743 0.676777 8.76256 0.96967 8.46966L4.71967 4.71966C5.01256 4.42677 5.48744 4.42677 5.78033 4.71966ZM12.2197 4.71966C12.5126 4.42677 12.9874 4.42677 13.2803 4.71966L17.0303 8.46966C17.3232 8.76256 17.3232 9.23743 17.0303 9.53032L13.2803 13.2803C12.9874 13.5732 12.5126 13.5732 12.2197 13.2803C11.9268 12.9874 11.9268 12.5126 12.2197 12.2197L15.4393 8.99999L12.2197 5.78032C11.9268 5.48743 11.9268 5.01256 12.2197 4.71966Z"
fill="#111824"
/>
</Icon>
);
};
20 changes: 20 additions & 0 deletions service/license/src/components/Icon/InfoIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Icon, IconProps } from '@chakra-ui/react';
export const InfoIcon = (props: IconProps) => {
return (
<Icon
xmlns="http://www.w3.org/2000/svg"
width="16px"
height="16px"
viewBox="0 0 16 16"
fill="none"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M8 2.34627C4.87753 2.34627 2.34627 4.87753 2.34627 8C2.34627 11.1225 4.87753 13.6537 8 13.6537C11.1225 13.6537 13.6537 11.1225 13.6537 8C13.6537 4.87753 11.1225 2.34627 8 2.34627ZM1.01294 8C1.01294 4.14115 4.14115 1.01294 8 1.01294C11.8588 1.01294 14.9871 4.14115 14.9871 8C14.9871 11.8588 11.8588 14.9871 8 14.9871C4.14115 14.9871 1.01294 11.8588 1.01294 8ZM7.33333 5.47184C7.33333 5.10365 7.63181 4.80518 8 4.80518H8.00632C8.37451 4.80518 8.67299 5.10365 8.67299 5.47184C8.67299 5.84003 8.37451 6.13851 8.00632 6.13851H8C7.63181 6.13851 7.33333 5.84003 7.33333 5.47184ZM8 7.33333C8.36819 7.33333 8.66667 7.63181 8.66667 8V10.5282C8.66667 10.8963 8.36819 11.1948 8 11.1948C7.63181 11.1948 7.33333 10.8963 7.33333 10.5282V8C7.33333 7.63181 7.63181 7.33333 8 7.33333Z"
fill="#0884DD"
/>
</Icon>
);
};
11 changes: 6 additions & 5 deletions service/license/src/components/Icon/OnlineComputerIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ export const OnlineComputerIcon = (props: IconProps) => {
return (
<Icon
xmlns="http://www.w3.org/2000/svg"
width="24px"
height="25px"
viewBox="0 0 24 25"
fill="#24282C"
width="20px"
height="21px"
viewBox="0 0 20 21"
fill="none"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M3.77232 5.62415C3.77232 5.2728 4.05713 4.98799 4.40848 4.98799H19.5915C19.9429 4.98799 20.2277 5.2728 20.2277 5.62415V15.8027C20.2277 16.1541 19.9429 16.4389 19.5915 16.4389H4.40848C4.05713 16.4389 3.77232 16.1541 3.77232 15.8027V5.62415ZM19.5915 3.71567H4.40848C3.35445 3.71567 2.5 4.57012 2.5 5.62415V15.8027C2.5 16.8568 3.35445 17.7112 4.40848 17.7112H10.1021V19.9378C10.1021 19.9629 10.1036 19.9876 10.1064 20.012H8.60714C8.25579 20.012 7.97098 20.2968 7.97098 20.6481C7.97098 20.9995 8.25579 21.2843 8.60714 21.2843H15.3929C15.7442 21.2843 16.029 20.9995 16.029 20.6481C16.029 20.2968 15.7442 20.012 15.3929 20.012H13.9148C13.9176 19.9876 13.9191 19.9629 13.9191 19.9378V17.7112H19.5915C20.6456 17.7112 21.5 16.8568 21.5 15.8027V5.62415C21.5 4.57012 20.6456 3.71567 19.5915 3.71567ZM12.6468 17.7112H11.3744V19.9378C11.3744 19.9629 11.373 19.9876 11.3702 20.012H12.651C12.6482 19.9876 12.6468 19.9629 12.6468 19.9378V17.7112ZM5.63839 14.6046C5.63839 14.956 5.9232 15.2408 6.27455 15.2408H17.7254C18.0768 15.2408 18.3616 14.956 18.3616 14.6046C18.3616 14.2533 18.0768 13.9685 17.7254 13.9685H6.27455C5.9232 13.9685 5.63839 14.2533 5.63839 14.6046Z"
d="M5.91896 2.66229H14.081C14.7059 2.66228 15.2248 2.66227 15.6483 2.69687C16.0892 2.73289 16.4994 2.81053 16.8861 3.0076C17.4823 3.31134 17.9669 3.796 18.2707 4.39212C18.4677 4.77889 18.5454 5.18908 18.5814 5.62994C18.616 6.0534 18.616 6.57238 18.616 7.1972V10.6897C18.616 11.3146 18.616 11.8335 18.5814 12.257C18.5454 12.6979 18.4677 13.108 18.2707 13.4948C17.9669 14.0909 17.4823 14.5756 16.8861 14.8793C16.4994 15.0764 16.0892 15.154 15.6483 15.1901C15.2248 15.2247 14.7058 15.2247 14.081 15.2246H10.8333V16.671H13.1131C13.5733 16.671 13.9464 17.0441 13.9464 17.5044C13.9464 17.9646 13.5733 18.3377 13.1131 18.3377H6.88695C6.42671 18.3377 6.05361 17.9646 6.05361 17.5044C6.05361 17.0441 6.42671 16.671 6.88695 16.671H9.16666V15.2246H5.91898C5.29415 15.2247 4.77515 15.2247 4.35169 15.1901C3.91082 15.154 3.50064 15.0764 3.11386 14.8793C2.51774 14.5756 2.03308 14.0909 1.72934 13.4948C1.53227 13.108 1.45463 12.6979 1.41861 12.257C1.38401 11.8335 1.38402 11.3145 1.38403 10.6897V7.19722C1.38402 6.5724 1.38401 6.05341 1.41861 5.62994C1.45463 5.18908 1.53227 4.77889 1.72934 4.39212C2.03308 3.796 2.51774 3.31134 3.11386 3.0076C3.50063 2.81053 3.91082 2.73289 4.35169 2.69687C4.77515 2.66227 5.29414 2.66228 5.91896 2.66229ZM14.047 13.558C14.7145 13.558 15.1651 13.5573 15.5126 13.5289C15.8504 13.5013 16.0168 13.4517 16.1295 13.3943C16.412 13.2504 16.6417 13.0207 16.7856 12.7382C16.8431 12.6255 16.8927 12.4591 16.9203 12.1213C16.9486 11.7737 16.9493 11.3232 16.9493 10.6556V7.23129C16.9493 6.56374 16.9486 6.11319 16.9203 5.76566C16.8927 5.42787 16.8431 5.26143 16.7856 5.14877C16.6417 4.86625 16.412 4.63656 16.1295 4.49261C16.0168 4.4352 15.8504 4.3856 15.5126 4.358C15.1651 4.32961 14.7145 4.32896 14.047 4.32896H5.95303C5.28548 4.32896 4.83493 4.32961 4.48741 4.358C4.14961 4.3856 3.98317 4.4352 3.87051 4.49261C3.58799 4.63656 3.3583 4.86625 3.21435 5.14877C3.15694 5.26143 3.10734 5.42787 3.07974 5.76566C3.05135 6.11319 3.0507 6.56374 3.0507 7.23129V10.6556C3.0507 11.3232 3.05135 11.7737 3.07974 12.1213C3.10734 12.4591 3.15694 12.6255 3.21435 12.7382C3.3583 13.0207 3.58799 13.2504 3.87051 13.3943C3.98317 13.4517 4.14961 13.5013 4.48741 13.5289C4.83493 13.5573 5.28548 13.558 5.95303 13.558H14.047Z"
fill="#111824"
/>
</Icon>
);
Expand Down
20 changes: 20 additions & 0 deletions service/license/src/components/Icon/ReduceIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Icon, IconProps } from '@chakra-ui/react';

export const ReduceIcon = (props: IconProps) => {
return (
<Icon
xmlns="http://www.w3.org/2000/svg"
width="18px"
height="18px"
viewBox="0 0 18 18"
fill="#485264"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M3.14999 9C3.14999 8.58579 3.48577 8.25 3.89999 8.25H14.1C14.5142 8.25 14.85 8.58579 14.85 9C14.85 9.41421 14.5142 9.75 14.1 9.75H3.89999C3.48577 9.75 3.14999 9.41421 3.14999 9Z"
/>
</Icon>
);
};
4 changes: 4 additions & 0 deletions service/license/src/components/Icon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ export * from './OnlineComputerIcon';
export * from './CopyIcon';
export * from './TimeIcon';
export * from './LeftIcon';
export * from './BookIcon';
export * from './CodeIcon';
export * from './ReduceIcon';
export * from './AddIcon';
82 changes: 82 additions & 0 deletions service/license/src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React, { useMemo } from 'react';
import { Box, Grid } from '@chakra-ui/react';
import type { GridProps } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';

// @ts-ignore
interface Props extends GridProps {
list: { id: string; label: string }[];
activeId: string;
size?: 'sm' | 'md' | 'lg';
onChange: (id: string) => void;
}

const Tabs = ({ list, size = 'md', activeId, onChange, ...props }: Props) => {
const { t } = useTranslation();
const sizeMap = useMemo(() => {
switch (size) {
case 'sm':
return {
fontSize: 'xs',
outP: '3px',
inlineP: 1
};
case 'md':
return {
fontSize: 'md',
outP: '4px',
inlineP: 2
};
case 'lg':
return {
fontSize: 'lg',
outP: '5px',
inlineP: 3
};
}
}, [size]);
return (
<Grid
border={'1px solid #E8EBF0'}
gridTemplateColumns={`repeat(${list.length},1fr)`}
p={sizeMap.outP}
borderRadius={'8px'}
backgroundColor={'gray.50'}
fontSize={sizeMap.fontSize}
fontWeight={500}
{...props}
>
{list.map((item) => (
<Box
key={item.id}
px={'2'}
py={sizeMap.inlineP}
borderRadius={'6px'}
textAlign={'center'}
_hover={{
color: 'brightBlue.600'
}}
{...(activeId === item.id
? {
boxShadow: '0px 2px 2px rgba(137, 156, 171, 0.25)',
backgroundColor: 'white',
cursor: 'default',
color: 'gray.900'
}
: {
cursor: 'pointer',
color: 'gray.500'
})}
onClick={() => {
if (activeId === item.id) return;
onChange(item.id);
}}
>
{t(item.label)}
</Box>
))}
</Grid>
);
};

export default Tabs;
2 changes: 1 addition & 1 deletion service/license/src/components/Textarea/TagTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const TagTextarea = ({ defaultValues, onUpdate, inputStyle, ...props }: Props) =
bg={'#FBFBFC'}
{...(focus && {
boxShadow: '0px 0px 4px #A8DBFF',
borderColor: 'myBlue.600',
borderColor: 'blue.600',
bg: '#FFFFFF'
})}
{...props}
Expand Down
12 changes: 4 additions & 8 deletions service/license/src/hooks/useConfirm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
Button,
Center,
Flex,
Modal,
Expand Down Expand Up @@ -48,23 +49,18 @@ export const useConfirm = () => {
<Text mt="28px" fontSize={'14px'} fontWeight={400} color={'#7B838B'}>
点击立即开始后将会新建一个集群
</Text>
<Center
<Button
mt="62px"
w="218px"
h="44px"
bg={'#24282C'}
color={'white'}
fontSize={'14px'}
fontWeight={500}
borderRadius={'4px'}
cursor={'pointer'}
variant={'black'}
onClick={() => {
onClose();
typeof confirmCb.current === 'function' && confirmCb.current();
}}
>
立即开始
</Center>
</Button>
<Center
mt="16px"
w="218px"
Expand Down
14 changes: 4 additions & 10 deletions service/license/src/pages/cluster/components/ClusterPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default function TutorialPanel() {
{!clusterDetail?.kubeSystemID && (
<Flex mt="16px" justifyContent={'end'}>
<Button
w="114px"
w="100px"
h="36px"
variant={'black'}
onClick={() => handleUpdateCluster({ updateName: false })}
Expand All @@ -150,14 +150,7 @@ export default function TutorialPanel() {
</Flex>

<Flex mt="16px" justifyContent={'end'}>
<Button
w="114px"
h="36px"
variant={'black'}
onClick={() => handleUpdateCluster({ updateName: true })}
>
保存
</Button>
<Button onClick={() => handleUpdateCluster({ updateName: true })}>保存</Button>
</Flex>
</Box>
<Flex
Expand All @@ -166,10 +159,11 @@ export default function TutorialPanel() {
justifyContent="center"
w="100%"
h="44px"
bg="#fff"
borderRadius={'8px'}
cursor={'pointer'}
onClick={handleDelteCluster}
bg="white"
_hover={{ bg: 'red.50' }}
>
<DeleteIcon fill={'#FF324A'} w="20px" h="20px" mr="8px" />
<Text color={'#FF324A'} fontSize={'14px'} fontWeight={600}>
Expand Down
Loading

0 comments on commit 70b1f5c

Please sign in to comment.