@yuku123/z-ops-frontend-component 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/z-ops-component.es.js +758 -0
- package/dist/z-ops-component.umd.js +23 -0
- package/package.json +56 -0
- package/src/api.js +113 -0
- package/src/components/ChannelPage/index.jsx +80 -0
- package/src/components/DeliveryPage/index.jsx +78 -0
- package/src/components/DeploymentPage/index.jsx +79 -0
- package/src/components/DomainPage/index.jsx +18 -0
- package/src/components/EcsPage/index.jsx +18 -0
- package/src/components/RdOpsPage/index.jsx +39 -0
- package/src/components/RdsPage/index.jsx +18 -0
- package/src/components/ResourceOssPage/index.jsx +36 -0
- package/src/components/SprintPage/index.jsx +18 -0
- package/src/components/TaskPage/index.jsx +42 -0
- package/src/index.js +37 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 对象存储 (OSS Bucket 列表)
|
|
3
|
+
*/
|
|
4
|
+
import {useEffect, useState} from 'react'
|
|
5
|
+
import {Button, message, Space, Table} from 'antd'
|
|
6
|
+
import {FolderOpenOutlined, ReloadOutlined} from '@ant-design/icons'
|
|
7
|
+
import {ossBucketApi} from '../../api'
|
|
8
|
+
|
|
9
|
+
const ResourceOssPage = () => {
|
|
10
|
+
const [data, setData] = useState([])
|
|
11
|
+
const [loading, setLoading] = useState(false)
|
|
12
|
+
const fetchData = async () => { setLoading(true); try { setData(await ossBucketApi.list() || []) } catch { message.error('加载 Bucket 列表失败') } finally { setLoading(false) } }
|
|
13
|
+
useEffect(() => { fetchData() }, [])
|
|
14
|
+
|
|
15
|
+
const columns = [
|
|
16
|
+
{title: 'Bucket 名称', dataIndex: 'name', copyable: true},
|
|
17
|
+
{title: '创建时间', dataIndex: 'createdAt', width: 180},
|
|
18
|
+
{title: '存储类型', dataIndex: 'storageClass', width: 100, render: v => v || '标准'},
|
|
19
|
+
{title: '区域', dataIndex: 'region', width: 100},
|
|
20
|
+
{title: '对象数', dataIndex: 'objectCount', width: 100, render: v => v ?? '-'},
|
|
21
|
+
{title: '用量', dataIndex: 'sizeGb', width: 100, render: v => v != null ? `${v} GB` : '-'},
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div style={{padding: 24}}>
|
|
26
|
+
<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 24}}>
|
|
27
|
+
<div><h2 style={{margin: 0, fontSize: 20, fontWeight: 600}}><FolderOpenOutlined style={{marginRight: 8}}/>对象存储</h2><span style={{color: '#8a8f98', fontSize: 14}}>OSS Bucket 与文件目录</span></div>
|
|
28
|
+
<Button icon={<ReloadOutlined/>} onClick={fetchData}>刷新</Button>
|
|
29
|
+
</div>
|
|
30
|
+
<div style={{background: 'rgba(255,255,255,0.02)', border: '1px solid rgba(255,255,255,0.06)', borderRadius: 8, padding: 16}}>
|
|
31
|
+
<Table columns={columns} dataSource={data} loading={loading} rowKey="name" pagination={{pageSize: 10}} locale={{emptyText: '暂无 Bucket'}}/>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
export default ResourceOssPage
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 迭代管理 (占位页面,后端 API 待开发)
|
|
3
|
+
*/
|
|
4
|
+
import {Empty} from 'antd'
|
|
5
|
+
import {CalendarOutlined} from '@ant-design/icons'
|
|
6
|
+
|
|
7
|
+
const SprintPage = () => (
|
|
8
|
+
<div style={{padding: 24}}>
|
|
9
|
+
<h2 style={{margin: '0 0 8px', fontSize: 20, fontWeight: 600}}>
|
|
10
|
+
<CalendarOutlined style={{marginRight: 8}}/>迭代管理
|
|
11
|
+
</h2>
|
|
12
|
+
<p style={{color: '#8a8f98', marginBottom: 24}}>管理研发迭代与里程碑</p>
|
|
13
|
+
<div style={{background: 'rgba(255,255,255,0.02)', border: '1px solid rgba(255,255,255,0.06)', borderRadius: 8, padding: 48}}>
|
|
14
|
+
<Empty description="后端 API 开发中,敬请期待"/>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
export default SprintPage
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 部署记录 (DeploymentRecord list, filtered by unit)
|
|
3
|
+
*/
|
|
4
|
+
import {useEffect, useState} from 'react'
|
|
5
|
+
import {message, Select, Space, Table, Tag} from 'antd'
|
|
6
|
+
import {deploymentUnitApi, recordApi} from '../../api'
|
|
7
|
+
|
|
8
|
+
const TaskPage = () => {
|
|
9
|
+
const [data, setData] = useState([])
|
|
10
|
+
const [units, setUnits] = useState([])
|
|
11
|
+
const [selectedUnit, setSelectedUnit] = useState(null)
|
|
12
|
+
const [loading, setLoading] = useState(false)
|
|
13
|
+
|
|
14
|
+
useEffect(() => { (async () => { try { const list = await deploymentUnitApi.list() || []; setUnits(list); if (list.length) setSelectedUnit(list[0].id) } catch { message.error('加载部署单元失败') } })() }, [])
|
|
15
|
+
useEffect(() => { if (!selectedUnit) { setData([]); return }; (async () => { setLoading(true); try { setData(await recordApi.list(selectedUnit) || []) } catch { message.error('加载记录失败') } finally { setLoading(false) } })() }, [selectedUnit])
|
|
16
|
+
|
|
17
|
+
const statusMap = {SUCCESS: {text: '成功', color: 'green'}, FAILED: {text: '失败', color: 'red'}, RUNNING: {text: '运行中', color: 'processing'}, PENDING: {text: '等待中', color: 'default'}}
|
|
18
|
+
const columns = [
|
|
19
|
+
{title: 'ID', dataIndex: 'id', width: 60},
|
|
20
|
+
{title: '分支', dataIndex: 'branch', width: 120},
|
|
21
|
+
{title: 'Commit', dataIndex: 'commitId', width: 100, ellipsis: true, render: v => v ? <code>{v.substring(0, 8)}</code> : '-'},
|
|
22
|
+
{title: '部署人', dataIndex: 'deployer', width: 100},
|
|
23
|
+
{title: '触发方式', dataIndex: 'triggerType', width: 100, render: v => ({MANUAL: '手动', WEBHOOK: 'Webhook', SCHEDULE: '定时'}[v] || v || '-')},
|
|
24
|
+
{title: '开始时间', dataIndex: 'startedAt', width: 170},
|
|
25
|
+
{title: '结束时间', dataIndex: 'finishedAt', width: 170},
|
|
26
|
+
{title: '状态', dataIndex: 'status', width: 90, render: v => { const s = statusMap[v] || {text: v, color: 'default'}; return <Tag color={s.color}>{s.text}</Tag> }},
|
|
27
|
+
{title: '结果', dataIndex: 'result', ellipsis: true}
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div style={{padding: 24}}>
|
|
32
|
+
<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 24}}>
|
|
33
|
+
<div><h2 style={{margin: 0, fontSize: 20, fontWeight: 600}}>部署记录</h2><span style={{color: '#8a8f98', fontSize: 14}}>查看历史部署记录</span></div>
|
|
34
|
+
<Space><span style={{color: '#8a8f98'}}>部署单元:</span><Select value={selectedUnit} onChange={setSelectedUnit} style={{width: 240}}>{units.map(u => <Select.Option key={u.id} value={u.id}>{u.name}</Select.Option>)}</Select></Space>
|
|
35
|
+
</div>
|
|
36
|
+
<div style={{background: 'rgba(255,255,255,0.02)', border: '1px solid rgba(255,255,255,0.06)', borderRadius: 8, padding: 16}}>
|
|
37
|
+
<Table columns={columns} dataSource={data} loading={loading} rowKey="id" pagination={{pageSize: 10}} locale={{emptyText: '暂无部署记录'}}/>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
export default TaskPage
|
package/src/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* z-ops 共享前端组件库 - 导出所有可复用页面组件
|
|
3
|
+
* 打包后发布到 npm,供 z-opc-main-starter-frontend 等 shell 应用使用
|
|
4
|
+
*
|
|
5
|
+
* 使用方式:
|
|
6
|
+
* import { ChannelPage, DeliveryPage, ... } from '@yuku123/z-ops-frontend-component'
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// 运维中心 - 直挂页面
|
|
10
|
+
export {default as ChannelPage} from './components/ChannelPage' // 渠道管理 (DeploymentTarget CRUD)
|
|
11
|
+
export {default as DeliveryPage} from './components/DeliveryPage' // 环境管理 (Environment CRUD)
|
|
12
|
+
export {default as DeploymentPage} from './components/DeploymentPage' // 部署单元 (DeploymentUnit CRUD + deploy)
|
|
13
|
+
export {default as TaskPage} from './components/TaskPage' // 部署记录 (DeploymentRecord list)
|
|
14
|
+
|
|
15
|
+
// 资源管理
|
|
16
|
+
export {default as ResourceOssPage} from './components/ResourceOssPage' // OSS Bucket 列表
|
|
17
|
+
export {default as DomainPage} from './components/DomainPage' // 域名管理 (占位)
|
|
18
|
+
export {default as EcsPage} from './components/EcsPage' // ECS 管理 (占位)
|
|
19
|
+
export {default as RdsPage} from './components/RdsPage' // RDS 管理 (占位)
|
|
20
|
+
|
|
21
|
+
// 研发协同
|
|
22
|
+
export {default as RdOpsPage} from './components/RdOpsPage' // 镜像构建记录
|
|
23
|
+
export {default as SprintPage} from './components/SprintPage' // 迭代管理 (占位)
|
|
24
|
+
|
|
25
|
+
// API 客户端 (供外部自定义扩展)
|
|
26
|
+
export {
|
|
27
|
+
configureApiBaseURL,
|
|
28
|
+
deploymentUnitApi,
|
|
29
|
+
targetApi,
|
|
30
|
+
environmentApi,
|
|
31
|
+
recordApi,
|
|
32
|
+
webhookApi,
|
|
33
|
+
imageApi,
|
|
34
|
+
imageTagApi,
|
|
35
|
+
imageBuildApi,
|
|
36
|
+
ossBucketApi,
|
|
37
|
+
} from './api'
|