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:
parent
fd69957fcf
commit
61f21da7e6
@ -331,7 +331,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
|
|||||||
- `select-table`
|
- `select-table`
|
||||||
- Table with selected actions
|
- Table with selected actions
|
||||||
- `isMulti`, whether is multi, default is `false`
|
- `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`
|
- `columns`, table columns configuration, the same as `BaseList`
|
||||||
- `filterParams`, search configuration
|
- `filterParams`, search configuration
|
||||||
- `pageSize`, items number per page, default `5`
|
- `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` :
|
- 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
|
- 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
|
- Not multi selected
|
||||||
- Configure selected label to `Image`
|
- Configure selected label to `Image`
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
|
|||||||
name: 'image',
|
name: 'image',
|
||||||
label: t('Operating System'),
|
label: t('Operating System'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.images,
|
data: this.images,
|
||||||
required: sourceTypesIsImage,
|
required: sourceTypesIsImage,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
hidden: !sourceTypesIsImage,
|
hidden: !sourceTypesIsImage,
|
||||||
@ -796,7 +796,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
|
|||||||
- `dataSource`, data source for choose
|
- `dataSource`, data source for choose
|
||||||
- `showSearch`, whether to show search input
|
- `showSearch`, whether to show search input
|
||||||
- `oriTargetKeys`, default selected
|
- `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` :
|
- Take edit system role as an example `src/pages/identity/containers/User/actions/SystemRole.jsx` :
|
||||||
- Left is the project name list
|
- Left is the project name list
|
||||||
- Right is the project name and role list of project
|
- Right is the project name and role list of project
|
||||||
@ -968,7 +968,7 @@ English | [简体中文](../../zh/develop/3-10-FormItem-introduction.md)
|
|||||||
name: 'systems',
|
name: 'systems',
|
||||||
label: t('Metadata'),
|
label: t('Metadata'),
|
||||||
type: 'metadata-transfer',
|
type: 'metadata-transfer',
|
||||||
metadatas: this.metadatas,
|
metadata: this.metadata,
|
||||||
validator: (rule, value) => {
|
validator: (rule, value) => {
|
||||||
if (this.hasNoValue(value)) {
|
if (this.hasNoValue(value)) {
|
||||||
return Promise.reject(t('Please input value'));
|
return Promise.reject(t('Please input value'));
|
||||||
|
@ -99,8 +99,8 @@ English | [Chinese](../../zh/develop/3-5-BaseStore-introduction.md)
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const { id } = filters;
|
const { id } = filters;
|
||||||
const datas = id ? items.filter((it) => it.volume_id === id) : items;
|
const data = id ? items.filter((it) => it.volume_id === id) : items;
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@
|
|||||||
- `select-table`
|
- `select-table`
|
||||||
- 带有选择操作的表格
|
- 带有选择操作的表格
|
||||||
- `isMulti`,是否是多选,默认为`false`
|
- `isMulti`,是否是多选,默认为`false`
|
||||||
- `datas`,数据源,使用前端分页时使用
|
- `data`,数据源,使用前端分页时使用
|
||||||
- `columns`,表格列的配置,配置方式同`BaseList`
|
- `columns`,表格列的配置,配置方式同`BaseList`
|
||||||
- `filterParams`,搜索项的配置
|
- `filterParams`,搜索项的配置
|
||||||
- `pageSize`,每页条目数量,默认为 5
|
- `pageSize`,每页条目数量,默认为 5
|
||||||
@ -392,7 +392,7 @@
|
|||||||
|
|
||||||
- 以创建云硬盘选择镜像`src/pages/storage/containers/Volume/actions/Create/index.jsx`为例
|
- 以创建云硬盘选择镜像`src/pages/storage/containers/Volume/actions/Create/index.jsx`为例
|
||||||
- 这是带有 Tab 标签的表格,默认展示第一个 tab,tab 切换时会更新数据源
|
- 这是带有 Tab 标签的表格,默认展示第一个 tab,tab 切换时会更新数据源
|
||||||
- 数据使用前端分页的方式获取,直接配置`datas`即可
|
- 数据使用前端分页的方式获取,直接配置`data`即可
|
||||||
- 是单选
|
- 是单选
|
||||||
- 配置了已选标签为`已选 镜像`
|
- 配置了已选标签为`已选 镜像`
|
||||||
|
|
||||||
@ -401,7 +401,7 @@
|
|||||||
name: 'image',
|
name: 'image',
|
||||||
label: t('Operating System'),
|
label: t('Operating System'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.images,
|
data: this.images,
|
||||||
required: sourceTypesIsImage,
|
required: sourceTypesIsImage,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
hidden: !sourceTypesIsImage,
|
hidden: !sourceTypesIsImage,
|
||||||
@ -966,7 +966,7 @@
|
|||||||
name: 'systems',
|
name: 'systems',
|
||||||
label: t('Metadata'),
|
label: t('Metadata'),
|
||||||
type: 'metadata-transfer',
|
type: 'metadata-transfer',
|
||||||
metadatas: this.metadatas,
|
metadata: this.metadata,
|
||||||
validator: (rule, value) => {
|
validator: (rule, value) => {
|
||||||
if (this.hasNoValue(value)) {
|
if (this.hasNoValue(value)) {
|
||||||
return Promise.reject(t('Please input value'));
|
return Promise.reject(t('Please input value'));
|
||||||
|
@ -99,8 +99,8 @@
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const { id } = filters;
|
const { id } = filters;
|
||||||
const datas = id ? items.filter((it) => it.volume_id === id) : items;
|
const data = id ? items.filter((it) => it.volume_id === id) : items;
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
|
|||||||
<SelectTable
|
<SelectTable
|
||||||
maxSelectedCount={-1}
|
maxSelectedCount={-1}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
datas={ports}
|
data={ports}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
title: t('ID/Name'),
|
title: t('ID/Name'),
|
||||||
|
@ -33,10 +33,10 @@ export default class MetadataTransfer extends Component {
|
|||||||
this.state = this.initState(props);
|
this.state = this.initState(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
get metadatas() {
|
get metadata() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const { metadatas } = this.props;
|
const { metadata } = this.props;
|
||||||
return (metadatas || []).map((item) => {
|
return (metadata || []).map((item) => {
|
||||||
const {
|
const {
|
||||||
detail: { properties = {} } = {},
|
detail: { properties = {} } = {},
|
||||||
namespace,
|
namespace,
|
||||||
@ -104,18 +104,18 @@ export default class MetadataTransfer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initState = (props) => {
|
initState = (props) => {
|
||||||
const { value, metadatas = [] } = props;
|
const { value, metadata = [] } = props;
|
||||||
const targetKeys = [];
|
const targetKeys = [];
|
||||||
const checkedKeys = [];
|
const checkedKeys = [];
|
||||||
const selectedKeysTable = [];
|
const selectedKeysTable = [];
|
||||||
const values = {};
|
const values = {};
|
||||||
Object.keys(value).forEach((key) => {
|
Object.keys(value).forEach((key) => {
|
||||||
const metadata = metadatas.find((it) => {
|
const item = metadata.find((it) => {
|
||||||
const { detail: { properties = {} } = {} } = it;
|
const { detail: { properties = {} } = {} } = it;
|
||||||
return Object.keys(properties).indexOf(key) >= 0;
|
return Object.keys(properties).indexOf(key) >= 0;
|
||||||
});
|
});
|
||||||
if (metadata) {
|
if (item) {
|
||||||
const { namespace } = metadata;
|
const { namespace } = item;
|
||||||
const newKey = `${namespace}--${key}`;
|
const newKey = `${namespace}--${key}`;
|
||||||
targetKeys.push(newKey);
|
targetKeys.push(newKey);
|
||||||
values[newKey] = value[key];
|
values[newKey] = value[key];
|
||||||
@ -224,24 +224,24 @@ export default class MetadataTransfer extends Component {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
flatten = (aList = [], datas = []) => {
|
flatten = (aList = [], data = []) => {
|
||||||
aList.forEach((item) => {
|
aList.forEach((item) => {
|
||||||
const { children = [] } = item;
|
const { children = [] } = item;
|
||||||
datas.push(item);
|
data.push(item);
|
||||||
this.flatten(children, datas);
|
this.flatten(children, data);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
getTreeData = () => {
|
getTreeData = () => {
|
||||||
const datas = [];
|
const data = [];
|
||||||
this.flatten(this.metadatas, datas);
|
this.flatten(this.metadata, data);
|
||||||
return datas;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
getTreeDataWithoutFather = () => {
|
getTreeDataWithoutFather = () => {
|
||||||
const datas = [];
|
const data = [];
|
||||||
this.flatten(this.metadatas, datas);
|
this.flatten(this.metadata, data);
|
||||||
return datas.filter((it) => it.key.indexOf('--') >= 0);
|
return data.filter((it) => it.key.indexOf('--') >= 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
getAllTreeKeys = () => {
|
getAllTreeKeys = () => {
|
||||||
@ -282,7 +282,7 @@ export default class MetadataTransfer extends Component {
|
|||||||
blockNode
|
blockNode
|
||||||
checkable
|
checkable
|
||||||
checkedKeys={checkedKeys}
|
checkedKeys={checkedKeys}
|
||||||
treeData={this.generateTree(this.metadatas, targetKeys)}
|
treeData={this.generateTree(this.metadata, targetKeys)}
|
||||||
onCheck={this.onCheckTree(onItemSelect)}
|
onCheck={this.onCheckTree(onItemSelect)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -339,7 +339,7 @@ export default class MetadataTransfer extends Component {
|
|||||||
|
|
||||||
getChildKeys = (namespace) => {
|
getChildKeys = (namespace) => {
|
||||||
const keys = [];
|
const keys = [];
|
||||||
this.metadatas.forEach((item) => {
|
this.metadata.forEach((item) => {
|
||||||
(item.children || []).forEach((child) => {
|
(item.children || []).forEach((child) => {
|
||||||
if (child.namespace === namespace) {
|
if (child.namespace === namespace) {
|
||||||
keys.push(child.key);
|
keys.push(child.key);
|
||||||
@ -402,7 +402,7 @@ export default class MetadataTransfer extends Component {
|
|||||||
}
|
}
|
||||||
const namespace = tmp[0];
|
const namespace = tmp[0];
|
||||||
const realKey = tmp[1];
|
const realKey = tmp[1];
|
||||||
const father = this.metadatas.find((it) => it.key === namespace);
|
const father = this.metadata.find((it) => it.key === namespace);
|
||||||
if (!father) {
|
if (!father) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -214,11 +214,11 @@ export default class NetworkSelect extends React.Component {
|
|||||||
getNetworkOptions = () => {
|
getNetworkOptions = () => {
|
||||||
const { networks } = this.state;
|
const { networks } = this.state;
|
||||||
const { optionsByIndex, index } = this.props;
|
const { optionsByIndex, index } = this.props;
|
||||||
let datas = [...networks];
|
let data = [...networks];
|
||||||
if (optionsByIndex && index < networks.length) {
|
if (optionsByIndex && index < networks.length) {
|
||||||
datas = [networks[index]];
|
data = [networks[index]];
|
||||||
}
|
}
|
||||||
return datas.map((it) => ({
|
return data.map((it) => ({
|
||||||
label: it.name,
|
label: it.name,
|
||||||
value: it.id,
|
value: it.id,
|
||||||
}));
|
}));
|
||||||
|
@ -25,7 +25,7 @@ import styles from './index.less';
|
|||||||
|
|
||||||
const getItemKey = (item) => item.key || item.id;
|
const getItemKey = (item) => item.key || item.id;
|
||||||
|
|
||||||
const getInitRows = (value, datas, backendPageStore) => {
|
const getInitRows = (value, data, backendPageStore) => {
|
||||||
const { selectedRowKeys = [], selectedRows = [] } = value;
|
const { selectedRowKeys = [], selectedRows = [] } = value;
|
||||||
if (!selectedRowKeys || selectedRowKeys.length === 0) {
|
if (!selectedRowKeys || selectedRowKeys.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
@ -36,7 +36,7 @@ const getInitRows = (value, datas, backendPageStore) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const rows = selectedRowKeys.map((key) => {
|
const rows = selectedRowKeys.map((key) => {
|
||||||
const findSourceData = !backendPageStore ? datas : selectedRows;
|
const findSourceData = !backendPageStore ? data : selectedRows;
|
||||||
const item = (findSourceData || []).find((it) => getItemKey(it) === key);
|
const item = (findSourceData || []).find((it) => getItemKey(it) === key);
|
||||||
return (
|
return (
|
||||||
item || {
|
item || {
|
||||||
@ -52,7 +52,7 @@ const getInitRows = (value, datas, backendPageStore) => {
|
|||||||
@observer
|
@observer
|
||||||
export default class SelectTable extends React.Component {
|
export default class SelectTable extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
datas: PropTypes.array,
|
data: PropTypes.array,
|
||||||
columns: PropTypes.array.isRequired,
|
columns: PropTypes.array.isRequired,
|
||||||
isMulti: PropTypes.bool,
|
isMulti: PropTypes.bool,
|
||||||
pageSize: PropTypes.number,
|
pageSize: PropTypes.number,
|
||||||
@ -86,7 +86,7 @@ export default class SelectTable extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
datas: [],
|
data: [],
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
canSearch: true,
|
canSearch: true,
|
||||||
@ -111,10 +111,10 @@ export default class SelectTable extends React.Component {
|
|||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
const { datas = [], pageSize, initValue = {} } = props;
|
const { data = [], pageSize, initValue = {} } = props;
|
||||||
const { selectedRowKeys, selectedRows } = this.getInitValue(props);
|
const { selectedRowKeys, selectedRows } = this.getInitValue(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
datas,
|
data,
|
||||||
filters: null,
|
filters: null,
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize,
|
pageSize,
|
||||||
@ -153,39 +153,39 @@ export default class SelectTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInitValue(props) {
|
getInitValue(props) {
|
||||||
const { value = {}, initValue = {}, datas = [], backendPageStore } = props;
|
const { value = {}, initValue = {}, data = [], backendPageStore } = props;
|
||||||
if (!isEmpty(initValue)) {
|
if (!isEmpty(initValue)) {
|
||||||
const { selectedRowKeys = [] } = initValue;
|
const { selectedRowKeys = [] } = initValue;
|
||||||
return {
|
return {
|
||||||
selectedRowKeys,
|
selectedRowKeys,
|
||||||
selectedRows: getInitRows(initValue, datas, backendPageStore),
|
selectedRows: getInitRows(initValue, data, backendPageStore),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const { selectedRowKeys = [] } = value || {};
|
const { selectedRowKeys = [] } = value || {};
|
||||||
return {
|
return {
|
||||||
selectedRowKeys,
|
selectedRowKeys,
|
||||||
selectedRows: getInitRows(value || {}, datas, backendPageStore),
|
selectedRows: getInitRows(value || {}, data, backendPageStore),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getTotal(props) {
|
getTotal(props) {
|
||||||
const {
|
const {
|
||||||
datas = [],
|
data = [],
|
||||||
backendPageStore,
|
backendPageStore,
|
||||||
backendPageDataKey,
|
backendPageDataKey,
|
||||||
} = props || this.props;
|
} = props || this.props;
|
||||||
if (!backendPageStore) {
|
if (!backendPageStore) {
|
||||||
return datas.length;
|
return data.length;
|
||||||
}
|
}
|
||||||
return (backendPageStore[backendPageDataKey] || {}).total;
|
return (backendPageStore[backendPageDataKey] || {}).total;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(nextProps, prevState) {
|
static getDerivedStateFromProps(nextProps, prevState) {
|
||||||
const { value, datas = [], backendPageStore, initValue = {} } = nextProps;
|
const { value, data = [], backendPageStore, initValue = {} } = nextProps;
|
||||||
const newState = {};
|
const newState = {};
|
||||||
if (!backendPageStore && !isEqual(datas, prevState.datas)) {
|
if (!backendPageStore && !isEqual(data, prevState.data)) {
|
||||||
newState.datas = datas;
|
newState.data = data;
|
||||||
newState.total = datas.length;
|
newState.total = data.length;
|
||||||
newState.current = prevState.current || 1;
|
newState.current = prevState.current || 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ export default class SelectTable extends React.Component {
|
|||||||
}
|
}
|
||||||
if (!isEqual(initValue, prevState.initValue)) {
|
if (!isEqual(initValue, prevState.initValue)) {
|
||||||
const { selectedRowKeys = [] } = initValue;
|
const { selectedRowKeys = [] } = initValue;
|
||||||
const selectedRows = getInitRows(initValue, datas, backendPageStore);
|
const selectedRows = getInitRows(initValue, data, backendPageStore);
|
||||||
newState.selectedRowKeys = selectedRowKeys;
|
newState.selectedRowKeys = selectedRowKeys;
|
||||||
newState.selectedRows = selectedRows;
|
newState.selectedRows = selectedRows;
|
||||||
newState.initValue = initValue;
|
newState.initValue = initValue;
|
||||||
@ -279,7 +279,7 @@ export default class SelectTable extends React.Component {
|
|||||||
const { total } = backendPageStore[backendPageDataKey] || {};
|
const { total } = backendPageStore[backendPageDataKey] || {};
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
datas: data,
|
data,
|
||||||
total,
|
total,
|
||||||
current: newParams.page,
|
current: newParams.page,
|
||||||
pageSize: newParams.limit,
|
pageSize: newParams.limit,
|
||||||
@ -317,8 +317,8 @@ export default class SelectTable extends React.Component {
|
|||||||
if (backendPageStore) {
|
if (backendPageStore) {
|
||||||
return this.getDataFromStore();
|
return this.getDataFromStore();
|
||||||
}
|
}
|
||||||
const { datas } = this.state;
|
const { data } = this.state;
|
||||||
const tmpDatas = datas.map((it) => {
|
const tmpData = data.map((it) => {
|
||||||
if (it.key) {
|
if (it.key) {
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
@ -327,7 +327,7 @@ export default class SelectTable extends React.Component {
|
|||||||
key: get(it, rowKey),
|
key: get(it, rowKey),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return tmpDatas;
|
return tmpData;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -344,8 +344,8 @@ export default class SelectTable extends React.Component {
|
|||||||
if (!backendPageStore || !isMulti) {
|
if (!backendPageStore || !isMulti) {
|
||||||
return selectedRowKeys;
|
return selectedRowKeys;
|
||||||
}
|
}
|
||||||
const { selectedRowKeys: keysInState, datas } = this.state;
|
const { selectedRowKeys: keysInState, data } = this.state;
|
||||||
const currentDataKeys = datas.map((it) => getItemKey(it));
|
const currentDataKeys = data.map((it) => getItemKey(it));
|
||||||
const addKeys = selectedRowKeys.filter(
|
const addKeys = selectedRowKeys.filter(
|
||||||
(key) => currentDataKeys.indexOf(key) >= 0
|
(key) => currentDataKeys.indexOf(key) >= 0
|
||||||
);
|
);
|
||||||
@ -426,23 +426,23 @@ export default class SelectTable extends React.Component {
|
|||||||
tab: tab || tabInState,
|
tab: tab || tabInState,
|
||||||
selectedRows: rows,
|
selectedRows: rows,
|
||||||
selectedRowKeys: selectedRowKeys || keysInState,
|
selectedRowKeys: selectedRowKeys || keysInState,
|
||||||
datas: this.getDataSource(),
|
data: this.getDataSource(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getSelectedRowsAll = (selectedRowKeys) => {
|
getSelectedRowsAll = (selectedRowKeys) => {
|
||||||
const { datas = [], selectedRowKeys: keysInState } = this.state;
|
const { data = [], selectedRowKeys: keysInState } = this.state;
|
||||||
if (selectedRowKeys) {
|
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) => {
|
getSelectedRowsBackend = (selectedRowKeys) => {
|
||||||
const { isMulti } = this.props;
|
const { isMulti } = this.props;
|
||||||
const {
|
const {
|
||||||
datas = [],
|
data = [],
|
||||||
selectedRowKeys: keysInState,
|
selectedRowKeys: keysInState,
|
||||||
selectedRows: rowsInState,
|
selectedRows: rowsInState,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
@ -450,7 +450,7 @@ export default class SelectTable extends React.Component {
|
|||||||
return this.getSelectedRowsBackendMulti(selectedRowKeys);
|
return this.getSelectedRowsBackendMulti(selectedRowKeys);
|
||||||
}
|
}
|
||||||
const keys = selectedRowKeys || keysInState;
|
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) {
|
if (rows.length === keys.length) {
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ export default class SelectTable extends React.Component {
|
|||||||
|
|
||||||
getSelectedRowsBackendMulti = (selectedRowKeys) => {
|
getSelectedRowsBackendMulti = (selectedRowKeys) => {
|
||||||
const {
|
const {
|
||||||
datas = [],
|
data = [],
|
||||||
selectedRowKeys: keysInState = [],
|
selectedRowKeys: keysInState = [],
|
||||||
selectedRows: rowsInState = [],
|
selectedRows: rowsInState = [],
|
||||||
} = this.state;
|
} = this.state;
|
||||||
@ -481,7 +481,7 @@ export default class SelectTable extends React.Component {
|
|||||||
const oldLefRows = rowsInState.filter(
|
const oldLefRows = rowsInState.filter(
|
||||||
(it) => delKeys.indexOf(getItemKey(it)) < 0
|
(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];
|
return [...oldLefRows, ...newRows];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -673,7 +673,7 @@ export default class SelectTable extends React.Component {
|
|||||||
};
|
};
|
||||||
const footer = backendPageStore ? this.renderTableFooter : null;
|
const footer = backendPageStore ? this.renderTableFooter : null;
|
||||||
const isLoading = this.getLoading();
|
const isLoading = this.getLoading();
|
||||||
const datas = this.getDataSource();
|
const data = this.getDataSource();
|
||||||
const pageTableClass = backendPageStore
|
const pageTableClass = backendPageStore
|
||||||
? styles['sl-select-table-backend']
|
? styles['sl-select-table-backend']
|
||||||
: '';
|
: '';
|
||||||
@ -688,7 +688,7 @@ export default class SelectTable extends React.Component {
|
|||||||
rowSelection={this.rowSelection}
|
rowSelection={this.rowSelection}
|
||||||
rowKey={rowKey}
|
rowKey={rowKey}
|
||||||
columns={this.tableColumns}
|
columns={this.tableColumns}
|
||||||
datas={datas}
|
data={data}
|
||||||
filters={filters}
|
filters={filters}
|
||||||
searchFilters={filterParams}
|
searchFilters={filterParams}
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
|
@ -41,7 +41,7 @@ export default class TabSelectTable extends Component {
|
|||||||
onChange && onChange(this.state);
|
onChange && onChange(this.state);
|
||||||
};
|
};
|
||||||
|
|
||||||
getMultiSelected = (keys, rows, datas) => {
|
getMultiSelected = (keys, rows, data) => {
|
||||||
const { selectedRowKeys: keysInState, selectedRows: rowsInState } =
|
const { selectedRowKeys: keysInState, selectedRows: rowsInState } =
|
||||||
this.state;
|
this.state;
|
||||||
const addKeys = keys.filter((key) => keysInState.indexOf(key) < 0);
|
const addKeys = keys.filter((key) => keysInState.indexOf(key) < 0);
|
||||||
@ -53,8 +53,8 @@ export default class TabSelectTable extends Component {
|
|||||||
if (!notInKeys) {
|
if (!notInKeys) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const data = datas.find((it) => it.key === key || it.id === key);
|
const item = data.find((it) => it.key === key || it.id === key);
|
||||||
return !!data;
|
return !!item;
|
||||||
});
|
});
|
||||||
const newKeys = [...keysInState, ...addKeys].filter(
|
const newKeys = [...keysInState, ...addKeys].filter(
|
||||||
(key) => removeKeys.indexOf(key) < 0
|
(key) => removeKeys.indexOf(key) < 0
|
||||||
@ -67,10 +67,10 @@ export default class TabSelectTable extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onSelectTableChange = (value) => {
|
onSelectTableChange = (value) => {
|
||||||
const { selectedRowKeys, selectedRows, datas } = value;
|
const { selectedRowKeys, selectedRows, data } = value;
|
||||||
const { isMulti = false } = this.props;
|
const { isMulti = false } = this.props;
|
||||||
const [newKeys, newRows] = isMulti
|
const [newKeys, newRows] = isMulti
|
||||||
? this.getMultiSelected(selectedRowKeys, selectedRows, datas)
|
? this.getMultiSelected(selectedRowKeys, selectedRows, data)
|
||||||
: [selectedRowKeys, selectedRows];
|
: [selectedRowKeys, selectedRows];
|
||||||
const newState = {
|
const newState = {
|
||||||
selectedRowKeys: newKeys,
|
selectedRowKeys: newKeys,
|
||||||
|
@ -119,7 +119,7 @@ export default class ProjectSelect extends ModalAction {
|
|||||||
name: 'project',
|
name: 'project',
|
||||||
label: t('Owned Project'),
|
label: t('Owned Project'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: globalUserStore.userProjects.isLoading,
|
isLoading: globalUserStore.userProjects.isLoading,
|
||||||
disabledFunc: (record) => !record.enabled,
|
disabledFunc: (record) => !record.enabled,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -26,14 +26,14 @@ export default class RuleButton extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { item: { security_group_rules: datas = [] } = {} } = this.props;
|
const { item: { security_group_rules: data = [] } = {} } = this.props;
|
||||||
const configs = {
|
const configs = {
|
||||||
buttonType: 'link',
|
buttonType: 'link',
|
||||||
title: t('Security Group Rules'),
|
title: t('Security Group Rules'),
|
||||||
buttonText: t('View Rules'),
|
buttonText: t('View Rules'),
|
||||||
modalSize: 'middle',
|
modalSize: 'middle',
|
||||||
columns: getSelfColumns(this),
|
columns: getSelfColumns(this),
|
||||||
datas,
|
data,
|
||||||
};
|
};
|
||||||
return <TableButton {...configs} style={{ paddingLeft: 0 }} />;
|
return <TableButton {...configs} style={{ paddingLeft: 0 }} />;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export default class TableButton extends Component {
|
|||||||
return {
|
return {
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
buttonType: PropTypes.string,
|
buttonType: PropTypes.string,
|
||||||
datas: PropTypes.array,
|
data: PropTypes.array,
|
||||||
columns: PropTypes.array,
|
columns: PropTypes.array,
|
||||||
modalSize: PropTypes.string,
|
modalSize: PropTypes.string,
|
||||||
className: PropTypes.func,
|
className: PropTypes.func,
|
||||||
@ -33,7 +33,7 @@ export default class TableButton extends Component {
|
|||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
buttonType: 'link',
|
buttonType: 'link',
|
||||||
datas: [],
|
data: [],
|
||||||
columns: [],
|
columns: [],
|
||||||
modalSize: 'middle',
|
modalSize: 'middle',
|
||||||
className: '',
|
className: '',
|
||||||
@ -42,8 +42,8 @@ export default class TableButton extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderTable = () => {
|
renderTable = () => {
|
||||||
const { datas, columns } = this.props;
|
const { data, columns } = this.props;
|
||||||
return <Table columns={columns} dataSource={datas} />;
|
return <Table columns={columns} dataSource={data} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -340,7 +340,7 @@ class ActionButton extends Component {
|
|||||||
);
|
);
|
||||||
const results = allSettled(promises);
|
const results = allSettled(promises);
|
||||||
results.then((res) => {
|
results.then((res) => {
|
||||||
const failedDatas = res
|
const failedData = res
|
||||||
.map((it, idx) => {
|
.map((it, idx) => {
|
||||||
if (it.status === 'rejected') {
|
if (it.status === 'rejected') {
|
||||||
return {
|
return {
|
||||||
@ -351,14 +351,14 @@ class ActionButton extends Component {
|
|||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
.filter((it) => !!it);
|
.filter((it) => !!it);
|
||||||
if (failedDatas.length === 0) {
|
if (failedData.length === 0) {
|
||||||
this.onShowSuccess(data, afterSubmit);
|
this.onShowSuccess(data, afterSubmit);
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
failedDatas.forEach((it) => {
|
failedData.forEach((it) => {
|
||||||
this.onShowError(it.data, it.reason);
|
this.onShowError(it.data, it.reason);
|
||||||
});
|
});
|
||||||
if (failedDatas.length === data.length) {
|
if (failedData.length === data.length) {
|
||||||
return reject();
|
return reject();
|
||||||
}
|
}
|
||||||
return resolve();
|
return resolve();
|
||||||
|
@ -27,7 +27,7 @@ import styles from './index.less';
|
|||||||
export default class index extends Component {
|
export default class index extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
columns: PropTypes.array,
|
columns: PropTypes.array,
|
||||||
datas: PropTypes.array,
|
data: PropTypes.array,
|
||||||
total: PropTypes.number,
|
total: PropTypes.number,
|
||||||
getValueRenderFunc: PropTypes.func.isRequired,
|
getValueRenderFunc: PropTypes.func.isRequired,
|
||||||
resourceName: PropTypes.string,
|
resourceName: PropTypes.string,
|
||||||
@ -37,7 +37,7 @@ export default class index extends Component {
|
|||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
columns: [],
|
columns: [],
|
||||||
datas: [],
|
data: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
totalMax: 10000,
|
totalMax: 10000,
|
||||||
resourceName: '',
|
resourceName: '',
|
||||||
@ -123,11 +123,11 @@ export default class index extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getDownloadData() {
|
getDownloadData() {
|
||||||
const { columns, datas } = this.props;
|
const { columns, data } = this.props;
|
||||||
return datas.map((data) => {
|
return data.map((d) => {
|
||||||
const item = {};
|
const item = {};
|
||||||
columns.forEach((it) => {
|
columns.forEach((it) => {
|
||||||
const value = this.getColumnData(data, it);
|
const value = this.getColumnData(d, it);
|
||||||
item[it.dataIndex] = value;
|
item[it.dataIndex] = value;
|
||||||
});
|
});
|
||||||
return item;
|
return item;
|
||||||
@ -265,12 +265,12 @@ export default class index extends Component {
|
|||||||
}
|
}
|
||||||
const { getData } = this.props;
|
const { getData } = this.props;
|
||||||
const items = await getData({ page: current, limit: this.pageSize });
|
const items = await getData({ page: current, limit: this.pageSize });
|
||||||
const newDatas = [...allData, ...items];
|
const newData = [...allData, ...items];
|
||||||
const isFinish = items.length < this.pageSize || newDatas.length >= counts;
|
const isFinish = items.length < this.pageSize || newData.length >= counts;
|
||||||
if (isFinish) {
|
if (isFinish) {
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
allData: newDatas,
|
allData: newData,
|
||||||
percent: 100,
|
percent: 100,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
@ -280,7 +280,7 @@ export default class index extends Component {
|
|||||||
} else {
|
} else {
|
||||||
let percent = 0;
|
let percent = 0;
|
||||||
if (counts) {
|
if (counts) {
|
||||||
percent = Math.floor((newDatas.length / counts) * 100);
|
percent = Math.floor((newData.length / counts) * 100);
|
||||||
} else {
|
} else {
|
||||||
percent = current * 10;
|
percent = current * 10;
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ export default class index extends Component {
|
|||||||
}
|
}
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
allData: newDatas,
|
allData: newData,
|
||||||
current: current + 1,
|
current: current + 1,
|
||||||
percent,
|
percent,
|
||||||
},
|
},
|
||||||
@ -363,8 +363,8 @@ export default class index extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { total, datas } = this.props;
|
const { total, data } = this.props;
|
||||||
if (total === datas.length) {
|
if (total === data.length) {
|
||||||
return this.renderDownloadCurrent();
|
return this.renderDownloadCurrent();
|
||||||
}
|
}
|
||||||
return this.renderDownloadAll();
|
return this.renderDownloadAll();
|
||||||
|
@ -781,7 +781,7 @@ export default class BaseTable extends React.Component {
|
|||||||
renderDownload() {
|
renderDownload() {
|
||||||
const {
|
const {
|
||||||
pagination,
|
pagination,
|
||||||
data: datas,
|
data,
|
||||||
columns,
|
columns,
|
||||||
resourceName,
|
resourceName,
|
||||||
getDownloadData,
|
getDownloadData,
|
||||||
@ -795,7 +795,7 @@ export default class BaseTable extends React.Component {
|
|||||||
const { total } = pagination;
|
const { total } = pagination;
|
||||||
const downloadColumns = this.filterDownloadColumns(columns);
|
const downloadColumns = this.filterDownloadColumns(columns);
|
||||||
const props = {
|
const props = {
|
||||||
datas,
|
data,
|
||||||
columns: downloadColumns,
|
columns: downloadColumns,
|
||||||
total,
|
total,
|
||||||
getValueRenderFunc,
|
getValueRenderFunc,
|
||||||
|
@ -31,7 +31,7 @@ import styles from './index.less';
|
|||||||
|
|
||||||
export default class SimpleTable extends React.Component {
|
export default class SimpleTable extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
datas: PropTypes.array.isRequired,
|
data: PropTypes.array.isRequired,
|
||||||
filters: PropTypes.object,
|
filters: PropTypes.object,
|
||||||
searchFilters: PropTypes.array,
|
searchFilters: PropTypes.array,
|
||||||
columns: PropTypes.array.isRequired,
|
columns: PropTypes.array.isRequired,
|
||||||
@ -213,11 +213,11 @@ export default class SimpleTable extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getDataSource = () => {
|
getDataSource = () => {
|
||||||
const { datas, filters, filterByBackend } = this.props;
|
const { data, filters, filterByBackend } = this.props;
|
||||||
if (filterByBackend) {
|
if (filterByBackend) {
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
const tmpDatas = datas.map((it) => {
|
const tmpData = data.map((it) => {
|
||||||
if (it.key) {
|
if (it.key) {
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
@ -227,9 +227,9 @@ export default class SimpleTable extends React.Component {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (!filters || isEmpty(filters)) {
|
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) => {
|
onRow = (record, index) => {
|
||||||
|
@ -815,16 +815,16 @@ export default class BaseList extends React.Component {
|
|||||||
const { timeFilter = {} } = this.state;
|
const { timeFilter = {} } = this.state;
|
||||||
const { id, tab, ...rest } = filters;
|
const { id, tab, ...rest } = filters;
|
||||||
const newFilters = rest;
|
const newFilters = rest;
|
||||||
let datas = [];
|
let items = [];
|
||||||
if (this.isFilterByBackend) {
|
if (this.isFilterByBackend) {
|
||||||
datas = toJS(data);
|
items = toJS(data);
|
||||||
} else {
|
} else {
|
||||||
datas = (toJS(data) || []).filter((it) =>
|
items = (toJS(data) || []).filter((it) =>
|
||||||
this.filterData(it, toJS(newFilters), toJS(timeFilter))
|
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)
|
this.itemInTransitionFunction(item)
|
||||||
);
|
);
|
||||||
if (hasTransData) {
|
if (hasTransData) {
|
||||||
@ -832,9 +832,9 @@ export default class BaseList extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
this.setRefreshdataTimerAuto();
|
this.setRefreshdataTimerAuto();
|
||||||
}
|
}
|
||||||
this.updateHintsByDatas(datas);
|
this.updateHintsByData(items);
|
||||||
this.setTableHeight();
|
this.setTableHeight();
|
||||||
return datas;
|
return items;
|
||||||
};
|
};
|
||||||
|
|
||||||
getFilters = () => {
|
getFilters = () => {
|
||||||
@ -999,7 +999,7 @@ export default class BaseList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateHintsByDatas(datas) {}
|
updateHintsByData(data) {}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.store = { list: {} };
|
this.store = { list: {} };
|
||||||
|
@ -122,7 +122,7 @@ class Right extends Component {
|
|||||||
if (hasError) {
|
if (hasError) {
|
||||||
return (
|
return (
|
||||||
<NotFound
|
<NotFound
|
||||||
title={t('datas')}
|
title={t('data')}
|
||||||
link={this.getUrl('/base/overview')}
|
link={this.getUrl('/base/overview')}
|
||||||
codeError
|
codeError
|
||||||
/>
|
/>
|
||||||
@ -133,7 +133,7 @@ class Right extends Component {
|
|||||||
// if (currentRoutes.length === 0) {
|
// if (currentRoutes.length === 0) {
|
||||||
// return (
|
// return (
|
||||||
// <NotFound
|
// <NotFound
|
||||||
// title={t('datas')}
|
// title={t('data')}
|
||||||
// link={this.getUrl('/base/overview')}
|
// link={this.getUrl('/base/overview')}
|
||||||
// />
|
// />
|
||||||
// );
|
// );
|
||||||
@ -149,7 +149,7 @@ class Right extends Component {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
return (
|
return (
|
||||||
<NotFound
|
<NotFound
|
||||||
title={t('datas')}
|
title={t('data')}
|
||||||
link={this.getUrl('/base/overview')}
|
link={this.getUrl('/base/overview')}
|
||||||
codeError
|
codeError
|
||||||
/>
|
/>
|
||||||
|
@ -1826,7 +1826,7 @@
|
|||||||
"create vpn ike policy": "create vpn ike policy",
|
"create vpn ike policy": "create vpn ike policy",
|
||||||
"create vpn ipsec policy": "create vpn ipsec policy",
|
"create vpn ipsec policy": "create vpn ipsec policy",
|
||||||
"create vpn tunnel": "create vpn tunnel",
|
"create vpn tunnel": "create vpn tunnel",
|
||||||
"datas": "datas",
|
"data": "data",
|
||||||
"delete": "delete",
|
"delete": "delete",
|
||||||
"delete DNAT rule": "delete DNAT rule",
|
"delete DNAT rule": "delete DNAT rule",
|
||||||
"delete SNAT rule": "delete SNAT rule",
|
"delete SNAT rule": "delete SNAT rule",
|
||||||
@ -1916,7 +1916,6 @@
|
|||||||
"message": "message",
|
"message": "message",
|
||||||
"message.reason": "message.reason",
|
"message.reason": "message.reason",
|
||||||
"metadata": "metadata",
|
"metadata": "metadata",
|
||||||
"metadatas": "metadatas",
|
|
||||||
"migrate": "migrate",
|
"migrate": "migrate",
|
||||||
"modify project tags": "modify project tags",
|
"modify project tags": "modify project tags",
|
||||||
"network": "network",
|
"network": "network",
|
||||||
|
@ -1826,7 +1826,7 @@
|
|||||||
"create vpn ike policy": "创建VPN IKE策略",
|
"create vpn ike policy": "创建VPN IKE策略",
|
||||||
"create vpn ipsec policy": "创建VPN IPsec策略",
|
"create vpn ipsec policy": "创建VPN IPsec策略",
|
||||||
"create vpn tunnel": "创建VPN隧道",
|
"create vpn tunnel": "创建VPN隧道",
|
||||||
"datas": "数据",
|
"data": "数据",
|
||||||
"delete": "删除",
|
"delete": "删除",
|
||||||
"delete DNAT rule": "删除DNAT规则",
|
"delete DNAT rule": "删除DNAT规则",
|
||||||
"delete SNAT rule": "删除SNAT规则",
|
"delete SNAT rule": "删除SNAT规则",
|
||||||
@ -1916,7 +1916,6 @@
|
|||||||
"message": "",
|
"message": "",
|
||||||
"message.reason": "",
|
"message.reason": "",
|
||||||
"metadata": "元数据",
|
"metadata": "元数据",
|
||||||
"metadatas": "元数据",
|
|
||||||
"migrate": "迁移",
|
"migrate": "迁移",
|
||||||
"modify project tags": "修改项目标签",
|
"modify project tags": "修改项目标签",
|
||||||
"network": "网络",
|
"network": "网络",
|
||||||
|
@ -141,7 +141,7 @@ export default class BaseDetail extends Base {
|
|||||||
|
|
||||||
get validateCard() {
|
get validateCard() {
|
||||||
const { validate = {} } = this.detailData || {};
|
const { validate = {} } = this.detailData || {};
|
||||||
const datas = Object.keys(validate).map((key) => ({
|
const data = Object.keys(validate).map((key) => ({
|
||||||
value: this.detailData[`${key}_interface`],
|
value: this.detailData[`${key}_interface`],
|
||||||
name: key,
|
name: key,
|
||||||
...validate[key],
|
...validate[key],
|
||||||
@ -166,7 +166,7 @@ export default class BaseDetail extends Base {
|
|||||||
width: 300,
|
width: 300,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const content = <SimpleTable columns={columns} datas={datas} />;
|
const content = <SimpleTable columns={columns} data={data} />;
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
label: '',
|
label: '',
|
||||||
|
@ -30,8 +30,8 @@ export default class NodeInfo extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get kernelImages() {
|
get kernelImages() {
|
||||||
const datas = this.imageStore.list.data || [];
|
const data = this.imageStore.list.data || [];
|
||||||
return datas
|
return data
|
||||||
.filter((it) => it.disk_format === 'aki')
|
.filter((it) => it.disk_format === 'aki')
|
||||||
.map((it) => ({
|
.map((it) => ({
|
||||||
value: it.id,
|
value: it.id,
|
||||||
@ -40,8 +40,8 @@ export default class NodeInfo extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get ramdiskImages() {
|
get ramdiskImages() {
|
||||||
const datas = this.imageStore.list.data || [];
|
const data = this.imageStore.list.data || [];
|
||||||
return datas
|
return data
|
||||||
.filter((it) => it.disk_format === 'ari')
|
.filter((it) => it.disk_format === 'ari')
|
||||||
.map((it) => ({
|
.map((it) => ({
|
||||||
value: it.id,
|
value: it.id,
|
||||||
|
@ -95,7 +95,7 @@ export default class ManageAccess extends ModalAction {
|
|||||||
isMulti: true,
|
isMulti: true,
|
||||||
required: true,
|
required: true,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -29,7 +29,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
init() {
|
init() {
|
||||||
this.store = globalFlavorStore;
|
this.store = globalFlavorStore;
|
||||||
this.metadataStore = new MetadataStore();
|
this.metadataStore = new MetadataStore();
|
||||||
this.getMetadatas();
|
this.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
@ -59,7 +59,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
static allowed = () => Promise.resolve(true);
|
static allowed = () => Promise.resolve(true);
|
||||||
|
|
||||||
async getMetadatas() {
|
async getMetadata() {
|
||||||
const resouceType = 'OS::Nova::Flavor';
|
const resouceType = 'OS::Nova::Flavor';
|
||||||
await this.metadataStore.fetchList({
|
await this.metadataStore.fetchList({
|
||||||
manage: true,
|
manage: true,
|
||||||
@ -68,12 +68,12 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
this.updateDefaultValue();
|
this.updateDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
get metadatas() {
|
get metadata() {
|
||||||
return this.metadataStore.list.data || [];
|
return this.metadataStore.list.data || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
checkKeyInSystem = (key) => {
|
checkKeyInSystem = (key) => {
|
||||||
const metadata = this.metadatas.find((it) => {
|
const metadata = this.metadata.find((it) => {
|
||||||
const { detail: { properties = {} } = {} } = it;
|
const { detail: { properties = {} } = {} } = it;
|
||||||
return Object.keys(properties).indexOf(key) >= 0;
|
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 || {};
|
return isEmpty(originData) ? extra_specs : originData.extra_specs || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
parseExistMetadatas() {
|
parseExistMetadata() {
|
||||||
const customs = [];
|
const customs = [];
|
||||||
const systems = {};
|
const systems = {};
|
||||||
if (this.metadatas.length > 0) {
|
if (this.metadata.length > 0) {
|
||||||
const metadata = this.getItemMetadata();
|
const metadata = this.getItemMetadata();
|
||||||
Object.keys(metadata).forEach((key) => {
|
Object.keys(metadata).forEach((key) => {
|
||||||
if (this.checkKeyInSystem(key)) {
|
if (this.checkKeyInSystem(key)) {
|
||||||
@ -109,7 +109,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
get defaultValue() {
|
get defaultValue() {
|
||||||
const { name } = this.item;
|
const { name } = this.item;
|
||||||
const { customs, systems } = this.parseExistMetadatas();
|
const { customs, systems } = this.parseExistMetadata();
|
||||||
const value = {
|
const value = {
|
||||||
name,
|
name,
|
||||||
customs,
|
customs,
|
||||||
@ -160,7 +160,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
name: 'systems',
|
name: 'systems',
|
||||||
label: t('Metadata'),
|
label: t('Metadata'),
|
||||||
type: 'metadata-transfer',
|
type: 'metadata-transfer',
|
||||||
metadatas: this.metadatas,
|
metadata: this.metadata,
|
||||||
validator: (rule, value) => {
|
validator: (rule, value) => {
|
||||||
if (this.hasNoValue(value)) {
|
if (this.hasNoValue(value)) {
|
||||||
// eslint-disable-next-line prefer-promise-reject-errors
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
@ -174,7 +174,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
const { customs: oldCumtoms, systems: oldSystems } =
|
const { customs: oldCumtoms, systems: oldSystems } =
|
||||||
this.parseExistMetadatas();
|
this.parseExistMetadata();
|
||||||
const { customs, systems } = values;
|
const { customs, systems } = values;
|
||||||
const adds = [];
|
const adds = [];
|
||||||
const removes = [];
|
const removes = [];
|
||||||
|
@ -71,7 +71,7 @@ export default class AccessTypeSetting extends Base {
|
|||||||
isMulti: true,
|
isMulti: true,
|
||||||
hidden: !showChoose,
|
hidden: !showChoose,
|
||||||
required: showChoose,
|
required: showChoose,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
|
@ -90,7 +90,7 @@ export default class ManageHost extends ModalAction {
|
|||||||
label: t('Hosts'),
|
label: t('Hosts'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
datas: this.computeHosts,
|
data: this.computeHosts,
|
||||||
isLoading: globalComputeHostStore.list.isLoading,
|
isLoading: globalComputeHostStore.list.isLoading,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
init() {
|
init() {
|
||||||
this.store = new AggregateStore();
|
this.store = new AggregateStore();
|
||||||
this.metadataStore = new MetadataStore();
|
this.metadataStore = new MetadataStore();
|
||||||
this.getMetadatas();
|
this.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
@ -55,7 +55,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
static allowed = () => Promise.resolve(true);
|
static allowed = () => Promise.resolve(true);
|
||||||
|
|
||||||
async getMetadatas() {
|
async getMetadata() {
|
||||||
const resouceType = 'OS::Nova::Aggregate';
|
const resouceType = 'OS::Nova::Aggregate';
|
||||||
await this.metadataStore.fetchList({
|
await this.metadataStore.fetchList({
|
||||||
manage: true,
|
manage: true,
|
||||||
@ -64,22 +64,22 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
this.updateDefaultValue();
|
this.updateDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
get metadatas() {
|
get metadata() {
|
||||||
return this.metadataStore.list.data || [];
|
return this.metadataStore.list.data || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
checkKeyInSystem = (key) => {
|
checkKeyInSystem = (key) => {
|
||||||
const metadata = this.metadatas.find((it) => {
|
const metadata = this.metadata.find((it) => {
|
||||||
const { detail: { properties = {} } = {} } = it;
|
const { detail: { properties = {} } = {} } = it;
|
||||||
return Object.keys(properties).indexOf(key) >= 0;
|
return Object.keys(properties).indexOf(key) >= 0;
|
||||||
});
|
});
|
||||||
return !!metadata;
|
return !!metadata;
|
||||||
};
|
};
|
||||||
|
|
||||||
parseExistMetadatas() {
|
parseExistMetadata() {
|
||||||
const customs = [];
|
const customs = [];
|
||||||
const systems = {};
|
const systems = {};
|
||||||
if (this.metadatas.length > 0) {
|
if (this.metadata.length > 0) {
|
||||||
const { metadata } = this.item;
|
const { metadata } = this.item;
|
||||||
Object.keys(metadata).forEach((key) => {
|
Object.keys(metadata).forEach((key) => {
|
||||||
if (this.checkKeyInSystem(key)) {
|
if (this.checkKeyInSystem(key)) {
|
||||||
@ -100,7 +100,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
get defaultValue() {
|
get defaultValue() {
|
||||||
const { name } = this.item;
|
const { name } = this.item;
|
||||||
const { customs, systems } = this.parseExistMetadatas();
|
const { customs, systems } = this.parseExistMetadata();
|
||||||
const value = {
|
const value = {
|
||||||
name,
|
name,
|
||||||
customs,
|
customs,
|
||||||
@ -151,7 +151,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
name: 'systems',
|
name: 'systems',
|
||||||
label: t('Metadata'),
|
label: t('Metadata'),
|
||||||
type: 'metadata-transfer',
|
type: 'metadata-transfer',
|
||||||
metadatas: this.metadatas,
|
metadata: this.metadata,
|
||||||
validator: (rule, value) => {
|
validator: (rule, value) => {
|
||||||
if (this.hasNoValue(value)) {
|
if (this.hasNoValue(value)) {
|
||||||
// eslint-disable-next-line prefer-promise-reject-errors
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
@ -166,15 +166,15 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
const { customs, systems } = values;
|
const { customs, systems } = values;
|
||||||
const { id, metadata: oldMetadata } = this.item;
|
const { id, metadata: oldMetadata } = this.item;
|
||||||
const metadatas = { ...systems };
|
const metadata = { ...systems };
|
||||||
customs.forEach((it) => {
|
customs.forEach((it) => {
|
||||||
metadatas[it.value.key] = it.value.value;
|
metadata[it.value.key] = it.value.value;
|
||||||
});
|
});
|
||||||
Object.keys(oldMetadata).forEach((key) => {
|
Object.keys(oldMetadata).forEach((key) => {
|
||||||
if (!has(metadatas, key)) {
|
if (!has(metadata, key)) {
|
||||||
metadatas[key] = null;
|
metadata[key] = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return this.store.manageMetadata({ id, metadatas });
|
return this.store.manageMetadata({ id, metadata });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ export class CreateForm extends FormAction {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: this.isAdminPage,
|
required: this.isAdminPage,
|
||||||
hidden: !this.isAdminPage,
|
hidden: !this.isAdminPage,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
@ -240,7 +240,7 @@ export class CreateForm extends FormAction {
|
|||||||
required: isShare,
|
required: isShare,
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
hidden: !isShare,
|
hidden: !isShare,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,7 @@ export default class ManageAccess extends ModalAction {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
|
@ -30,7 +30,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
init() {
|
init() {
|
||||||
this.store = globalImageStore;
|
this.store = globalImageStore;
|
||||||
this.metadataStore = new MetadataStore();
|
this.metadataStore = new MetadataStore();
|
||||||
this.getMetadatas();
|
this.getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
@ -59,7 +59,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
return Promise.resolve(isOwner(item) || isAdminPage);
|
return Promise.resolve(isOwner(item) || isAdminPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
async getMetadatas() {
|
async getMetadata() {
|
||||||
const resouceType = 'OS::Glance::Image';
|
const resouceType = 'OS::Glance::Image';
|
||||||
await this.metadataStore.fetchList({
|
await this.metadataStore.fetchList({
|
||||||
manage: true,
|
manage: true,
|
||||||
@ -68,7 +68,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
this.updateDefaultValue();
|
this.updateDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
get metadatas() {
|
get metadata() {
|
||||||
return this.metadataStore.list.data || [];
|
return this.metadataStore.list.data || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,17 +101,17 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkKeyInSystem = (key) => {
|
checkKeyInSystem = (key) => {
|
||||||
const metadata = this.metadatas.find((it) => {
|
const item = this.metadata.find((it) => {
|
||||||
const { detail: { properties = {} } = {} } = it;
|
const { detail: { properties = {} } = {} } = it;
|
||||||
return Object.keys(properties).indexOf(key) >= 0;
|
return Object.keys(properties).indexOf(key) >= 0;
|
||||||
});
|
});
|
||||||
return !!metadata;
|
return !!item;
|
||||||
};
|
};
|
||||||
|
|
||||||
parseExistMetadatas() {
|
parseExistMetadata() {
|
||||||
const customs = [];
|
const customs = [];
|
||||||
const systems = {};
|
const systems = {};
|
||||||
if (this.metadatas.length > 0) {
|
if (this.metadata.length > 0) {
|
||||||
const metadata = this.getItemMetadata();
|
const metadata = this.getItemMetadata();
|
||||||
Object.keys(metadata).forEach((key) => {
|
Object.keys(metadata).forEach((key) => {
|
||||||
if (this.checkKeyInSystem(key)) {
|
if (this.checkKeyInSystem(key)) {
|
||||||
@ -132,7 +132,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
get defaultValue() {
|
get defaultValue() {
|
||||||
const { name } = this.item;
|
const { name } = this.item;
|
||||||
const { customs, systems } = this.parseExistMetadatas();
|
const { customs, systems } = this.parseExistMetadata();
|
||||||
const value = {
|
const value = {
|
||||||
name,
|
name,
|
||||||
customs,
|
customs,
|
||||||
@ -183,7 +183,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
name: 'systems',
|
name: 'systems',
|
||||||
label: t('Metadata'),
|
label: t('Metadata'),
|
||||||
type: 'metadata-transfer',
|
type: 'metadata-transfer',
|
||||||
metadatas: this.metadatas,
|
metadata: this.metadata,
|
||||||
validator: (rule, value) => {
|
validator: (rule, value) => {
|
||||||
if (this.hasNoValue(value)) {
|
if (this.hasNoValue(value)) {
|
||||||
// eslint-disable-next-line prefer-promise-reject-errors
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
@ -197,7 +197,7 @@ export default class ManageMetadata extends ModalAction {
|
|||||||
|
|
||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
const { customs: oldCumtoms, systems: oldSystems } =
|
const { customs: oldCumtoms, systems: oldSystems } =
|
||||||
this.parseExistMetadatas();
|
this.parseExistMetadata();
|
||||||
const { customs, systems } = values;
|
const { customs, systems } = values;
|
||||||
const adds = [];
|
const adds = [];
|
||||||
const removes = [];
|
const removes = [];
|
||||||
|
@ -120,7 +120,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Instance IP'),
|
label: t('Instance IP'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.ports,
|
data: this.ports,
|
||||||
isLoading: portLoading,
|
isLoading: portLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
@ -155,7 +155,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Floating Ip Address'),
|
label: t('Floating Ip Address'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: canAssociateFloatingIPs,
|
data: canAssociateFloatingIPs,
|
||||||
isLoading: fipLoading,
|
isLoading: fipLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -175,7 +175,7 @@ export default class AttachInterface extends ModalAction {
|
|||||||
label: t('Subnet'),
|
label: t('Subnet'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: isManua,
|
required: isManua,
|
||||||
datas: this.subnets,
|
data: this.subnets,
|
||||||
isLoading: this.subnetStore.list.isLoading,
|
isLoading: this.subnetStore.list.isLoading,
|
||||||
hidden: !isManua,
|
hidden: !isManua,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
|
@ -72,10 +72,10 @@ export class BaseStep extends Base {
|
|||||||
get images() {
|
get images() {
|
||||||
const { imageTab } = this.state;
|
const { imageTab } = this.state;
|
||||||
const { image } = this.locationParams;
|
const { image } = this.locationParams;
|
||||||
const datas = image
|
const data = image
|
||||||
? [toJS(this.imageStore.detail)]
|
? [toJS(this.imageStore.detail)]
|
||||||
: this.imageStore.list.data || [];
|
: this.imageStore.list.data || [];
|
||||||
const images = datas.filter((it) => {
|
const images = data.filter((it) => {
|
||||||
if (!canImageCreateIronicInstance(it)) {
|
if (!canImageCreateIronicInstance(it)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ export class BaseStep extends Base {
|
|||||||
name: 'image',
|
name: 'image',
|
||||||
label: t('Operating System'),
|
label: t('Operating System'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.images,
|
data: this.images,
|
||||||
isLoading: imageLoading,
|
isLoading: imageLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -95,7 +95,7 @@ export class SystemStep extends Base {
|
|||||||
name: 'keypair',
|
name: 'keypair',
|
||||||
label: t('Keypair'),
|
label: t('Keypair'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.keypairs,
|
data: this.keypairs,
|
||||||
isLoading: this.keyPairStore.list.isLoading,
|
isLoading: this.keyPairStore.list.isLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
required: !isPassword,
|
required: !isPassword,
|
||||||
|
@ -99,7 +99,7 @@ export default class DetachInterface extends ModalAction {
|
|||||||
label: t('Network Interface'),
|
label: t('Network Interface'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.ports,
|
data: this.ports,
|
||||||
isLoading: portLoading,
|
isLoading: portLoading,
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -95,7 +95,7 @@ export class DetachIsoVolume extends ModalAction {
|
|||||||
label: t('Volume'),
|
label: t('Volume'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.volumes,
|
data: this.volumes,
|
||||||
isLoading: this.volumeStore.list.isLoading,
|
isLoading: this.volumeStore.list.isLoading,
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -90,7 +90,7 @@ export class DetachVolume extends ModalAction {
|
|||||||
label: t('Volume'),
|
label: t('Volume'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.volumes,
|
data: this.volumes,
|
||||||
isLoading: this.volumeStore.list.isLoading,
|
isLoading: this.volumeStore.list.isLoading,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ export default class LiveMigrate extends ModalAction {
|
|||||||
name: 'host',
|
name: 'host',
|
||||||
label: t('Target Compute Host'),
|
label: t('Target Compute Host'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.hypervisors,
|
data: this.hypervisors,
|
||||||
isLoading:
|
isLoading:
|
||||||
this.hypervisorStore.list.isLoading &&
|
this.hypervisorStore.list.isLoading &&
|
||||||
globalComputeHostStore.list.isLoading,
|
globalComputeHostStore.list.isLoading,
|
||||||
|
@ -141,7 +141,7 @@ export default class ManageSecurityGroup extends ModalAction {
|
|||||||
label: t('Virtual Adapter'),
|
label: t('Virtual Adapter'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.ports,
|
data: this.ports,
|
||||||
isLoading:
|
isLoading:
|
||||||
this.portStore.list.isLoading && this.portStoreOrigin.list.isLoading,
|
this.portStore.list.isLoading && this.portStoreOrigin.list.isLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
|
@ -117,7 +117,7 @@ export default class LiveMigrate extends ModalAction {
|
|||||||
name: 'host',
|
name: 'host',
|
||||||
label: t('Target Compute Host'),
|
label: t('Target Compute Host'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.hypervisors,
|
data: this.hypervisors,
|
||||||
isLoading:
|
isLoading:
|
||||||
this.hypervisorStore.list.isLoading &&
|
this.hypervisorStore.list.isLoading &&
|
||||||
globalComputeHostStore.list.isLoading,
|
globalComputeHostStore.list.isLoading,
|
||||||
|
@ -141,7 +141,7 @@ export class Rebuild extends ModalAction {
|
|||||||
name: 'image',
|
name: 'image',
|
||||||
label: t('Operating System'),
|
label: t('Operating System'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.images,
|
data: this.images,
|
||||||
isLoading: this.imageStore.list.isLoading,
|
isLoading: this.imageStore.list.isLoading,
|
||||||
required: true,
|
required: true,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
|
@ -83,10 +83,10 @@ export class BaseStep extends Base {
|
|||||||
get images() {
|
get images() {
|
||||||
const { imageTab } = this.state;
|
const { imageTab } = this.state;
|
||||||
const { image } = this.locationParams;
|
const { image } = this.locationParams;
|
||||||
const datas = image
|
const data = image
|
||||||
? [toJS(this.imageStore.detail)]
|
? [toJS(this.imageStore.detail)]
|
||||||
: this.imageStore.list.data || [];
|
: this.imageStore.list.data || [];
|
||||||
const images = datas.filter((it) => {
|
const images = data.filter((it) => {
|
||||||
if (!canImageCreateInstance(it)) {
|
if (!canImageCreateInstance(it)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ export class BaseStep extends Base {
|
|||||||
name: 'image',
|
name: 'image',
|
||||||
label: t('Operating System'),
|
label: t('Operating System'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.images,
|
data: this.images,
|
||||||
isLoading: imageLoading,
|
isLoading: imageLoading,
|
||||||
required: this.sourceTypeIsImage,
|
required: this.sourceTypeIsImage,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
@ -391,7 +391,7 @@ export class BaseStep extends Base {
|
|||||||
name: 'bootableVolume',
|
name: 'bootableVolume',
|
||||||
label: t('Bootable Volume'),
|
label: t('Bootable Volume'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.volumes,
|
data: this.volumes,
|
||||||
isLoading: this.volumeStore.list.isLoading,
|
isLoading: this.volumeStore.list.isLoading,
|
||||||
required: this.sourceTypeIsVolume,
|
required: this.sourceTypeIsVolume,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
|
@ -213,7 +213,7 @@ export class SystemStep extends Base {
|
|||||||
name: 'keypair',
|
name: 'keypair',
|
||||||
label: t('Keypair'),
|
label: t('Keypair'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.keypairs,
|
data: this.keypairs,
|
||||||
isLoading: this.keyPairStore.list.isLoading,
|
isLoading: this.keyPairStore.list.isLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
required: !isPassword,
|
required: !isPassword,
|
||||||
@ -277,7 +277,7 @@ export class SystemStep extends Base {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
hidden: !this.hasAdminRole || !more || !isManually,
|
hidden: !this.hasAdminRole || !more || !isManually,
|
||||||
required: isManually,
|
required: isManually,
|
||||||
datas: this.hypervisors,
|
data: this.hypervisors,
|
||||||
isLoading: this.hypervisorStore.list.isLoading,
|
isLoading: this.hypervisorStore.list.isLoading,
|
||||||
extra: t(
|
extra: t(
|
||||||
'You can manually specify a physical node to create an instance.'
|
'You can manually specify a physical node to create an instance.'
|
||||||
@ -290,7 +290,7 @@ export class SystemStep extends Base {
|
|||||||
label: t('Server Group'),
|
label: t('Server Group'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
hidden: !more,
|
hidden: !more,
|
||||||
datas: this.serverGroups,
|
data: this.serverGroups,
|
||||||
isLoading: this.serverGroupStore.list.isLoading,
|
isLoading: this.serverGroupStore.list.isLoading,
|
||||||
extra: t(
|
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.'
|
'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.'
|
||||||
|
@ -334,7 +334,7 @@ export class FlavorSelectTable extends Component {
|
|||||||
this.settingStore.list.isLoading && this.flavorStore.list.isLoading;
|
this.settingStore.list.isLoading && this.flavorStore.list.isLoading;
|
||||||
const props = {
|
const props = {
|
||||||
columns: this.columns,
|
columns: this.columns,
|
||||||
datas: this.flavors,
|
data: this.flavors,
|
||||||
tableHeader: this.renderTableHeander(),
|
tableHeader: this.renderTableHeander(),
|
||||||
isLoading,
|
isLoading,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -113,7 +113,7 @@ export default class Manage extends ModalAction {
|
|||||||
name: 'associations',
|
name: 'associations',
|
||||||
label: t('Resource Types'),
|
label: t('Resource Types'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.resourceTypes,
|
data: this.resourceTypes,
|
||||||
isLoading: this.store.resourceTypeLoading,
|
isLoading: this.store.resourceTypeLoading,
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -31,7 +31,7 @@ export default class Metadata extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return t('metadatas');
|
return t('metadata');
|
||||||
}
|
}
|
||||||
|
|
||||||
get actionConfigs() {
|
get actionConfigs() {
|
||||||
|
@ -259,7 +259,7 @@ export class Associate extends ModalAction {
|
|||||||
label: t('Instance IP'),
|
label: t('Instance IP'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: instanceFixedIPs,
|
data: instanceFixedIPs,
|
||||||
isLoading: instanceLoading,
|
isLoading: instanceLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
@ -300,8 +300,8 @@ export class Associate extends ModalAction {
|
|||||||
label: t('Load Balancer'),
|
label: t('Load Balancer'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
// datas: this.instances,
|
// data: this.instances,
|
||||||
datas: [],
|
data: [],
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
{
|
{
|
||||||
|
@ -122,7 +122,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Fixed IP'),
|
label: t('Fixed IP'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.ports,
|
data: this.ports,
|
||||||
isLoading: portLoading,
|
isLoading: portLoading,
|
||||||
disabledFunc: (record) => !record.available,
|
disabledFunc: (record) => !record.available,
|
||||||
onChange: this.handleFixedIPChange,
|
onChange: this.handleFixedIPChange,
|
||||||
@ -153,7 +153,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Floating Ip Address'),
|
label: t('Floating Ip Address'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: canAssociateFloatingIPs,
|
data: canAssociateFloatingIPs,
|
||||||
isLoading: fipLoading,
|
isLoading: fipLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -33,16 +33,16 @@ export default class Subnets extends Base {
|
|||||||
const { data, filters = {}, timeFilter = {} } = this.list;
|
const { data, filters = {}, timeFilter = {} } = this.list;
|
||||||
const { id, tab, ...rest } = filters;
|
const { id, tab, ...rest } = filters;
|
||||||
const newFilters = rest;
|
const newFilters = rest;
|
||||||
let datas = [];
|
let items = [];
|
||||||
if (this.isFilterByBackend) {
|
if (this.isFilterByBackend) {
|
||||||
datas = toJS(data);
|
items = toJS(data);
|
||||||
} else {
|
} else {
|
||||||
datas = (toJS(data) || []).filter((it) =>
|
items = (toJS(data) || []).filter((it) =>
|
||||||
this.filterData(it, toJS(newFilters), toJS(timeFilter))
|
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)
|
this.itemInTransitionFunction(item)
|
||||||
);
|
);
|
||||||
if (hasTransData) {
|
if (hasTransData) {
|
||||||
@ -50,7 +50,7 @@ export default class Subnets extends Base {
|
|||||||
} else {
|
} else {
|
||||||
this.setRefreshdataTimerAuto();
|
this.setRefreshdataTimerAuto();
|
||||||
}
|
}
|
||||||
const ret = datas.map((item) => {
|
const ret = items.map((item) => {
|
||||||
const usageDetail = this.subnet_ip_availability.find(
|
const usageDetail = this.subnet_ip_availability.find(
|
||||||
(i) => i.subnet_id === item.id
|
(i) => i.subnet_id === item.id
|
||||||
);
|
);
|
||||||
|
@ -73,8 +73,8 @@ export default class Create extends ModalAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fips() {
|
get fips() {
|
||||||
const datas = toJS(this.fipStore.list.data) || [];
|
const data = toJS(this.fipStore.list.data) || [];
|
||||||
return datas.map((it) => ({
|
return data.map((it) => ({
|
||||||
label: it.ip,
|
label: it.ip,
|
||||||
value: it.ip,
|
value: it.ip,
|
||||||
}));
|
}));
|
||||||
@ -82,8 +82,8 @@ export default class Create extends ModalAction {
|
|||||||
|
|
||||||
get subnets() {
|
get subnets() {
|
||||||
// todo: filter subnets
|
// todo: filter subnets
|
||||||
const datas = toJS(this.networkStore.subnets) || [];
|
const data = toJS(this.networkStore.subnets) || [];
|
||||||
return datas.map((it) => ({
|
return data.map((it) => ({
|
||||||
label: `${it.name}<${it.cidr}>`,
|
label: `${it.name}<${it.cidr}>`,
|
||||||
value: JSON.stringify({
|
value: JSON.stringify({
|
||||||
deviceId: it.id,
|
deviceId: it.id,
|
||||||
|
@ -103,7 +103,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Floating IP'),
|
label: t('Floating IP'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.fipList,
|
data: this.fipList,
|
||||||
isLoading: this.floatingIpStore.list.isLoading,
|
isLoading: this.floatingIpStore.list.isLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -120,7 +120,7 @@ export default class ConnectSubnet extends ModalAction {
|
|||||||
name: 'subnet',
|
name: 'subnet',
|
||||||
label: t('Subnet'),
|
label: t('Subnet'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.subnets,
|
data: this.subnets,
|
||||||
isLoading: networkId && this.subnetStore.list.isLoading,
|
isLoading: networkId && this.subnetStore.list.isLoading,
|
||||||
disabledFunc: this.disabledFuncSubnet,
|
disabledFunc: this.disabledFuncSubnet,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -115,7 +115,7 @@ export class Create extends ModalAction {
|
|||||||
name: 'hints',
|
name: 'hints',
|
||||||
label: t('Availability Zone Hints'),
|
label: t('Availability Zone Hints'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.aZones,
|
data: this.aZones,
|
||||||
isLoading: globalNeutronStore.zoneLoading,
|
isLoading: globalNeutronStore.zoneLoading,
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -103,7 +103,7 @@ export default class DisconnectSubnet extends ModalAction {
|
|||||||
name: 'subnet',
|
name: 'subnet',
|
||||||
label: t('Subnet'),
|
label: t('Subnet'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: subnets,
|
data: subnets,
|
||||||
isLoading: subnetLoading,
|
isLoading: subnetLoading,
|
||||||
required: true,
|
required: true,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -158,7 +158,7 @@ export default class Create extends ModalAction {
|
|||||||
name: 'subnet_id',
|
name: 'subnet_id',
|
||||||
label: t('Subnet'),
|
label: t('Subnet'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: subnets,
|
data: subnets,
|
||||||
isLoading: subnetLoading,
|
isLoading: subnetLoading,
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
columns: [
|
columns: [
|
||||||
|
@ -119,7 +119,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Fixed IP'),
|
label: t('Fixed IP'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.ports,
|
data: this.ports,
|
||||||
isLoading: portLoading,
|
isLoading: portLoading,
|
||||||
disabledFunc: (record) => !record.available,
|
disabledFunc: (record) => !record.available,
|
||||||
onChange: this.handleFixedIPChange,
|
onChange: this.handleFixedIPChange,
|
||||||
@ -150,7 +150,7 @@ export default class AssociateFip extends ModalAction {
|
|||||||
label: t('Floating Ip Address'),
|
label: t('Floating Ip Address'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: canAssociateFloatingIPs,
|
data: canAssociateFloatingIPs,
|
||||||
isLoading: fipLoading,
|
isLoading: fipLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -265,7 +265,7 @@ export class CreateAction extends ModalAction {
|
|||||||
tips: t(
|
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.)'
|
'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,
|
isLoading: this.securityGroupStore.list.isLoading,
|
||||||
extraParams: { project_id: this.currentProjectId },
|
extraParams: { project_id: this.currentProjectId },
|
||||||
backendPageStore: this.securityGroupStore,
|
backendPageStore: this.securityGroupStore,
|
||||||
|
@ -69,7 +69,7 @@ export default class DisAssociateFip extends ModalAction {
|
|||||||
label: t('Floating IP'),
|
label: t('Floating IP'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: associatedDetail,
|
data: associatedDetail,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
tagKey: 'floating_ip_address',
|
tagKey: 'floating_ip_address',
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -358,7 +358,7 @@ export class Create extends FormAction {
|
|||||||
name: 'image',
|
name: 'image',
|
||||||
label: t('Operating System'),
|
label: t('Operating System'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
datas: this.images,
|
data: this.images,
|
||||||
isLoading: this.imageStore.list.isLoading,
|
isLoading: this.imageStore.list.isLoading,
|
||||||
required: this.sourceTypeIsImage,
|
required: this.sourceTypeIsImage,
|
||||||
isMulti: false,
|
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.'
|
'The volume type needs to set "multiattach" in the metadata to support shared volume attributes.'
|
||||||
),
|
),
|
||||||
...volumeTypeSelectProps,
|
...volumeTypeSelectProps,
|
||||||
datas: this.volumeTypes,
|
data: this.volumeTypes,
|
||||||
isLoading: this.volumeTypeStore.list.isLoading,
|
isLoading: this.volumeTypeStore.list.isLoading,
|
||||||
required: true,
|
required: true,
|
||||||
extra: this.getVolumeTypeExtra(),
|
extra: this.getVolumeTypeExtra(),
|
||||||
|
@ -79,7 +79,7 @@ export class Detach extends ModalAction {
|
|||||||
label: t('Instance'),
|
label: t('Instance'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: (this.item.attachments || []).map((s) => ({
|
data: (this.item.attachments || []).map((s) => ({
|
||||||
...s,
|
...s,
|
||||||
name: s.server_name,
|
name: s.server_name,
|
||||||
id: s.server_id,
|
id: s.server_id,
|
||||||
|
@ -88,7 +88,7 @@ export default class Migrate extends ModalAction {
|
|||||||
label: t('Target Storage Backend'),
|
label: t('Target Storage Backend'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: true,
|
required: true,
|
||||||
datas: this.pools,
|
data: this.pools,
|
||||||
isLoading: this.poolStore.list.isLoading,
|
isLoading: this.poolStore.list.isLoading,
|
||||||
disabledFunc: this.disableFunc,
|
disabledFunc: this.disableFunc,
|
||||||
rowKey: 'name',
|
rowKey: 'name',
|
||||||
|
@ -147,7 +147,7 @@ export default class Create extends ModalAction {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
hidden: isPublic,
|
hidden: isPublic,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
|
@ -112,7 +112,7 @@ export default class ManageAccess extends ModalAction {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
isMulti: true,
|
isMulti: true,
|
||||||
hidden: isPublic,
|
hidden: isPublic,
|
||||||
datas: this.projects,
|
data: this.projects,
|
||||||
isLoading: this.projectStore.list.isLoading,
|
isLoading: this.projectStore.list.isLoading,
|
||||||
...projectTableOptions,
|
...projectTableOptions,
|
||||||
},
|
},
|
||||||
|
@ -78,7 +78,7 @@ export default class ManageQos extends ModalAction {
|
|||||||
label: t('QoS'),
|
label: t('QoS'),
|
||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
required: false,
|
required: false,
|
||||||
datas: this.QosMap,
|
data: this.QosMap,
|
||||||
isLoading: this.store.list.isLoading,
|
isLoading: this.store.list.isLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -122,9 +122,9 @@ export function getPortFormItem(device_owner) {
|
|||||||
title: t('Fixed IPs'),
|
title: t('Fixed IPs'),
|
||||||
dataIndex: 'fixed_ips',
|
dataIndex: 'fixed_ips',
|
||||||
sorter: false,
|
sorter: false,
|
||||||
render: (datas) => (
|
render: (data) => (
|
||||||
<>
|
<>
|
||||||
{datas.map((d, idx) => (
|
{data.map((d, idx) => (
|
||||||
<div key={`ip_address_${idx}`}>{d.ip_address}</div>
|
<div key={`ip_address_${idx}`}>{d.ip_address}</div>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
@ -150,7 +150,7 @@ export function getPortFormItem(device_owner) {
|
|||||||
type: 'select-table',
|
type: 'select-table',
|
||||||
rowKey: 'fixed_ip_address',
|
rowKey: 'fixed_ip_address',
|
||||||
required: true,
|
required: true,
|
||||||
datas: portFixedIPs,
|
data: portFixedIPs,
|
||||||
isLoading: fixedIpLoading,
|
isLoading: fixedIpLoading,
|
||||||
isMulti: false,
|
isMulti: false,
|
||||||
filterParams: [
|
filterParams: [
|
||||||
|
@ -287,14 +287,14 @@ export default class BaseStore {
|
|||||||
async requestListAllByLimit(params, limit) {
|
async requestListAllByLimit(params, limit) {
|
||||||
let marker = '';
|
let marker = '';
|
||||||
let hasNext = true;
|
let hasNext = true;
|
||||||
let datas = [];
|
let data = [];
|
||||||
while (hasNext) {
|
while (hasNext) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const result = await this.requestListByMarker(params, limit, marker);
|
const result = await this.requestListByMarker(params, limit, marker);
|
||||||
const data = this.getListDataFromResult(result);
|
const items = this.getListDataFromResult(result);
|
||||||
datas = [...datas, ...data];
|
data = [...data, ...items];
|
||||||
if (data.length >= limit) {
|
if (data.length >= limit) {
|
||||||
marker = this.parseMarker(data, result, datas);
|
marker = this.parseMarker(items, result, data);
|
||||||
if (!marker) {
|
if (!marker) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('parse marker error!');
|
console.log('parse marker error!');
|
||||||
@ -304,7 +304,7 @@ export default class BaseStore {
|
|||||||
hasNext = false;
|
hasNext = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async requestListAll(params, originParams) {
|
async requestListAll(params, originParams) {
|
||||||
@ -313,16 +313,16 @@ export default class BaseStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async requestList(params, originParams) {
|
async requestList(params, originParams) {
|
||||||
const datas = !this.fetchListByLimit
|
const data = !this.fetchListByLimit
|
||||||
? await this.requestListAll(params, originParams)
|
? await this.requestListAll(params, originParams)
|
||||||
: await this.requestListAllByLimit(params, 100);
|
: await this.requestListAllByLimit(params, 100);
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
async requestListByPage(params, page, originParams) {
|
async requestListByPage(params, page, originParams) {
|
||||||
const datas = await this.listFetchByClient(params, originParams);
|
const data = await this.listFetchByClient(params, originParams);
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
@ -412,15 +412,13 @@ export default class BaseStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
parseMarker(datas, result, allDatas) {
|
parseMarker(data, result, allData) {
|
||||||
return datas.length === 0
|
return data.length === 0 ? '' : get(data[data.length - 1], this.markerKey);
|
||||||
? ''
|
|
||||||
: get(datas[datas.length - 1], this.markerKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
updateMarker(datas, page, result, allDatas) {
|
updateMarker(data, page, result, allData) {
|
||||||
const marker = this.parseMarker(datas, result, allDatas);
|
const marker = this.parseMarker(data, result, allData);
|
||||||
if (page === 1) {
|
if (page === 1) {
|
||||||
this.list.markers = [marker];
|
this.list.markers = [marker];
|
||||||
} else {
|
} else {
|
||||||
@ -438,7 +436,7 @@ export default class BaseStore {
|
|||||||
this.listResponseKey ? get(result, this.listResponseKey, []) : result;
|
this.listResponseKey ? get(result, this.listResponseKey, []) : result;
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
async getCountForPage(newParams, all_projects, newDatas) {
|
async getCountForPage(newParams, all_projects, newData) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ export class SnapshotStore extends Base {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const { id } = filters;
|
const { id } = filters;
|
||||||
const datas = id ? items.filter((it) => it.volume_id === id) : items;
|
const data = id ? items.filter((it) => it.volume_id === id) : items;
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async detailDidFetch(item) {
|
async detailDidFetch(item) {
|
||||||
|
@ -200,12 +200,12 @@ export class VolumeStore extends Base {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
async fetchVolumeTypes(params) {
|
async fetchVolumeTypes(params) {
|
||||||
const datas = await globalVolumeTypeStore.fetchList(params);
|
const data = await globalVolumeTypeStore.fetchList(params);
|
||||||
this.volumeTypes = datas.map((it) => ({
|
this.volumeTypes = data.map((it) => ({
|
||||||
label: it.name,
|
label: it.name,
|
||||||
value: it.id,
|
value: it.id,
|
||||||
}));
|
}));
|
||||||
this.originalvolumeTypes = datas || [];
|
this.originalvolumeTypes = data || [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ export class NetworkStore extends Base {
|
|||||||
if (!isFirewall) {
|
if (!isFirewall) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const datas = await this.listDidFetchFirewall(items);
|
const data = await this.listDidFetchFirewall(items);
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async listDidFetchFirewall(items) {
|
async listDidFetchFirewall(items) {
|
||||||
|
@ -133,8 +133,8 @@ export class RouterStore extends Base {
|
|||||||
if (!isFirewall) {
|
if (!isFirewall) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const datas = await this.listDidFetchFirewall(items);
|
const data = await this.listDidFetchFirewall(items);
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async listDidFetchFirewall(items) {
|
async listDidFetchFirewall(items) {
|
||||||
|
@ -46,10 +46,10 @@ export class AggregateStore extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
manageMetadata({ id, metadatas }) {
|
manageMetadata({ id, metadata }) {
|
||||||
const body = {
|
const body = {
|
||||||
set_metadata: {
|
set_metadata: {
|
||||||
metadata: metadatas,
|
metadata,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
return this.submitting(this.client.action(id, body));
|
return this.submitting(this.client.action(id, body));
|
||||||
|
@ -120,10 +120,10 @@ export class ServerStore extends Base {
|
|||||||
if (members && isServerGroup && members.length === 0) {
|
if (members && isServerGroup && members.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const datas = !this.fetchListByLimit
|
const data = !this.fetchListByLimit
|
||||||
? await this.requestListAll(params)
|
? await this.requestListAll(params)
|
||||||
: await this.requestListAllByLimit(params, 100);
|
: await this.requestListAllByLimit(params, 100);
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async listDidFetch(newData, allProjects, filters) {
|
async listDidFetch(newData, allProjects, filters) {
|
||||||
|
@ -29,8 +29,8 @@ export class ServerGroupStore extends Base {
|
|||||||
offset: marker,
|
offset: marker,
|
||||||
});
|
});
|
||||||
|
|
||||||
parseMarker(datas, result, allDatas) {
|
parseMarker(data, result, allData) {
|
||||||
return allDatas.length;
|
return allData.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,11 @@ export class AvailabilityZoneStore extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async listDidFetch(items) {
|
async listDidFetch(items) {
|
||||||
const datas = [];
|
const data = [];
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
const { hosts } = item;
|
const { hosts } = item;
|
||||||
if (isNull(hosts)) {
|
if (isNull(hosts)) {
|
||||||
datas.push(item);
|
data.push(item);
|
||||||
} else {
|
} else {
|
||||||
const newHost = {};
|
const newHost = {};
|
||||||
Object.keys(hosts).forEach((key) => {
|
Object.keys(hosts).forEach((key) => {
|
||||||
@ -53,21 +53,21 @@ export class AvailabilityZoneStore extends Base {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!isEmpty(newHost)) {
|
if (!isEmpty(newHost)) {
|
||||||
datas.push({
|
data.push({
|
||||||
...item,
|
...item,
|
||||||
host: newHost,
|
host: newHost,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return datas;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async fetchListWithoutDetail() {
|
async fetchListWithoutDetail() {
|
||||||
const result = await this.client.list();
|
const result = await this.client.list();
|
||||||
const datas = result[this.listResponseKey];
|
const data = result[this.listResponseKey];
|
||||||
this.list.data = datas.map(this.mapper);
|
this.list.data = data.map(this.mapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user