diff --git a/spug_web/src/pages/alarm/contact/Table.js b/spug_web/src/pages/alarm/contact/Table.js index a0f032b..89a4491 100644 --- a/spug_web/src/pages/alarm/contact/Table.js +++ b/spug_web/src/pages/alarm/contact/Table.js @@ -7,7 +7,7 @@ import React from 'react'; import { observer } from 'mobx-react'; import { Table, Modal, message } from 'antd'; import ComForm from './Form'; -import {http, hasPermission} from 'libs'; +import { http, hasPermission } from 'libs'; import store from './store'; import { Action } from "components"; @@ -17,40 +17,6 @@ class ComTable extends React.Component { store.fetchRecords() } - columns = [{ - title: '序号', - key: 'series', - render: (_, __, index) => index + 1, - width: 80, - }, { - title: '姓名', - dataIndex: 'name', - }, { - title: '手机号', - dataIndex: 'phone', - }, { - title: '邮箱', - dataIndex: 'email', - ellipsis: true - }, { - title: '钉钉', - dataIndex: 'ding', - ellipsis: true - }, { - title: '企业微信', - dataIndex: 'qy_wx', - ellipsis: true - }, { - title: '操作', - className: hasPermission('alarm.contact.edit|alarm.contact.del') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - - ) - }]; - handleDelete = (text) => { Modal.confirm({ title: '删除确认', @@ -82,8 +48,22 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + index + 1}/> + + + + + + {hasPermission('alarm.contact.edit|alarm.contact.del') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + + )}/> + )} + {store.formVisible && } ) diff --git a/spug_web/src/pages/alarm/group/Table.js b/spug_web/src/pages/alarm/group/Table.js index 7e45681..0f53b49 100644 --- a/spug_web/src/pages/alarm/group/Table.js +++ b/spug_web/src/pages/alarm/group/Table.js @@ -7,7 +7,7 @@ import React from 'react'; import { observer } from 'mobx-react'; import { Table, Modal, message } from 'antd'; import ComForm from './Form'; -import {http, hasPermission} from 'libs'; +import { http, hasPermission } from 'libs'; import store from './store'; import contactStore from '../contact/store'; import { Action } from "components"; @@ -39,34 +39,6 @@ class ComTable extends React.Component { this.setState({contactMap: tmp}) }; - columns = [{ - title: '序号', - key: 'series', - render: (_, __, index) => index + 1, - width: 80, - }, { - title: '组名称', - dataIndex: 'name', - }, { - title: '成员', - dataIndex: 'contacts', - render: value => value.map(x => lds.get(this.state.contactMap, `${x}.name`)).join(','), - ellipsis: true - }, { - title: '描述信息', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - className: hasPermission('alarm.group.edit|alarm.group.del') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - - ) - }]; - handleDelete = (text) => { Modal.confirm({ title: '删除确认', @@ -101,8 +73,21 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + index + 1}/> + + value.map(x => lds.get(this.state.contactMap, `${x}.name`)).join(',')}/> + + {hasPermission('alarm.group.edit|alarm.group.del') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + + )}/> + )} + {store.formVisible && } ) diff --git a/spug_web/src/pages/config/app/Table.js b/spug_web/src/pages/config/app/Table.js index ebd5ad0..8dc6403 100644 --- a/spug_web/src/pages/config/app/Table.js +++ b/spug_web/src/pages/config/app/Table.js @@ -16,34 +16,6 @@ class ComTable extends React.Component { store.fetchRecords() } - columns = [{ - title: '序号', - key: 'series', - render: (_, __, index) => index + 1, - width: 80, - }, { - title: '应用名称', - dataIndex: 'name', - }, { - title: '标识符', - dataIndex: 'key', - }, { - title: '描述信息', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - className: hasPermission('config.app.edit|config.app.del|config.app.view_config') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - store.showRel(info)}>依赖 - 配置 - - ) - }]; - handleDelete = (text) => { Modal.confirm({ title: '删除确认', @@ -74,8 +46,22 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + index + 1}/> + + + + {hasPermission('config.app.edit|config.app.del|config.app.view_config') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + store.showRel(info)}>依赖 + 配置 + + )}/> + )} + ) } } diff --git a/spug_web/src/pages/config/environment/Table.js b/spug_web/src/pages/config/environment/Table.js index c2bae89..c75f043 100644 --- a/spug_web/src/pages/config/environment/Table.js +++ b/spug_web/src/pages/config/environment/Table.js @@ -7,7 +7,7 @@ import React from 'react'; import { observer } from 'mobx-react'; import { Table, Modal, message } from 'antd'; import ComForm from './Form'; -import {http, hasPermission} from 'libs'; +import { http, hasPermission } from 'libs'; import store from './store'; import { Action } from "components"; @@ -17,32 +17,6 @@ class ComTable extends React.Component { store.fetchRecords() } - columns = [{ - title: '序号', - key: 'series', - render: (_, __, index) => index + 1, - width: 80, - }, { - title: '环境名称', - dataIndex: 'name', - }, { - title: '标识符', - dataIndex: 'key', - }, { - title: '描述信息', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - className: hasPermission('config.env.edit|config.env.del') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - - ) - }]; - handleDelete = (text) => { Modal.confirm({ title: '删除确认', @@ -74,8 +48,20 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + index + 1}/> + + + + {hasPermission('config.env.edit|config.env.del') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + + )}/> + )} + {store.formVisible && } ) diff --git a/spug_web/src/pages/config/service/Table.js b/spug_web/src/pages/config/service/Table.js index a60f2bc..df8df67 100644 --- a/spug_web/src/pages/config/service/Table.js +++ b/spug_web/src/pages/config/service/Table.js @@ -17,33 +17,6 @@ class ComTable extends React.Component { store.fetchRecords() } - columns = [{ - title: '序号', - key: 'series', - render: (_, __, index) => index + 1, - width: 80, - }, { - title: '服务名称', - dataIndex: 'name', - }, { - title: '标识符', - dataIndex: 'key', - }, { - title: '描述信息', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - className: hasPermission('config.src.edit|config.src.del|config.src.view_config') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - 配置 - - ) - }]; - handleDelete = (text) => { Modal.confirm({ title: '删除确认', @@ -75,8 +48,21 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + index + 1}/> + + + + {hasPermission('config.src.edit|config.src.del|config.src.view_config') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + 配置 + + )}/> + )} + {store.formVisible && } ) diff --git a/spug_web/src/pages/deploy/app/Table.js b/spug_web/src/pages/deploy/app/Table.js index f14989a..6261deb 100644 --- a/spug_web/src/pages/deploy/app/Table.js +++ b/spug_web/src/pages/deploy/app/Table.js @@ -28,35 +28,6 @@ class ComTable extends React.Component { } } - columns = [{ - title: '序号', - key: 'series', - render: (_, __, index) => index + 1, - width: 80, - }, { - title: '应用名称', - dataIndex: 'name', - }, { - title: '标识符', - dataIndex: 'key' - }, { - title: '描述信息', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - width: 260, - className: hasPermission('deploy.app.edit|deploy.app.del') ? null : 'none', - render: info => ( - - store.showExtForm(e, info.id)}>新建发布 - this.handleClone(e, info.id)}>克隆发布 - store.showForm(e, info)}>编辑 - this.handleDelete(e, info)}>删除 - - ) - }]; - handleClone = (e, id) => { e.stopPropagation(); this.cloneObj = null; @@ -106,38 +77,6 @@ class ComTable extends React.Component { }; expandedRowRender = (record) => { - const columns = [{ - title: '模式', - dataIndex: 'extend', - render: value => value === '1' ? : - , - width: 80 - }, { - title: '发布环境', - dataIndex: 'env_id', - render: value => lds.get(envStore.idMap, `${value}.name`) - }, { - title: '关联主机', - dataIndex: 'host_ids', - render: value => `${value.length} 台` - }, { - title: '发布审核', - dataIndex: 'is_audit', - render: value => value ? 开启 : 关闭 - }, { - title: '操作', - className: hasPermission('deploy.app.config|deploy.app.edit') ? null : 'none', - render: info => ( - - store.showExtForm(e, record.id, info, false, true)}>查看 - store.showExtForm(e, record.id, info)}>编辑 - this.handleDeployDelete(info)}>删除 - - ) - }]; - if (record['deploys'] === undefined) { store.loadDeploys(record.id) } @@ -145,9 +84,28 @@ class ComTable extends React.Component { return + pagination={false}> + value === '1' ? + : + }/> + lds.get(envStore.idMap, `${value}.name`)}/> + `${value.length} 台`}/> + value ? 开启 : 关闭}/> + {hasPermission('deploy.app.config|deploy.app.edit') && ( + ( + + store.showExtForm(e, record.id, info, false, true)}>查看 + store.showExtForm(e, record.id, info)}>编辑 + this.handleDeployDelete(info)}>删除 + + )}/> + )} +
}; render() { @@ -172,8 +130,22 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + index + 1}/> + + + + {hasPermission('deploy.app.edit|deploy.app.del') && ( + ( + + store.showExtForm(e, info.id)}>新建发布 + this.handleClone(e, info.id)}>克隆发布 + store.showForm(e, info)}>编辑 + this.handleDelete(e, info)}>删除 + + )}/> + )} + ) } } diff --git a/spug_web/src/pages/exec/template/Table.js b/spug_web/src/pages/exec/template/Table.js index 8bcccc7..964f0b0 100644 --- a/spug_web/src/pages/exec/template/Table.js +++ b/spug_web/src/pages/exec/template/Table.js @@ -7,7 +7,7 @@ import React from 'react'; import { observer } from 'mobx-react'; import { Table, Modal, message } from 'antd'; import ComForm from './Form'; -import {http,hasPermission } from 'libs'; +import { http, hasPermission } from 'libs'; import { Action } from "components"; import store from './store'; @@ -17,31 +17,6 @@ class ComTable extends React.Component { store.fetchRecords() } - columns = [{ - title: '模版名称', - dataIndex: 'name', - }, { - title: '模版类型', - dataIndex: 'type', - }, { - title: '模版内容', - render: text => text.body, - ellipsis: true - }, { - title: '描述信息', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - className: hasPermission('exec.template.edit|exec.template.del') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - - ) - }]; - handleDelete = (text) => { Modal.confirm({ title: '删除确认', @@ -76,8 +51,20 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + + + + + {hasPermission('exec.template.edit|exec.template.del') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + + )}/> + )} + {store.formVisible && } ) diff --git a/spug_web/src/pages/host/Table.js b/spug_web/src/pages/host/Table.js index 1ba4b11..3808a04 100644 --- a/spug_web/src/pages/host/Table.js +++ b/spug_web/src/pages/host/Table.js @@ -9,7 +9,7 @@ import { Table, Modal, message } from 'antd'; import { Action } from 'components'; import ComForm from './Form'; import ComImport from './Import'; -import { http, hasPermission} from 'libs'; +import { http, hasPermission } from 'libs'; import store from './store'; @observer @@ -18,38 +18,6 @@ class ComTable extends React.Component { store.fetchRecords() } - columns = [{ - title: '类别', - dataIndex: 'zone', - }, { - title: '主机名称', - dataIndex: 'name', - sorter: (a, b) => a.name.localeCompare(b.name) - }, { - title: '连接地址', - dataIndex: 'hostname', - sorter: (a, b) => a.name.localeCompare(b.name) - }, { - title: '端口', - dataIndex: 'port', - width: 100, - }, { - title: '备注', - dataIndex: 'desc', - ellipsis: true - }, { - title: '操作', - width: 200, - className: hasPermission('host.host.edit|host.host.del|host.host.console') ? null : 'none', - render: info => ( - - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - this.handleConsole(info)}>Console - - ) - }]; - handleConsole = (info) => { window.open(`/ssh/${info.id}`) }; @@ -91,8 +59,22 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + + a.name.localeCompare(b.name)}/> + a.name.localeCompare(b.name)}/> + + + {hasPermission('host.host.edit|host.host.del|host.host.console') && ( + ( + + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + this.handleConsole(info)}>Console + + )}/> + )} + {store.formVisible && } {store.importVisible && } diff --git a/spug_web/src/pages/monitor/Table.js b/spug_web/src/pages/monitor/Table.js index 6c73e54..8a401a4 100644 --- a/spug_web/src/pages/monitor/Table.js +++ b/spug_web/src/pages/monitor/Table.js @@ -8,7 +8,7 @@ import { observer } from 'mobx-react'; import { Table, Modal, Tag, message } from 'antd'; import { Action } from 'components'; import ComForm from './Form'; -import {http, hasPermission} from 'libs'; +import { http, hasPermission } from 'libs'; import store from './store'; import hostStore from '../host/store'; import lds from 'lodash'; @@ -41,58 +41,6 @@ class ComTable extends React.Component { this.setState({hosts: tmp}) }; - columns = [{ - title: '任务名称', - dataIndex: 'name', - }, { - title: '类型', - dataIndex: 'type_alias', - }, { - title: '地址', - render: info => { - if ('34'.includes(info.type)) { - return lds.get(this.state.hosts, `${info.addr}.name`) - } else { - return info.addr - } - }, - ellipsis: true - }, { - title: '频率', - dataIndex: 'rate', - render: value => `${value}分钟` - }, { - title: '状态', - render: info => { - if (info.is_active) { - if (info['latest_status'] === 0) { - return 正常 - } else if (info['latest_status'] === 1) { - return 异常 - } else { - return 待检测 - } - } else { - return 未启用 - } - } - }, { - title: '更新于', - dataIndex: 'latest_run_time_alias', - sorter: (a, b) => a.latest_run_time.localeCompare(b.latest_run_time) - }, { - title: '操作', - className: hasPermission('monitor.monitor.edit|monitor.monitor.del') ? null : 'none', - render: info => ( - - this.handleActive(info)}>{info['is_active'] ? '禁用' : '启用'} - store.showForm(info)}>编辑 - this.handleDelete(info)}>删除 - - ), - width: 180 - }]; - handleActive = (text) => { Modal.confirm({ title: '操作确认', @@ -152,8 +100,43 @@ class ComTable extends React.Component { hideOnSinglePage: true, showTotal: total => `共 ${total} 条`, pageSizeOptions: ['10', '20', '50', '100'] - }} - columns={this.columns}/> + }}> + + + { + if ('34'.includes(info.type)) { + return lds.get(this.state.hosts, `${info.addr}.name`) + } else { + return info.addr + } + }}/> + `${value}分钟`}/> + { + if (info.is_active) { + if (info['latest_status'] === 0) { + return 正常 + } else if (info['latest_status'] === 1) { + return 异常 + } else { + return 待检测 + } + } else { + return 未启用 + } + }}/> + a.latest_run_time.localeCompare(b.latest_run_time)}/> + {hasPermission('monitor.monitor.edit|monitor.monitor.del') && ( + ( + + this.handleActive(info)}>{info['is_active'] ? '禁用' : '启用'} + store.showForm(info)}>编辑 + this.handleDelete(info)}>删除 + + )}/> + )} + {store.formVisible && } )