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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(costcenter: invoice):fix amount #4294

Merged
merged 1 commit into from
Nov 14, 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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const ConfigMapOverviewPage = () => {
return (
<>
<Table
title={"Config Maps"}
title={'Config Maps'}
columns={columns}
dataSource={dataSource}
onRow={(record) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const DeploymentOverviewPage = () => {
return (
<>
<Table
title={"Deployments"}
title={'Deployments'}
columns={columns}
dataSource={dataSource}
onRow={(record) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ const ContainerDetail = ({ pod }: Props) => {

return (
<DrawerPanel title="Containers">
{initContainers.map((container) => (
<ContainerInfo key={container.name} pod={pod} container={container} isInitial={true} />
))}
{containers.map((container) => (
<ContainerInfo key={container.name} pod={pod} container={container} isInitial={false} />
))}
{initContainers.map((container) => (
<ContainerInfo key={container.name} pod={pod} container={container} isInitial={true} />
))}
{containers.map((container) => (
<ContainerInfo key={container.name} pod={pod} container={container} isInitial={false} />
))}
</DrawerPanel>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const StatefulSetOverviewPage = () => {
return (
<>
<Table
title={"Stateful Sets"}
title={'Stateful Sets'}
columns={columns}
dataSource={dataSource}
onRow={(record) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function InvoiceTable({
</Flex>
</Td>
<Td>{format(item.createdTime, 'MM-dd HH:mm')}</Td>
<Td color={'#219BF4'}>{item.payment?.amount || item.amount}</Td>
<Td color={'#219BF4'}>{item.amount}</Td>
</Tr>
))}
</Tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Invoice() {
.map<ReqGenInvoice['billings'][0]>((billing) => ({
createdTime: parseISO(billing.time).getTime(),
order_id: billing.order_id,
amount: formatMoney(billing.amount)
amount: formatMoney(billing.payment?.amount || billing.amount)
}));
return {
tableResult,
Expand Down Expand Up @@ -208,11 +208,11 @@ function Invoice() {
data={[...tableResult]}
onSelect={(checked, item) => {
if (checked) {
setInvoiceAmount(invoiceAmount + (item.payment?.amount || item.amount));
setInvoiceAmount(invoiceAmount + item.amount);
setInvoiceCount(invoiceCount + 1);
selectBillings.current.push({ ...item });
} else {
setInvoiceAmount(invoiceAmount - (item.payment?.amount || item.amount));
setInvoiceAmount(invoiceAmount - item.amount);
setInvoiceCount(invoiceCount - 1);
const idx = selectBillings.current.findIndex(
(billing) => billing.order_id === item.order_id
Expand Down
3 changes: 3 additions & 0 deletions frontend/providers/costcenter/src/types/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export type BillingItem<T = Costs> = {
amount: number;
appType: string;
costs: T;
payment?: {
amount: number;
};
order_id: string;
owner: string;
time: string;
Expand Down
3 changes: 0 additions & 3 deletions frontend/providers/costcenter/src/types/invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export type ReqGenInvoice = {
order_id: string;
amount: number;
// timeStamp
payment?: {
amount: number;
};
createdTime: number;
}[];
};
Expand Down
18 changes: 12 additions & 6 deletions frontend/providers/template/src/pages/app/components/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export default function InstanceList() {
w={'48px'}
h={'48px'}
justifyContent="center"
alignItems={'center'}>
alignItems={'center'}
>
<MyIcon color={'#7B838B'} name="empty"></MyIcon>
</Flex>
<Text mt={'12px'} fontSize={14} color={'#5A646E'}>
Expand All @@ -57,7 +58,8 @@ export default function InstanceList() {
pt="24px"
pr="42px"
pb="42px"
overflow={'auto'}>
overflow={'auto'}
>
{data &&
data?.map((item) => {
return (
Expand All @@ -77,15 +79,17 @@ export default function InstanceList() {
borderRadius={'8px'}
backgroundColor={'#fff'}
boxShadow={'0px 2px 4px 0px rgba(187, 196, 206, 0.25)'}
border={'1px solid #EAEBF0'}>
border={'1px solid #EAEBF0'}
>
<Box
p={'6px'}
w={'48px'}
h={'48px'}
boxShadow={'0px 1px 2px 0.5px rgba(84, 96, 107, 0.20)'}
borderRadius={'4px'}
backgroundColor={'#fff'}
border={' 1px solid rgba(255, 255, 255, 0.50)'}>
border={' 1px solid rgba(255, 255, 255, 0.50)'}
>
<Image src={item?.icon} alt="" width={'36px'} height={'36px'} />
</Box>
<Text fontSize="24px" fontWeight={600} color="#24282C">
Expand All @@ -97,7 +101,8 @@ export default function InstanceList() {
fontSize={'12px'}
color={'#5A646E'}
fontWeight={400}
mt="auto">
mt="auto"
>
{t('Creation Time')}: {item?.createTime}
</Text>
<Flex justifyContent={'space-between'} alignItems={'center'} gap={'20px'}>
Expand All @@ -108,7 +113,8 @@ export default function InstanceList() {
alignItems={'center'}
cursor={'pointer'}
background={'#F4F6F8'}
borderRadius={'4px'}>
borderRadius={'4px'}
>
<Icon width="16px" height="17px" viewBox="0 0 16 17" fill="#363C42">
<g mask="url(#mask0_821_49862)">
<path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ const ReadMe = ({ templateDetail }: { templateDetail: TemplateType }) => {
borderBottom={'1px solid #DEE0E2'}
color={'#24282C'}
fontSize={'18px'}
fontWeight={500}>
fontWeight={500}
>
<MyIcon name={'markdown'} mr={5} w={'24px'} h={'24px'} ml={'42px'} color={'myGray.500'} />
README.md
</Box>
<Box p={'24px'} className={`markdown-body ${styles.customMarkDownBody}`}>
<ReactMarkdown
linkTarget={'_blank'}
rehypePlugins={[rehypeRaw, [rehypeRewrite, { rewrite: myRewrite }]]}
remarkPlugins={[remarkGfm, remarkUnwrapImages]}>
remarkPlugins={[remarkGfm, remarkUnwrapImages]}
>
{templateReadMe}
</ReactMarkdown>
</Box>
Expand Down