improve host page

pull/342/head
vapao 2021-06-27 22:28:31 +08:00
parent c4c727ceda
commit 172322061e
2 changed files with 9 additions and 3 deletions

View File

@ -3,9 +3,9 @@
* Copyright (c) <spug.dev@gmail.com>
* Released under the AGPL-3.0 License.
*/
import React from 'react';
import React from 'react';
import { observer } from 'mobx-react';
import { Table, Modal, Dropdown, Button, Menu, Avatar, Tooltip, Space, Tag, message } from 'antd';
import { Table, Modal, Dropdown, Button, Menu, Avatar, Tooltip, Space, Tag, Radio, message } from 'antd';
import { PlusOutlined, DownOutlined } from '@ant-design/icons';
import { Action, TableCard, AuthButton, AuthFragment } from 'components';
import { http, hasPermission } from 'libs';
@ -83,7 +83,11 @@ function ComTable() {
)}>
<Button type="primary">批量导入 <DownOutlined/></Button>
</Dropdown>
</AuthFragment>
</AuthFragment>,
<Radio.Group value={store.f_status} onChange={e => store.f_status = e.target.value}>
<Radio.Button value="">全部</Radio.Button>
<Radio.Button value={false}>未验证</Radio.Button>
</Radio.Group>
]}
pagination={{
showSizeChanger: true,

View File

@ -27,12 +27,14 @@ class Store {
@observable f_name;
@observable f_host;
@observable f_status = '';
@computed get dataSource() {
let records = [];
if (this.group.all_host_ids) records = this.records ? this.records.filter(x => this.group.all_host_ids.includes(x.id)) : [];
if (this.f_name) records = records.filter(x => x.name.toLowerCase().includes(this.f_name.toLowerCase()));
if (this.f_host) records = records.filter(x => x.hostname.toLowerCase().includes(this.f_host.toLowerCase()));
if (this.f_status !== '') records = records.filter(x => this.f_status === x.is_verified);
return records
}