Skip to content

Commit

Permalink
Merge pull request #58 from iamyeka/feat-finops-optimize
Browse files Browse the repository at this point in the history
feat(applicationInstance): one-click finops optimization
  • Loading branch information
iamyeka authored Dec 20, 2023
2 parents db60605 + 8b99bde commit 9b90fae
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 6 deletions.
5 changes: 5 additions & 0 deletions config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ const applicationRoutes = [
];

const instanceRoutes = [
{
path: '/instances/*/-/finops',
menuRender: false,
component: 'instances/FinOps',
},
{
path: '/instances/*/-/edit',
menuRender: false,
Expand Down
4 changes: 4 additions & 0 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ function formatClusterMenu(fullPath: string) {
path: `/instances${fullPath}/-/edit`,
menuRender: false,
},
{
path: `/instances${fullPath}/-/finops`,
menuRender: false,
},
{
path: `/instances${fullPath}/-/editv2`,
menuRender: false,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Widget/MicroApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function WithCheck<Props extends MicroAppProps & { defaultNode?: React.ReactElem
});
});
return ifRender ? (
<div style={{ display: 'inline-block' }}>
// eslint-disable-next-line react/destructuring-assignment
<div style={{ display: 'inline-block', ...props.style }}>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<WrappedComponent {...props} />
{' '}
Expand Down
26 changes: 26 additions & 0 deletions src/pages/instances/FinOps/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { useModel } from '@@/plugin-model/useModel';
import { Card, Modal } from 'antd';
import { MicroApp } from '@/components/Widget';
import PageWithBreadcrumb from '@/components/PageWithBreadcrumb';

export default (): React.ReactNode => {
const { initialState } = useModel('@@initialState');
const { id, name, fullPath } = initialState!.resource;
const { errorAlert } = useModel('alert');

return (
<PageWithBreadcrumb>
<MicroApp
style={{ width: '100%' }}
name="finopsconfirm"
clusterID={id}
clusterName={name}
fullPath={fullPath}
errorAlert={errorAlert}
card={Card}
modal={Modal}
/>
</PageWithBreadcrumb>
);
};
15 changes: 13 additions & 2 deletions src/pages/instances/Pods/components/ButtonBar.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions src/pages/instances/Pods/components/ButtonBarV2.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b90fae

Please sign in to comment.