/** * Copyright (c) OpenSpug Organization. https://github.com/openspug/spug * Copyright (c) * Released under the AGPL-3.0 License. */ import React, { useEffect } from 'react'; import { observer } from 'mobx-react'; import { Table, Modal, Dropdown, Button, Menu, Avatar, Tooltip, Space, Tag, message } from 'antd'; import { PlusOutlined, DownOutlined } from '@ant-design/icons'; import { Action, TableCard, AuthButton, AuthFragment } from 'components'; import { http, hasPermission } from 'libs'; import store from './store'; import icons from './icons'; function ComTable() { useEffect(() => { store.fetchRecords() }, []) function handleDelete(text) { Modal.confirm({ title: '删除确认', content: `确定要删除【${text['name']}】?`, onOk: () => { return http.delete('/api/host/', {params: {id: text.id}}) .then(() => { message.success('删除成功'); store.fetchRecords() }) } }) } function handleImport(menu) { if (menu.key === 'excel') { store.importVisible = true } else { store.cloudImport = menu.key } } function IpAddress(props) { if (props.ip && props.ip.length > 0) { return (
{props.ip[0]}({props.isPublic ? '公' : '私有'})
) } else { return null } } return ( store[k] = v}/>} loading={store.isFetching} dataSource={store.dataSource} onReload={store.fetchRecords} actions={[ } onClick={() => store.showForm()}>新建, Excel 阿里云 腾讯云 )}> ]} pagination={{ showSizeChanger: true, showLessItems: true, hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] }}> store.showDetail(info)}>{info.name}} sorter={(a, b) => a.name.localeCompare(b.name)}/> (
)}/> ( {info.cpu}核 {info.memory}GB )}/> v ? 已验证 : 未验证}/> {hasPermission('host.host.edit|host.host.del|host.host.console') && ( ( store.showForm(info)}>编辑 handleDelete(info)}>删除 )}/> )}
) } export default observer(ComTable)