feat: Update datas to data

1. Update datas to data
2. Update metadatas to metadata
3. Update data intro && codes in docs

Change-Id: I2041b69c6d9a9e9ec61c3861ad8860af5ac5cc0b
This commit is contained in:
zhangjingwei 2021-08-13 12:03:48 +08:00 committed by Jingwei.Zhang
parent fd69957fcf
commit 61f21da7e6
74 changed files with 254 additions and 258 deletions

View File

@ -331,7 +331,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
- `select-table`
- Table with selected actions
- `isMulti`, whether is multi, default is `false`
- `datas`, data source, using when front end paging
- `data`, data source, using when front end paging
- `columns`, table columns configuration, the same as `BaseList`
- `filterParams`, search configuration
- `pageSize`, items number per page, default `5`
@ -394,7 +394,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
- Take create volumn as an example `src/pages/storage/containers/Volume/actions/Create/index.jsx` :
- This is a table with tab, default to show the first tab, when switching tab, data source will change
- Data is acquired by the front end paging, just directly configure the `datas`
- Data is acquired by the front end paging, just directly configure the `data`
- Not multi selected
- Configure selected label to `Image`
@ -403,7 +403,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
name: 'image',
label: t('Operating System'),
type: 'select-table',
datas: this.images,
data: this.images,
required: sourceTypesIsImage,
isMulti: false,
hidden: !sourceTypesIsImage,
@ -796,7 +796,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
- `dataSource`, data source for choose
- `showSearch`, whether to show search input
- `oriTargetKeys`, default selected
- `disabled`, whether to disable selecte datas in left table, default is `false`
- `disabled`, whether to disable selecte data in left table, default is `false`
- Take edit system role as an example `src/pages/identity/containers/User/actions/SystemRole.jsx` :
- Left is the project name list
- Right is the project name and role list of project
@ -968,7 +968,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
name: 'systems',
label: t('Metadata'),
type: 'metadata-transfer',
metadatas: this.metadatas,
metadata: this.metadata,
validator: (rule, value) => {
if (this.hasNoValue(value)) {
return Promise.reject(t('Please input value'));

View File

@ -99,8 +99,8 @@ English | [Chinese](../../zh/develop/3-5-BaseStore-introduction.md)
return items;
}
const { id } = filters;
const datas = id ? items.filter((it) => it.volume_id === id) : items;
return datas;
const data = id ? items.filter((it) => it.volume_id === id) : items;
return data;
}
```

View File

@ -329,7 +329,7 @@
- `select-table`
- 带有选择操作的表格
- `isMulti`,是否是多选,默认为`false`
- `datas`,数据源,使用前端分页时使用
- `data`,数据源,使用前端分页时使用
- `columns`,表格列的配置,配置方式同`BaseList`
- `filterParams`,搜索项的配置
- `pageSize`,每页条目数量,默认为 5
@ -392,7 +392,7 @@
- 以创建云硬盘选择镜像`src/pages/storage/containers/Volume/actions/Create/index.jsx`为例
- 这是带有 Tab 标签的表格,默认展示第一个 tabtab 切换时会更新数据源
- 数据使用前端分页的方式获取,直接配置`datas`即可
- 数据使用前端分页的方式获取,直接配置`data`即可
- 是单选
- 配置了已选标签为`已选 镜像`
@ -401,7 +401,7 @@
name: 'image',
label: t('Operating System'),
type: 'select-table',
datas: this.images,
data: this.images,
required: sourceTypesIsImage,
isMulti: false,
hidden: !sourceTypesIsImage,
@ -966,7 +966,7 @@
name: 'systems',
label: t('Metadata'),
type: 'metadata-transfer',
metadatas: this.metadatas,
metadata: this.metadata,
validator: (rule, value) => {
if (this.hasNoValue(value)) {
return Promise.reject(t('Please input value'));

View File

@ -99,8 +99,8 @@
return items;
}
const { id } = filters;
const datas = id ? items.filter((it) => it.volume_id === id) : items;
return datas;
const data = id ? items.filter((it) => it.volume_id === id) : items;
return data;
}
```

View File

@ -53,7 +53,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
<SelectTable
maxSelectedCount={-1}
isLoading={isLoading}
datas={ports}
data={ports}
columns={[
{
title: t('ID/Name'),

View File

@ -33,10 +33,10 @@ export default class MetadataTransfer extends Component {
this.state = this.initState(props);
}
get metadatas() {
get metadata() {
const self = this;
const { metadatas } = this.props;
return (metadatas || []).map((item) => {
const { metadata } = this.props;
return (metadata || []).map((item) => {
const {
detail: { properties = {} } = {},
namespace,
@ -104,18 +104,18 @@ export default class MetadataTransfer extends Component {
}
initState = (props) => {
const { value, metadatas = [] } = props;
const { value, metadata = [] } = props;
const targetKeys = [];
const checkedKeys = [];
const selectedKeysTable = [];
const values = {};
Object.keys(value).forEach((key) => {
const metadata = metadatas.find((it) => {
const item = metadata.find((it) => {
const { detail: { properties = {} } = {} } = it;
return Object.keys(properties).indexOf(key) >= 0;
});
if (metadata) {
const { namespace } = metadata;
if (item) {
const { namespace } = item;
const newKey = `${namespace}--${key}`;
targetKeys.push(newKey);
values[newKey] = value[key];
@ -224,24 +224,24 @@ export default class MetadataTransfer extends Component {
return null;
};
flatten = (aList = [], datas = []) => {
flatten = (aList = [], data = []) => {
aList.forEach((item) => {
const { children = [] } = item;
datas.push(item);
this.flatten(children, datas);
data.push(item);
this.flatten(children, data);
});
};
getTreeData = () => {
const datas = [];
this.flatten(this.metadatas, datas);
return datas;
const data = [];
this.flatten(this.metadata, data);
return data;
};
getTreeDataWithoutFather = () => {
const datas = [];
this.flatten(this.metadatas, datas);
return datas.filter((it) => it.key.indexOf('--') >= 0);
const data = [];
this.flatten(this.metadata, data);
return data.filter((it) => it.key.indexOf('--') >= 0);
};
getAllTreeKeys = () => {
@ -282,7 +282,7 @@ export default class MetadataTransfer extends Component {
blockNode
checkable
checkedKeys={checkedKeys}
treeData={this.generateTree(this.metadatas, targetKeys)}
treeData={this.generateTree(this.metadata, targetKeys)}
onCheck={this.onCheckTree(onItemSelect)}
/>
);
@ -339,7 +339,7 @@ export default class MetadataTransfer extends Component {
getChildKeys = (namespace) => {
const keys = [];
this.metadatas.forEach((item) => {
this.metadata.forEach((item) => {
(item.children || []).forEach((child) => {
if (child.namespace === namespace) {
keys.push(child.key);
@ -402,7 +402,7 @@ export default class MetadataTransfer extends Component {
}
const namespace = tmp[0];
const realKey = tmp[1];
const father = this.metadatas.find((it) => it.key === namespace);
const father = this.metadata.find((it) => it.key === namespace);
if (!father) {
return;
}

View File

@ -214,11 +214,11 @@ export default class NetworkSelect extends React.Component {
getNetworkOptions = () => {
const { networks } = this.state;
const { optionsByIndex, index } = this.props;
let datas = [...networks];
let data = [...networks];
if (optionsByIndex && index < networks.length) {
datas = [networks[index]];
data = [networks[index]];
}
return datas.map((it) => ({
return data.map((it) => ({
label: it.name,
value: it.id,
}));

View File

@ -25,7 +25,7 @@ import styles from './index.less';
const getItemKey = (item) => item.key || item.id;
const getInitRows = (value, datas, backendPageStore) => {
const getInitRows = (value, data, backendPageStore) => {
const { selectedRowKeys = [], selectedRows = [] } = value;
if (!selectedRowKeys || selectedRowKeys.length === 0) {
return [];
@ -36,7 +36,7 @@ const getInitRows = (value, datas, backendPageStore) => {
}
const rows = selectedRowKeys.map((key) => {
const findSourceData = !backendPageStore ? datas : selectedRows;
const findSourceData = !backendPageStore ? data : selectedRows;
const item = (findSourceData || []).find((it) => getItemKey(it) === key);
return (
item || {
@ -52,7 +52,7 @@ const getInitRows = (value, datas, backendPageStore) => {
@observer
export default class SelectTable extends React.Component {
static propTypes = {
datas: PropTypes.array,
data: PropTypes.array,
columns: PropTypes.array.isRequired,
isMulti: PropTypes.bool,
pageSize: PropTypes.number,
@ -86,7 +86,7 @@ export default class SelectTable extends React.Component {
};
static defaultProps = {
datas: [],
data: [],
isMulti: false,
pageSize: 5,
canSearch: true,
@ -111,10 +111,10 @@ export default class SelectTable extends React.Component {
constructor(props) {
super(props);
const { datas = [], pageSize, initValue = {} } = props;
const { data = [], pageSize, initValue = {} } = props;
const { selectedRowKeys, selectedRows } = this.getInitValue(props);
this.state = {
datas,
data,
filters: null,
current: 1,
pageSize,
@ -153,39 +153,39 @@ export default class SelectTable extends React.Component {
}
getInitValue(props) {
const { value = {}, initValue = {}, datas = [], backendPageStore } = props;
const { value = {}, initValue = {}, data = [], backendPageStore } = props;
if (!isEmpty(initValue)) {
const { selectedRowKeys = [] } = initValue;
return {
selectedRowKeys,
selectedRows: getInitRows(initValue, datas, backendPageStore),
selectedRows: getInitRows(initValue, data, backendPageStore),
};
}
const { selectedRowKeys = [] } = value || {};
return {
selectedRowKeys,
selectedRows: getInitRows(value || {}, datas, backendPageStore),
selectedRows: getInitRows(value || {}, data, backendPageStore),
};
}
getTotal(props) {
const {
datas = [],
data = [],
backendPageStore,
backendPageDataKey,
} = props || this.props;
if (!backendPageStore) {
return datas.length;
return data.length;
}
return (backendPageStore[backendPageDataKey] || {}).total;
}
static getDerivedStateFromProps(nextProps, prevState) {
const { value, datas = [], backendPageStore, initValue = {} } = nextProps;
const { value, data = [], backendPageStore, initValue = {} } = nextProps;
const newState = {};
if (!backendPageStore && !isEqual(datas, prevState.datas)) {
newState.datas = datas;
newState.total = datas.length;
if (!backendPageStore && !isEqual(data, prevState.data)) {
newState.data = data;
newState.total = data.length;
newState.current = prevState.current || 1;
}
@ -198,7 +198,7 @@ export default class SelectTable extends React.Component {
}
if (!isEqual(initValue, prevState.initValue)) {
const { selectedRowKeys = [] } = initValue;
const selectedRows = getInitRows(initValue, datas, backendPageStore);
const selectedRows = getInitRows(initValue, data, backendPageStore);
newState.selectedRowKeys = selectedRowKeys;
newState.selectedRows = selectedRows;
newState.initValue = initValue;
@ -279,7 +279,7 @@ export default class SelectTable extends React.Component {
const { total } = backendPageStore[backendPageDataKey] || {};
this.setState(
{
datas: data,
data,
total,
current: newParams.page,
pageSize: newParams.limit,
@ -317,8 +317,8 @@ export default class SelectTable extends React.Component {
if (backendPageStore) {
return this.getDataFromStore();
}
const { datas } = this.state;
const tmpDatas = datas.map((it) => {
const { data } = this.state;
const tmpData = data.map((it) => {
if (it.key) {
return it;
}
@ -327,7 +327,7 @@ export default class SelectTable extends React.Component {
key: get(it, rowKey),
};
});
return tmpDatas;
return tmpData;
} catch (e) {
return [];
}
@ -344,8 +344,8 @@ export default class SelectTable extends React.Component {
if (!backendPageStore || !isMulti) {
return selectedRowKeys;
}
const { selectedRowKeys: keysInState, datas } = this.state;
const currentDataKeys = datas.map((it) => getItemKey(it));
const { selectedRowKeys: keysInState, data } = this.state;
const currentDataKeys = data.map((it) => getItemKey(it));
const addKeys = selectedRowKeys.filter(
(key) => currentDataKeys.indexOf(key) >= 0
);
@ -426,23 +426,23 @@ export default class SelectTable extends React.Component {
tab: tab || tabInState,
selectedRows: rows,
selectedRowKeys: selectedRowKeys || keysInState,
datas: this.getDataSource(),
data: this.getDataSource(),
});
}
};
getSelectedRowsAll = (selectedRowKeys) => {
const { datas = [], selectedRowKeys: keysInState } = this.state;
const { data = [], selectedRowKeys: keysInState } = this.state;
if (selectedRowKeys) {
return datas.filter((it) => selectedRowKeys.indexOf(getItemKey(it)) >= 0);
return data.filter((it) => selectedRowKeys.indexOf(getItemKey(it)) >= 0);
}
return datas.filter((it) => keysInState.indexOf(getItemKey(it)) >= 0);
return data.filter((it) => keysInState.indexOf(getItemKey(it)) >= 0);
};
getSelectedRowsBackend = (selectedRowKeys) => {
const { isMulti } = this.props;
const {
datas = [],
data = [],
selectedRowKeys: keysInState,
selectedRows: rowsInState,
} = this.state;
@ -450,7 +450,7 @@ export default class SelectTable extends React.Component {
return this.getSelectedRowsBackendMulti(selectedRowKeys);
}
const keys = selectedRowKeys || keysInState;
const rows = datas.filter((it) => keys.indexOf(getItemKey(it)) >= 0);
const rows = data.filter((it) => keys.indexOf(getItemKey(it)) >= 0);
if (rows.length === keys.length) {
return rows;
}
@ -469,7 +469,7 @@ export default class SelectTable extends React.Component {
getSelectedRowsBackendMulti = (selectedRowKeys) => {
const {
datas = [],
data = [],
selectedRowKeys: keysInState = [],
selectedRows: rowsInState = [],
} = this.state;
@ -481,7 +481,7 @@ export default class SelectTable extends React.Component {
const oldLefRows = rowsInState.filter(
(it) => delKeys.indexOf(getItemKey(it)) < 0
);
const newRows = datas.filter((it) => addKeys.indexOf(getItemKey(it)) >= 0);
const newRows = data.filter((it) => addKeys.indexOf(getItemKey(it)) >= 0);
return [...oldLefRows, ...newRows];
};
@ -673,7 +673,7 @@ export default class SelectTable extends React.Component {
};
const footer = backendPageStore ? this.renderTableFooter : null;
const isLoading = this.getLoading();
const datas = this.getDataSource();
const data = this.getDataSource();
const pageTableClass = backendPageStore
? styles['sl-select-table-backend']
: '';
@ -688,7 +688,7 @@ export default class SelectTable extends React.Component {
rowSelection={this.rowSelection}
rowKey={rowKey}
columns={this.tableColumns}
datas={datas}
data={data}
filters={filters}
searchFilters={filterParams}
pagination={pagination}

View File

@ -41,7 +41,7 @@ export default class TabSelectTable extends Component {
onChange && onChange(this.state);
};
getMultiSelected = (keys, rows, datas) => {
getMultiSelected = (keys, rows, data) => {
const { selectedRowKeys: keysInState, selectedRows: rowsInState } =
this.state;
const addKeys = keys.filter((key) => keysInState.indexOf(key) < 0);
@ -53,8 +53,8 @@ export default class TabSelectTable extends Component {
if (!notInKeys) {
return false;
}
const data = datas.find((it) => it.key === key || it.id === key);
return !!data;
const item = data.find((it) => it.key === key || it.id === key);
return !!item;
});
const newKeys = [...keysInState, ...addKeys].filter(
(key) => removeKeys.indexOf(key) < 0
@ -67,10 +67,10 @@ export default class TabSelectTable extends Component {
};
onSelectTableChange = (value) => {
const { selectedRowKeys, selectedRows, datas } = value;
const { selectedRowKeys, selectedRows, data } = value;
const { isMulti = false } = this.props;
const [newKeys, newRows] = isMulti
? this.getMultiSelected(selectedRowKeys, selectedRows, datas)
? this.getMultiSelected(selectedRowKeys, selectedRows, data)
: [selectedRowKeys, selectedRows];
const newState = {
selectedRowKeys: newKeys,

View File

@ -119,7 +119,7 @@ export default class ProjectSelect extends ModalAction {
name: 'project',
label: t('Owned Project'),
type: 'select-table',
datas: this.projects,
data: this.projects,
isLoading: globalUserStore.userProjects.isLoading,
disabledFunc: (record) => !record.enabled,
filterParams: [

View File

@ -26,14 +26,14 @@ export default class RuleButton extends Component {
}
render() {
const { item: { security_group_rules: datas = [] } = {} } = this.props;
const { item: { security_group_rules: data = [] } = {} } = this.props;
const configs = {
buttonType: 'link',
title: t('Security Group Rules'),
buttonText: t('View Rules'),
modalSize: 'middle',
columns: getSelfColumns(this),
datas,
data,
};
return <TableButton {...configs} style={{ paddingLeft: 0 }} />;
}

View File

@ -22,7 +22,7 @@ export default class TableButton extends Component {
return {
title: PropTypes.string.isRequired,
buttonType: PropTypes.string,
datas: PropTypes.array,
data: PropTypes.array,
columns: PropTypes.array,
modalSize: PropTypes.string,
className: PropTypes.func,
@ -33,7 +33,7 @@ export default class TableButton extends Component {
static defaultProps = {
buttonType: 'link',
datas: [],
data: [],
columns: [],
modalSize: 'middle',
className: '',
@ -42,8 +42,8 @@ export default class TableButton extends Component {
};
renderTable = () => {
const { datas, columns } = this.props;
return <Table columns={columns} dataSource={datas} />;
const { data, columns } = this.props;
return <Table columns={columns} dataSource={data} />;
};
render() {

View File

@ -340,7 +340,7 @@ class ActionButton extends Component {
);
const results = allSettled(promises);
results.then((res) => {
const failedDatas = res
const failedData = res
.map((it, idx) => {
if (it.status === 'rejected') {
return {
@ -351,14 +351,14 @@ class ActionButton extends Component {
return null;
})
.filter((it) => !!it);
if (failedDatas.length === 0) {
if (failedData.length === 0) {
this.onShowSuccess(data, afterSubmit);
return resolve();
}
failedDatas.forEach((it) => {
failedData.forEach((it) => {
this.onShowError(it.data, it.reason);
});
if (failedDatas.length === data.length) {
if (failedData.length === data.length) {
return reject();
}
return resolve();

View File

@ -27,7 +27,7 @@ import styles from './index.less';
export default class index extends Component {
static propTypes = {
columns: PropTypes.array,
datas: PropTypes.array,
data: PropTypes.array,
total: PropTypes.number,
getValueRenderFunc: PropTypes.func.isRequired,
resourceName: PropTypes.string,
@ -37,7 +37,7 @@ export default class index extends Component {
static defaultProps = {
columns: [],
datas: [],
data: [],
total: 0,
totalMax: 10000,
resourceName: '',
@ -123,11 +123,11 @@ export default class index extends Component {
};
getDownloadData() {
const { columns, datas } = this.props;
return datas.map((data) => {
const { columns, data } = this.props;
return data.map((d) => {
const item = {};
columns.forEach((it) => {
const value = this.getColumnData(data, it);
const value = this.getColumnData(d, it);
item[it.dataIndex] = value;
});
return item;
@ -265,12 +265,12 @@ export default class index extends Component {
}
const { getData } = this.props;
const items = await getData({ page: current, limit: this.pageSize });
const newDatas = [...allData, ...items];
const isFinish = items.length < this.pageSize || newDatas.length >= counts;
const newData = [...allData, ...items];
const isFinish = items.length < this.pageSize || newData.length >= counts;
if (isFinish) {
this.setState(
{
allData: newDatas,
allData: newData,
percent: 100,
},
() => {
@ -280,7 +280,7 @@ export default class index extends Component {
} else {
let percent = 0;
if (counts) {
percent = Math.floor((newDatas.length / counts) * 100);
percent = Math.floor((newData.length / counts) * 100);
} else {
percent = current * 10;
}
@ -289,7 +289,7 @@ export default class index extends Component {
}
this.setState(
{
allData: newDatas,
allData: newData,
current: current + 1,
percent,
},
@ -363,8 +363,8 @@ export default class index extends Component {
}
render() {
const { total, datas } = this.props;
if (total === datas.length) {
const { total, data } = this.props;
if (total === data.length) {
return this.renderDownloadCurrent();
}
return this.renderDownloadAll();

View File

@ -781,7 +781,7 @@ export default class BaseTable extends React.Component {
renderDownload() {
const {
pagination,
data: datas,
data,
columns,
resourceName,
getDownloadData,
@ -795,7 +795,7 @@ export default class BaseTable extends React.Component {
const { total } = pagination;
const downloadColumns = this.filterDownloadColumns(columns);
const props = {
datas,
data,
columns: downloadColumns,
total,
getValueRenderFunc,

View File

@ -31,7 +31,7 @@ import styles from './index.less';
export default class SimpleTable extends React.Component {
static propTypes = {
datas: PropTypes.array.isRequired,
data: PropTypes.array.isRequired,
filters: PropTypes.object,
searchFilters: PropTypes.array,
columns: PropTypes.array.isRequired,
@ -213,11 +213,11 @@ export default class SimpleTable extends React.Component {
};
getDataSource = () => {
const { datas, filters, filterByBackend } = this.props;
const { data, filters, filterByBackend } = this.props;
if (filterByBackend) {
return datas;
return data;
}
const tmpDatas = datas.map((it) => {
const tmpData = data.map((it) => {
if (it.key) {
return it;
}
@ -227,9 +227,9 @@ export default class SimpleTable extends React.Component {
};
});
if (!filters || isEmpty(filters)) {
return tmpDatas;
return tmpData;
}
return tmpDatas.filter((it) => this.filterData(it, filters));
return tmpData.filter((it) => this.filterData(it, filters));
};
onRow = (record, index) => {

View File

@ -815,16 +815,16 @@ export default class BaseList extends React.Component {
const { timeFilter = {} } = this.state;
const { id, tab, ...rest } = filters;
const newFilters = rest;
let datas = [];
let items = [];
if (this.isFilterByBackend) {
datas = toJS(data);
items = toJS(data);
} else {
datas = (toJS(data) || []).filter((it) =>
items = (toJS(data) || []).filter((it) =>
this.filterData(it, toJS(newFilters), toJS(timeFilter))
);
this.updateList({ total: datas.length });
this.updateList({ total: items.length });
}
const hasTransData = datas.some((item) =>
const hasTransData = items.some((item) =>
this.itemInTransitionFunction(item)
);
if (hasTransData) {
@ -832,9 +832,9 @@ export default class BaseList extends React.Component {
} else {
this.setRefreshdataTimerAuto();
}
this.updateHintsByDatas(datas);
this.updateHintsByData(items);
this.setTableHeight();
return datas;
return items;
};
getFilters = () => {
@ -999,7 +999,7 @@ export default class BaseList extends React.Component {
}
// eslint-disable-next-line no-unused-vars
updateHintsByDatas(datas) {}
updateHintsByData(data) {}
init() {
this.store = { list: {} };

View File

@ -122,7 +122,7 @@ class Right extends Component {
if (hasError) {
return (
<NotFound
title={t('datas')}
title={t('data')}
link={this.getUrl('/base/overview')}
codeError
/>
@ -133,7 +133,7 @@ class Right extends Component {
// if (currentRoutes.length === 0) {
// return (
// <NotFound
// title={t('datas')}
// title={t('data')}
// link={this.getUrl('/base/overview')}
// />
// );
@ -149,7 +149,7 @@ class Right extends Component {
console.log(e);
return (
<NotFound
title={t('datas')}
title={t('data')}
link={this.getUrl('/base/overview')}
codeError
/>

View File

@ -1826,7 +1826,7 @@
"create vpn ike policy": "create vpn ike policy",
"create vpn ipsec policy": "create vpn ipsec policy",
"create vpn tunnel": "create vpn tunnel",
"datas": "datas",
"data": "data",
"delete": "delete",
"delete DNAT rule": "delete DNAT rule",
"delete SNAT rule": "delete SNAT rule",
@ -1916,7 +1916,6 @@
"message": "message",
"message.reason": "message.reason",
"metadata": "metadata",
"metadatas": "metadatas",
"migrate": "migrate",
"modify project tags": "modify project tags",
"network": "network",

View File

@ -1826,7 +1826,7 @@
"create vpn ike policy": "创建VPN IKE策略",
"create vpn ipsec policy": "创建VPN IPsec策略",
"create vpn tunnel": "创建VPN隧道",
"datas": "数据",
"data": "数据",
"delete": "删除",
"delete DNAT rule": "删除DNAT规则",
"delete SNAT rule": "删除SNAT规则",
@ -1916,7 +1916,6 @@
"message": "",
"message.reason": "",
"metadata": "元数据",
"metadatas": "元数据",
"migrate": "迁移",
"modify project tags": "修改项目标签",
"network": "网络",

View File

@ -141,7 +141,7 @@ export default class BaseDetail extends Base {
get validateCard() {
const { validate = {} } = this.detailData || {};
const datas = Object.keys(validate).map((key) => ({
const data = Object.keys(validate).map((key) => ({
value: this.detailData[`${key}_interface`],
name: key,
...validate[key],
@ -166,7 +166,7 @@ export default class BaseDetail extends Base {
width: 300,
},
];
const content = <SimpleTable columns={columns} datas={datas} />;
const content = <SimpleTable columns={columns} data={data} />;
const options = [
{
label: '',

View File

@ -30,8 +30,8 @@ export default class NodeInfo extends Base {
}
get kernelImages() {
const datas = this.imageStore.list.data || [];
return datas
const data = this.imageStore.list.data || [];
return data
.filter((it) => it.disk_format === 'aki')
.map((it) => ({
value: it.id,
@ -40,8 +40,8 @@ export default class NodeInfo extends Base {
}
get ramdiskImages() {
const datas = this.imageStore.list.data || [];
return datas
const data = this.imageStore.list.data || [];
return data
.filter((it) => it.disk_format === 'ari')
.map((it) => ({
value: it.id,

View File

@ -95,7 +95,7 @@ export default class ManageAccess extends ModalAction {
isMulti: true,
required: true,
isLoading: this.projectStore.list.isLoading,
datas: this.projects,
data: this.projects,
...projectTableOptions,
},
];

View File

@ -29,7 +29,7 @@ export default class ManageMetadata extends ModalAction {
init() {
this.store = globalFlavorStore;
this.metadataStore = new MetadataStore();
this.getMetadatas();
this.getMetadata();
}
get name() {
@ -59,7 +59,7 @@ export default class ManageMetadata extends ModalAction {
static allowed = () => Promise.resolve(true);
async getMetadatas() {
async getMetadata() {
const resouceType = 'OS::Nova::Flavor';
await this.metadataStore.fetchList({
manage: true,
@ -68,12 +68,12 @@ export default class ManageMetadata extends ModalAction {
this.updateDefaultValue();
}
get metadatas() {
get metadata() {
return this.metadataStore.list.data || [];
}
checkKeyInSystem = (key) => {
const metadata = this.metadatas.find((it) => {
const metadata = this.metadata.find((it) => {
const { detail: { properties = {} } = {} } = it;
return Object.keys(properties).indexOf(key) >= 0;
});
@ -85,10 +85,10 @@ export default class ManageMetadata extends ModalAction {
return isEmpty(originData) ? extra_specs : originData.extra_specs || {};
}
parseExistMetadatas() {
parseExistMetadata() {
const customs = [];
const systems = {};
if (this.metadatas.length > 0) {
if (this.metadata.length > 0) {
const metadata = this.getItemMetadata();
Object.keys(metadata).forEach((key) => {
if (this.checkKeyInSystem(key)) {
@ -109,7 +109,7 @@ export default class ManageMetadata extends ModalAction {
get defaultValue() {
const { name } = this.item;
const { customs, systems } = this.parseExistMetadatas();
const { customs, systems } = this.parseExistMetadata();
const value = {
name,
customs,
@ -160,7 +160,7 @@ export default class ManageMetadata extends ModalAction {
name: 'systems',
label: t('Metadata'),
type: 'metadata-transfer',
metadatas: this.metadatas,
metadata: this.metadata,
validator: (rule, value) => {
if (this.hasNoValue(value)) {
// eslint-disable-next-line prefer-promise-reject-errors
@ -174,7 +174,7 @@ export default class ManageMetadata extends ModalAction {
onSubmit = (values) => {
const { customs: oldCumtoms, systems: oldSystems } =
this.parseExistMetadatas();
this.parseExistMetadata();
const { customs, systems } = values;
const adds = [];
const removes = [];

View File

@ -71,7 +71,7 @@ export default class AccessTypeSetting extends Base {
isMulti: true,
hidden: !showChoose,
required: showChoose,
datas: this.projects,
data: this.projects,
isLoading: this.projectStore.list.isLoading,
...projectTableOptions,
},

View File

@ -90,7 +90,7 @@ export default class ManageHost extends ModalAction {
label: t('Hosts'),
type: 'select-table',
isMulti: true,
datas: this.computeHosts,
data: this.computeHosts,
isLoading: globalComputeHostStore.list.isLoading,
filterParams: [
{

View File

@ -29,7 +29,7 @@ export default class ManageMetadata extends ModalAction {
init() {
this.store = new AggregateStore();
this.metadataStore = new MetadataStore();
this.getMetadatas();
this.getMetadata();
}
get name() {
@ -55,7 +55,7 @@ export default class ManageMetadata extends ModalAction {
static allowed = () => Promise.resolve(true);
async getMetadatas() {
async getMetadata() {
const resouceType = 'OS::Nova::Aggregate';
await this.metadataStore.fetchList({
manage: true,
@ -64,22 +64,22 @@ export default class ManageMetadata extends ModalAction {
this.updateDefaultValue();
}
get metadatas() {
get metadata() {
return this.metadataStore.list.data || [];
}
checkKeyInSystem = (key) => {
const metadata = this.metadatas.find((it) => {
const metadata = this.metadata.find((it) => {
const { detail: { properties = {} } = {} } = it;
return Object.keys(properties).indexOf(key) >= 0;
});
return !!metadata;
};
parseExistMetadatas() {
parseExistMetadata() {
const customs = [];
const systems = {};
if (this.metadatas.length > 0) {
if (this.metadata.length > 0) {
const { metadata } = this.item;
Object.keys(metadata).forEach((key) => {
if (this.checkKeyInSystem(key)) {
@ -100,7 +100,7 @@ export default class ManageMetadata extends ModalAction {
get defaultValue() {
const { name } = this.item;
const { customs, systems } = this.parseExistMetadatas();
const { customs, systems } = this.parseExistMetadata();
const value = {
name,
customs,
@ -151,7 +151,7 @@ export default class ManageMetadata extends ModalAction {
name: 'systems',
label: t('Metadata'),
type: 'metadata-transfer',
metadatas: this.metadatas,
metadata: this.metadata,
validator: (rule, value) => {
if (this.hasNoValue(value)) {
// eslint-disable-next-line prefer-promise-reject-errors
@ -166,15 +166,15 @@ export default class ManageMetadata extends ModalAction {
onSubmit = (values) => {
const { customs, systems } = values;
const { id, metadata: oldMetadata } = this.item;
const metadatas = { ...systems };
const metadata = { ...systems };
customs.forEach((it) => {
metadatas[it.value.key] = it.value.value;
metadata[it.value.key] = it.value.value;
});
Object.keys(oldMetadata).forEach((key) => {
if (!has(metadatas, key)) {
metadatas[key] = null;
if (!has(metadata, key)) {
metadata[key] = null;
}
});
return this.store.manageMetadata({ id, metadatas });
return this.store.manageMetadata({ id, metadata });
};
}

View File

@ -172,7 +172,7 @@ export class CreateForm extends FormAction {
type: 'select-table',
required: this.isAdminPage,
hidden: !this.isAdminPage,
datas: this.projects,
data: this.projects,
isLoading: this.projectStore.list.isLoading,
...projectTableOptions,
},
@ -240,7 +240,7 @@ export class CreateForm extends FormAction {
required: isShare,
isMulti: true,
hidden: !isShare,
datas: this.projects,
data: this.projects,
isLoading: this.projectStore.list.isLoading,
...projectTableOptions,
},

View File

@ -91,7 +91,7 @@ export default class ManageAccess extends ModalAction {
type: 'select-table',
isMulti: true,
required: true,
datas: this.projects,
data: this.projects,
isLoading: this.projectStore.list.isLoading,
...projectTableOptions,
},

View File

@ -30,7 +30,7 @@ export default class ManageMetadata extends ModalAction {
init() {
this.store = globalImageStore;
this.metadataStore = new MetadataStore();
this.getMetadatas();
this.getMetadata();
}
get name() {
@ -59,7 +59,7 @@ export default class ManageMetadata extends ModalAction {
return Promise.resolve(isOwner(item) || isAdminPage);
};
async getMetadatas() {
async getMetadata() {
const resouceType = 'OS::Glance::Image';
await this.metadataStore.fetchList({
manage: true,
@ -68,7 +68,7 @@ export default class ManageMetadata extends ModalAction {
this.updateDefaultValue();
}
get metadatas() {
get metadata() {
return this.metadataStore.list.data || [];
}
@ -101,17 +101,17 @@ export default class ManageMetadata extends ModalAction {
}
checkKeyInSystem = (key) => {
const metadata = this.metadatas.find((it) => {
const item = this.metadata.find((it) => {
const { detail: { properties = {} } = {} } = it;
return Object.keys(properties).indexOf(key) >= 0;
});
return !!metadata;
return !!item;
};
parseExistMetadatas() {
parseExistMetadata() {
const customs = [];
const systems = {};
if (this.metadatas.length > 0) {
if (this.metadata.length > 0) {
const metadata = this.getItemMetadata();
Object.keys(metadata).forEach((key) => {
if (this.checkKeyInSystem(key)) {
@ -132,7 +132,7 @@ export default class ManageMetadata extends ModalAction {
get defaultValue() {
const { name } = this.item;
const { customs, systems } = this.parseExistMetadatas();
const { customs, systems } = this.parseExistMetadata();
const value = {
name,
customs,
@ -183,7 +183,7 @@ export default class ManageMetadata extends ModalAction {
name: 'systems',
label: t('Metadata'),
type: 'metadata-transfer',
metadatas: this.metadatas,
metadata: this.metadata,
validator: (rule, value) => {
if (this.hasNoValue(value)) {
// eslint-disable-next-line prefer-promise-reject-errors
@ -197,7 +197,7 @@ export default class ManageMetadata extends ModalAction {
onSubmit = (values) => {
const { customs: oldCumtoms, systems: oldSystems } =
this.parseExistMetadatas();
this.parseExistMetadata();
const { customs, systems } = values;
const adds = [];
const removes = [];

View File

@ -120,7 +120,7 @@ export default class AssociateFip extends ModalAction {
label: t('Instance IP'),
type: 'select-table',
required: true,
datas: this.ports,
data: this.ports,
isLoading: portLoading,
isMulti: false,
filterParams: [
@ -155,7 +155,7 @@ export default class AssociateFip extends ModalAction {
label: t('Floating Ip Address'),
type: 'select-table',
required: true,
datas: canAssociateFloatingIPs,
data: canAssociateFloatingIPs,
isLoading: fipLoading,
isMulti: false,
filterParams: [

View File

@ -175,7 +175,7 @@ export default class AttachInterface extends ModalAction {
label: t('Subnet'),
type: 'select-table',
required: isManua,
datas: this.subnets,
data: this.subnets,
isLoading: this.subnetStore.list.isLoading,
hidden: !isManua,
isMulti: false,

View File

@ -72,10 +72,10 @@ export class BaseStep extends Base {
get images() {
const { imageTab } = this.state;
const { image } = this.locationParams;
const datas = image
const data = image
? [toJS(this.imageStore.detail)]
: this.imageStore.list.data || [];
const images = datas.filter((it) => {
const images = data.filter((it) => {
if (!canImageCreateIronicInstance(it)) {
return false;
}
@ -188,7 +188,7 @@ export class BaseStep extends Base {
name: 'image',
label: t('Operating System'),
type: 'select-table',
datas: this.images,
data: this.images,
isLoading: imageLoading,
isMulti: false,
filterParams: [

View File

@ -95,7 +95,7 @@ export class SystemStep extends Base {
name: 'keypair',
label: t('Keypair'),
type: 'select-table',
datas: this.keypairs,
data: this.keypairs,
isLoading: this.keyPairStore.list.isLoading,
isMulti: false,
required: !isPassword,

View File

@ -99,7 +99,7 @@ export default class DetachInterface extends ModalAction {
label: t('Network Interface'),
type: 'select-table',
required: true,
datas: this.ports,
data: this.ports,
isLoading: portLoading,
isMulti: true,
filterParams: [

View File

@ -95,7 +95,7 @@ export class DetachIsoVolume extends ModalAction {
label: t('Volume'),
type: 'select-table',
required: true,
datas: this.volumes,
data: this.volumes,
isLoading: this.volumeStore.list.isLoading,
isMulti: true,
filterParams: [

View File

@ -90,7 +90,7 @@ export class DetachVolume extends ModalAction {
label: t('Volume'),
type: 'select-table',
required: true,
datas: this.volumes,
data: this.volumes,
isLoading: this.volumeStore.list.isLoading,
filterParams: [
{

View File

@ -120,7 +120,7 @@ export default class LiveMigrate extends ModalAction {
name: 'host',
label: t('Target Compute Host'),
type: 'select-table',
datas: this.hypervisors,
data: this.hypervisors,
isLoading:
this.hypervisorStore.list.isLoading &&
globalComputeHostStore.list.isLoading,

View File

@ -141,7 +141,7 @@ export default class ManageSecurityGroup extends ModalAction {
label: t('Virtual Adapter'),
type: 'select-table',
required: true,
datas: this.ports,
data: this.ports,
isLoading:
this.portStore.list.isLoading && this.portStoreOrigin.list.isLoading,
isMulti: false,

View File

@ -117,7 +117,7 @@ export default class LiveMigrate extends ModalAction {
name: 'host',
label: t('Target Compute Host'),
type: 'select-table',
datas: this.hypervisors,
data: this.hypervisors,
isLoading:
this.hypervisorStore.list.isLoading &&
globalComputeHostStore.list.isLoading,

View File

@ -141,7 +141,7 @@ export class Rebuild extends ModalAction {
name: 'image',
label: t('Operating System'),
type: 'select-table',
datas: this.images,
data: this.images,
isLoading: this.imageStore.list.isLoading,
required: true,
isMulti: false,

View File

@ -83,10 +83,10 @@ export class BaseStep extends Base {
get images() {
const { imageTab } = this.state;
const { image } = this.locationParams;
const datas = image
const data = image
? [toJS(this.imageStore.detail)]
: this.imageStore.list.data || [];
const images = datas.filter((it) => {
const images = data.filter((it) => {
if (!canImageCreateInstance(it)) {
return false;
}
@ -368,7 +368,7 @@ export class BaseStep extends Base {
name: 'image',
label: t('Operating System'),
type: 'select-table',
datas: this.images,
data: this.images,
isLoading: imageLoading,
required: this.sourceTypeIsImage,
isMulti: false,
@ -391,7 +391,7 @@ export class BaseStep extends Base {
name: 'bootableVolume',
label: t('Bootable Volume'),
type: 'select-table',
datas: this.volumes,
data: this.volumes,
isLoading: this.volumeStore.list.isLoading,
required: this.sourceTypeIsVolume,
isMulti: false,

View File

@ -213,7 +213,7 @@ export class SystemStep extends Base {
name: 'keypair',
label: t('Keypair'),
type: 'select-table',
datas: this.keypairs,
data: this.keypairs,
isLoading: this.keyPairStore.list.isLoading,
isMulti: false,
required: !isPassword,
@ -277,7 +277,7 @@ export class SystemStep extends Base {
type: 'select-table',
hidden: !this.hasAdminRole || !more || !isManually,
required: isManually,
datas: this.hypervisors,
data: this.hypervisors,
isLoading: this.hypervisorStore.list.isLoading,
extra: t(
'You can manually specify a physical node to create an instance.'
@ -290,7 +290,7 @@ export class SystemStep extends Base {
label: t('Server Group'),
type: 'select-table',
hidden: !more,
datas: this.serverGroups,
data: this.serverGroups,
isLoading: this.serverGroupStore.list.isLoading,
extra: t(
'Using server groups, you can create cloud hosts on the same/different physical nodes as much as possible to meet the affinity/non-affinity requirements of business applications.'

View File

@ -334,7 +334,7 @@ export class FlavorSelectTable extends Component {
this.settingStore.list.isLoading && this.flavorStore.list.isLoading;
const props = {
columns: this.columns,
datas: this.flavors,
data: this.flavors,
tableHeader: this.renderTableHeander(),
isLoading,
filterParams: [

View File

@ -113,7 +113,7 @@ export default class Manage extends ModalAction {
name: 'associations',
label: t('Resource Types'),
type: 'select-table',
datas: this.resourceTypes,
data: this.resourceTypes,
isLoading: this.store.resourceTypeLoading,
isMulti: true,
filterParams: [

View File

@ -31,7 +31,7 @@ export default class Metadata extends Base {
}
get name() {
return t('metadatas');
return t('metadata');
}
get actionConfigs() {

View File

@ -259,7 +259,7 @@ export class Associate extends ModalAction {
label: t('Instance IP'),
type: 'select-table',
required: true,
datas: instanceFixedIPs,
data: instanceFixedIPs,
isLoading: instanceLoading,
isMulti: false,
filterParams: [
@ -300,8 +300,8 @@ export class Associate extends ModalAction {
label: t('Load Balancer'),
type: 'select-table',
required: true,
// datas: this.instances,
datas: [],
// data: this.instances,
data: [],
isMulti: false,
filterParams: [
{

View File

@ -122,7 +122,7 @@ export default class AssociateFip extends ModalAction {
label: t('Fixed IP'),
type: 'select-table',
required: true,
datas: this.ports,
data: this.ports,
isLoading: portLoading,
disabledFunc: (record) => !record.available,
onChange: this.handleFixedIPChange,
@ -153,7 +153,7 @@ export default class AssociateFip extends ModalAction {
label: t('Floating Ip Address'),
type: 'select-table',
required: true,
datas: canAssociateFloatingIPs,
data: canAssociateFloatingIPs,
isLoading: fipLoading,
isMulti: false,
filterParams: [

View File

@ -33,16 +33,16 @@ export default class Subnets extends Base {
const { data, filters = {}, timeFilter = {} } = this.list;
const { id, tab, ...rest } = filters;
const newFilters = rest;
let datas = [];
let items = [];
if (this.isFilterByBackend) {
datas = toJS(data);
items = toJS(data);
} else {
datas = (toJS(data) || []).filter((it) =>
items = (toJS(data) || []).filter((it) =>
this.filterData(it, toJS(newFilters), toJS(timeFilter))
);
this.updateList({ total: datas.length });
this.updateList({ total: items.length });
}
const hasTransData = datas.some((item) =>
const hasTransData = items.some((item) =>
this.itemInTransitionFunction(item)
);
if (hasTransData) {
@ -50,7 +50,7 @@ export default class Subnets extends Base {
} else {
this.setRefreshdataTimerAuto();
}
const ret = datas.map((item) => {
const ret = items.map((item) => {
const usageDetail = this.subnet_ip_availability.find(
(i) => i.subnet_id === item.id
);

View File

@ -73,8 +73,8 @@ export default class Create extends ModalAction {
}
get fips() {
const datas = toJS(this.fipStore.list.data) || [];
return datas.map((it) => ({
const data = toJS(this.fipStore.list.data) || [];
return data.map((it) => ({
label: it.ip,
value: it.ip,
}));
@ -82,8 +82,8 @@ export default class Create extends ModalAction {
get subnets() {
// todo: filter subnets
const datas = toJS(this.networkStore.subnets) || [];
return datas.map((it) => ({
const data = toJS(this.networkStore.subnets) || [];
return data.map((it) => ({
label: `${it.name}<${it.cidr}>`,
value: JSON.stringify({
deviceId: it.id,

View File

@ -103,7 +103,7 @@ export default class AssociateFip extends ModalAction {
label: t('Floating IP'),
type: 'select-table',
required: true,
datas: this.fipList,
data: this.fipList,
isLoading: this.floatingIpStore.list.isLoading,
isMulti: false,
filterParams: [

View File

@ -120,7 +120,7 @@ export default class ConnectSubnet extends ModalAction {
name: 'subnet',
label: t('Subnet'),
type: 'select-table',
datas: this.subnets,
data: this.subnets,
isLoading: networkId && this.subnetStore.list.isLoading,
disabledFunc: this.disabledFuncSubnet,
required: true,

View File

@ -115,7 +115,7 @@ export class Create extends ModalAction {
name: 'hints',
label: t('Availability Zone Hints'),
type: 'select-table',
datas: this.aZones,
data: this.aZones,
isLoading: globalNeutronStore.zoneLoading,
isMulti: true,
filterParams: [

View File

@ -103,7 +103,7 @@ export default class DisconnectSubnet extends ModalAction {
name: 'subnet',
label: t('Subnet'),
type: 'select-table',
datas: subnets,
data: subnets,
isLoading: subnetLoading,
required: true,
filterParams: [

View File

@ -158,7 +158,7 @@ export default class Create extends ModalAction {
name: 'subnet_id',
label: t('Subnet'),
type: 'select-table',
datas: subnets,
data: subnets,
isLoading: subnetLoading,
isMulti: true,
columns: [

View File

@ -119,7 +119,7 @@ export default class AssociateFip extends ModalAction {
label: t('Fixed IP'),
type: 'select-table',
required: true,
datas: this.ports,
data: this.ports,
isLoading: portLoading,
disabledFunc: (record) => !record.available,
onChange: this.handleFixedIPChange,
@ -150,7 +150,7 @@ export default class AssociateFip extends ModalAction {
label: t('Floating Ip Address'),
type: 'select-table',
required: true,
datas: canAssociateFloatingIPs,
data: canAssociateFloatingIPs,
isLoading: fipLoading,
isMulti: false,
filterParams: [

View File

@ -265,7 +265,7 @@ export class CreateAction extends ModalAction {
tips: t(
'The security group is similar to the firewall function for setting up network access control, or you can go to the console and create a new security group. (Note: The security group you selected will work on all virtual LANS on the instances.)'
),
datas: this.securityGroups,
data: this.securityGroups,
isLoading: this.securityGroupStore.list.isLoading,
extraParams: { project_id: this.currentProjectId },
backendPageStore: this.securityGroupStore,

View File

@ -69,7 +69,7 @@ export default class DisAssociateFip extends ModalAction {
label: t('Floating IP'),
type: 'select-table',
required: true,
datas: associatedDetail,
data: associatedDetail,
isMulti: false,
tagKey: 'floating_ip_address',
filterParams: [

View File

@ -358,7 +358,7 @@ export class Create extends FormAction {
name: 'image',
label: t('Operating System'),
type: 'select-table',
datas: this.images,
data: this.images,
isLoading: this.imageStore.list.isLoading,
required: this.sourceTypeIsImage,
isMulti: false,
@ -432,7 +432,7 @@ export class Create extends FormAction {
'The volume type needs to set "multiattach" in the metadata to support shared volume attributes.'
),
...volumeTypeSelectProps,
datas: this.volumeTypes,
data: this.volumeTypes,
isLoading: this.volumeTypeStore.list.isLoading,
required: true,
extra: this.getVolumeTypeExtra(),

View File

@ -79,7 +79,7 @@ export class Detach extends ModalAction {
label: t('Instance'),
type: 'select-table',
required: true,
datas: (this.item.attachments || []).map((s) => ({
data: (this.item.attachments || []).map((s) => ({
...s,
name: s.server_name,
id: s.server_id,

View File

@ -88,7 +88,7 @@ export default class Migrate extends ModalAction {
label: t('Target Storage Backend'),
type: 'select-table',
required: true,
datas: this.pools,
data: this.pools,
isLoading: this.poolStore.list.isLoading,
disabledFunc: this.disableFunc,
rowKey: 'name',

View File

@ -147,7 +147,7 @@ export default class Create extends ModalAction {
type: 'select-table',
isMulti: true,
hidden: isPublic,
datas: this.projects,
data: this.projects,
isLoading: this.projectStore.list.isLoading,
...projectTableOptions,
},

View File

@ -112,7 +112,7 @@ export default class ManageAccess extends ModalAction {
type: 'select-table',
isMulti: true,
hidden: isPublic,
datas: this.projects,
data: this.projects,
isLoading: this.projectStore.list.isLoading,
...projectTableOptions,
},

View File

@ -78,7 +78,7 @@ export default class ManageQos extends ModalAction {
label: t('QoS'),
type: 'select-table',
required: false,
datas: this.QosMap,
data: this.QosMap,
isLoading: this.store.list.isLoading,
isMulti: false,
filterParams: [

View File

@ -122,9 +122,9 @@ export function getPortFormItem(device_owner) {
title: t('Fixed IPs'),
dataIndex: 'fixed_ips',
sorter: false,
render: (datas) => (
render: (data) => (
<>
{datas.map((d, idx) => (
{data.map((d, idx) => (
<div key={`ip_address_${idx}`}>{d.ip_address}</div>
))}
</>
@ -150,7 +150,7 @@ export function getPortFormItem(device_owner) {
type: 'select-table',
rowKey: 'fixed_ip_address',
required: true,
datas: portFixedIPs,
data: portFixedIPs,
isLoading: fixedIpLoading,
isMulti: false,
filterParams: [

View File

@ -287,14 +287,14 @@ export default class BaseStore {
async requestListAllByLimit(params, limit) {
let marker = '';
let hasNext = true;
let datas = [];
let data = [];
while (hasNext) {
// eslint-disable-next-line no-await-in-loop
const result = await this.requestListByMarker(params, limit, marker);
const data = this.getListDataFromResult(result);
datas = [...datas, ...data];
const items = this.getListDataFromResult(result);
data = [...data, ...items];
if (data.length >= limit) {
marker = this.parseMarker(data, result, datas);
marker = this.parseMarker(items, result, data);
if (!marker) {
// eslint-disable-next-line no-console
console.log('parse marker error!');
@ -304,7 +304,7 @@ export default class BaseStore {
hasNext = false;
}
}
return datas;
return data;
}
async requestListAll(params, originParams) {
@ -313,16 +313,16 @@ export default class BaseStore {
}
async requestList(params, originParams) {
const datas = !this.fetchListByLimit
const data = !this.fetchListByLimit
? await this.requestListAll(params, originParams)
: await this.requestListAllByLimit(params, 100);
return datas;
return data;
}
// eslint-disable-next-line no-unused-vars
async requestListByPage(params, page, originParams) {
const datas = await this.listFetchByClient(params, originParams);
return datas;
const data = await this.listFetchByClient(params, originParams);
return data;
}
// eslint-disable-next-line no-unused-vars
@ -412,15 +412,13 @@ export default class BaseStore {
}
// eslint-disable-next-line no-unused-vars
parseMarker(datas, result, allDatas) {
return datas.length === 0
? ''
: get(datas[datas.length - 1], this.markerKey);
parseMarker(data, result, allData) {
return data.length === 0 ? '' : get(data[data.length - 1], this.markerKey);
}
@action
updateMarker(datas, page, result, allDatas) {
const marker = this.parseMarker(datas, result, allDatas);
updateMarker(data, page, result, allData) {
const marker = this.parseMarker(data, result, allData);
if (page === 1) {
this.list.markers = [marker];
} else {
@ -438,7 +436,7 @@ export default class BaseStore {
this.listResponseKey ? get(result, this.listResponseKey, []) : result;
// eslint-disable-next-line no-unused-vars
async getCountForPage(newParams, all_projects, newDatas) {
async getCountForPage(newParams, all_projects, newData) {
return {};
}

View File

@ -45,8 +45,8 @@ export class SnapshotStore extends Base {
return items;
}
const { id } = filters;
const datas = id ? items.filter((it) => it.volume_id === id) : items;
return datas;
const data = id ? items.filter((it) => it.volume_id === id) : items;
return data;
}
async detailDidFetch(item) {

View File

@ -200,12 +200,12 @@ export class VolumeStore extends Base {
@action
async fetchVolumeTypes(params) {
const datas = await globalVolumeTypeStore.fetchList(params);
this.volumeTypes = datas.map((it) => ({
const data = await globalVolumeTypeStore.fetchList(params);
this.volumeTypes = data.map((it) => ({
label: it.name,
value: it.id,
}));
this.originalvolumeTypes = datas || [];
this.originalvolumeTypes = data || [];
}
}

View File

@ -99,8 +99,8 @@ export class NetworkStore extends Base {
if (!isFirewall) {
return items;
}
const datas = await this.listDidFetchFirewall(items);
return datas;
const data = await this.listDidFetchFirewall(items);
return data;
}
async listDidFetchFirewall(items) {

View File

@ -133,8 +133,8 @@ export class RouterStore extends Base {
if (!isFirewall) {
return items;
}
const datas = await this.listDidFetchFirewall(items);
return datas;
const data = await this.listDidFetchFirewall(items);
return data;
}
async listDidFetchFirewall(items) {

View File

@ -46,10 +46,10 @@ export class AggregateStore extends Base {
}
@action
manageMetadata({ id, metadatas }) {
manageMetadata({ id, metadata }) {
const body = {
set_metadata: {
metadata: metadatas,
metadata,
},
};
return this.submitting(this.client.action(id, body));

View File

@ -120,10 +120,10 @@ export class ServerStore extends Base {
if (members && isServerGroup && members.length === 0) {
return [];
}
const datas = !this.fetchListByLimit
const data = !this.fetchListByLimit
? await this.requestListAll(params)
: await this.requestListAllByLimit(params, 100);
return datas;
return data;
}
async listDidFetch(newData, allProjects, filters) {

View File

@ -29,8 +29,8 @@ export class ServerGroupStore extends Base {
offset: marker,
});
parseMarker(datas, result, allDatas) {
return allDatas.length;
parseMarker(data, result, allData) {
return allData.length;
}
}

View File

@ -39,11 +39,11 @@ export class AvailabilityZoneStore extends Base {
}
async listDidFetch(items) {
const datas = [];
const data = [];
items.forEach((item) => {
const { hosts } = item;
if (isNull(hosts)) {
datas.push(item);
data.push(item);
} else {
const newHost = {};
Object.keys(hosts).forEach((key) => {
@ -53,21 +53,21 @@ export class AvailabilityZoneStore extends Base {
}
});
if (!isEmpty(newHost)) {
datas.push({
data.push({
...item,
host: newHost,
});
}
}
});
return datas;
return data;
}
@action
async fetchListWithoutDetail() {
const result = await this.client.list();
const datas = result[this.listResponseKey];
this.list.data = datas.map(this.mapper);
const data = result[this.listResponseKey];
this.list.data = data.map(this.mapper);
}
}