Skip to content

Commit d17c05b

Browse files
authored
feat: add stack delete/action (#1383)
* feat: add stack delete/action * feat: add workspace list paganation
1 parent 7682e8c commit d17c05b

File tree

16 files changed

+347
-157
lines changed

16 files changed

+347
-157
lines changed

ui/src/components/descriptionWithTooltip/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { Tooltip } from 'antd'
33

44
import styles from './styles.module.less'
55

6-
const DescriptionWithTooltip = ({ desc, width }) => {
6+
type IProps = {
7+
desc: string
8+
width?: number | string
9+
}
10+
11+
const DescriptionWithTooltip = ({ desc, width }: IProps) => {
712

813
return (<Tooltip placement="topLeft" title={desc}>
914
<div className={styles.descriptionWithTooltip} style={{ width }}>

ui/src/components/topologyMap/index.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const OverviewTooltip: React.FC<OverviewTooltipProps> = ({
159159
<div style={itemStyle}>
160160
<span style={labelStyle}>Status: </span>
161161
<span style={statusStyle}>
162-
{nodeData?.status}
162+
{nodeData?.status}
163163
</span>
164164
</div>
165165
<div style={itemStyle}>
@@ -481,6 +481,10 @@ const TopologyMap = forwardRef((props: IProps, drawRef) => {
481481

482482
function drawGraph(topologyData) {
483483
if (topologyData) {
484+
if (graphRef.current) {
485+
graphRef.current?.destroy()
486+
graphRef.current = null
487+
}
484488
if (!graphRef.current) {
485489
graphRef.current = initGraph()
486490
graphRef.current?.read(topologyData)

ui/src/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import './index.less'
1313

1414
const portAPI = 'api/server-port';
1515
const defaultPort = '80';
16+
const defalutUrl = 'http://localhost';
1617

1718
async function loadServerConfig() {
1819
const isDevelopment = process.env.NODE_ENV === 'development';
@@ -22,11 +23,11 @@ async function loadServerConfig() {
2223
const port = config?.port || defaultPort;
2324

2425
client.setConfig({
25-
baseUrl: isDevelopment ? `http://localhost:${port}` : ''
26+
baseUrl: isDevelopment ? `${defalutUrl}:${port}` : ''
2627
});
2728
} catch (error) {
2829
client.setConfig({
29-
baseUrl: isDevelopment ? `http://localhost:${defaultPort}` : ''
30+
baseUrl: isDevelopment ? `${defalutUrl}:${defaultPort}` : ''
3031
});
3132
}
3233
}

ui/src/pages/backends/index.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react'
22
import { Button, message, Popconfirm, Space, Table, Tag } from 'antd'
3+
import type { TableColumnsType } from 'antd'
34
import { PlusOutlined } from '@ant-design/icons'
45
import { BackendService } from '@kusionstack/kusion-api-client-sdk'
56
import { josn2yaml } from '@/utils/tools'
@@ -80,10 +81,11 @@ const BackendsPage = () => {
8081
}
8182

8283

83-
const columns = [
84+
const columns: TableColumnsType<any> = [
8485
{
8586
title: 'Name',
8687
dataIndex: 'name',
88+
fixed: 'left',
8789
},
8890
{
8991
title: 'Type',
@@ -95,7 +97,6 @@ const BackendsPage = () => {
9597
{
9698
title: 'Description',
9799
dataIndex: 'description',
98-
width: 500,
99100
render: (desc) => {
100101
return <DescriptionWithTooltip desc={desc} width={500} />
101102
}
@@ -110,6 +111,8 @@ const BackendsPage = () => {
110111
{
111112
title: 'Action',
112113
dataIndex: 'action',
114+
fixed: 'right',
115+
width: 150,
113116
render: (_, record) => {
114117
return (
115118
<Space>
@@ -206,6 +209,7 @@ const BackendsPage = () => {
206209
rowKey="id"
207210
columns={columns}
208211
dataSource={dataSource}
212+
scroll={{ x: 1300 }}
209213
/>
210214
</div>
211215
<ConfigYamlDrawer {...configYamlProps} />

ui/src/pages/modules/index.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react'
22
import { Button, Form, Input, message, Popconfirm, Space, Table, Select } from 'antd'
3+
import type { TableColumnsType } from 'antd';
34
import { PlusOutlined } from '@ant-design/icons'
45
import { ModuleService } from '@kusionstack/kusion-api-client-sdk'
56
import DescriptionWithTooltip from '@/components/descriptionWithTooltip'
@@ -103,31 +104,34 @@ const ModulePage = () => {
103104

104105

105106

106-
const columns = [
107+
const columns: TableColumnsType<any> = [
107108
{
108109
title: 'Name',
109110
dataIndex: 'name',
110111
width: 300,
112+
fixed: 'left',
111113
},
112114
{
113115
title: 'Registry',
114116
dataIndex: 'registry',
115-
width: 450,
117+
116118
render: (_, record) => {
117119
return `${record?.url?.Scheme}://${record?.url?.Host}${record?.url?.Path}`;
118120
}
119121
},
120122
{
121123
title: 'Description',
122124
dataIndex: 'description',
123-
width: 400,
125+
124126
render: (desc) => {
125127
return <DescriptionWithTooltip desc={desc} width={400} />
126128
}
127129
},
128130
{
129131
title: 'Action',
130132
dataIndex: 'action',
133+
fixed: 'right',
134+
width: 200,
131135
render: (_, record) => {
132136
return (
133137
<Space>
@@ -232,6 +236,7 @@ const ModulePage = () => {
232236
title={() => <h4>Module List</h4>}
233237
rowKey="id"
234238
columns={columns}
239+
scroll={{ x: 1300 }}
235240
dataSource={dataSource}
236241
pagination={{
237242
total: searchParams?.total,

ui/src/pages/projects/components/projectForm/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React, { useEffect, useState } from 'react';
22
import { Modal, Button, Form, Select, Input, message } from 'antd';
33

4-
const ProjectForm = ({ open, actionType, handleClose, handleSubmit, sourceList,formData }: any) => {
4+
const ProjectForm = ({ open, actionType, handleClose, handleSubmit, sourceList, formData }: any) => {
55
const [loading, setLoading] = useState(false);
66
const [form] = Form.useForm();
7-
7+
88
useEffect(() => {
99
if (formData) {
1010
form.setFieldsValue({
1111
name: formData?.name,
12-
projectSource: formData?.source?.name,
12+
projectSource: formData?.source?.id,
1313
path: formData?.path,
1414
description: formData?.description,
1515
})
@@ -38,7 +38,7 @@ const ProjectForm = ({ open, actionType, handleClose, handleSubmit, sourceList,f
3838
form.resetFields()
3939
handleClose()
4040
}
41-
41+
4242
function getTitle() {
4343
return actionType === 'ADD'
4444
? 'New Project'

ui/src/pages/projects/components/resourceGraph/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { generateG6GraphData } from '@/utils/tools'
66

77
const ResourceGraph = ({ stackId }) => {
88
const drawRef = useRef(null)
9-
109
const [graphData, setGraphData] = useState()
1110
const [topologyLoading, setTopologyLoading] = useState(false)
1211

0 commit comments

Comments
 (0)