fix: Fix for magic input with boolean option show & etc.

1. fix for magic input with boolean option show
2. add filter params for security group rule

Change-Id: Ibc278779487a3678193749b741f090d2b55e2be9
This commit is contained in:
zhuyue 2021-09-02 17:59:44 +08:00
parent 101025eaac
commit fab8cf703a
2 changed files with 13 additions and 2 deletions

View File

@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
import { Input, Tag, Menu, Divider, Button, Checkbox } from 'antd';
import { CloseOutlined, SearchOutlined } from '@ant-design/icons';
import classnames from 'classnames';
import { isEmpty } from 'lodash';
import { isEmpty, isBoolean } from 'lodash';
import styles from './index.less';
const option = PropTypes.shape({
@ -265,7 +265,10 @@ class MagicInput extends PureComponent {
const { options } = filter;
let label = value;
if (options) {
const current = options.find((item) => item.key === value);
const current = options.find((item) => {
const key = isBoolean(item.key) ? item.key.toString() : item.key;
return key === (isBoolean(value) ? value.toString() : value);
});
label = current ? current.label : value;
}
return (

View File

@ -113,6 +113,14 @@ export const getSelfColumns = (self) => [
];
export const filterParams = [
{
label: t('Remote IP Prefix'),
name: 'remote_ip_prefix',
filterFunc: (record, value) => {
const recordValue = record || '0.0.0.0/0';
return recordValue.includes(value);
},
},
{
label: t('Direction'),
name: 'direction',