Merge "feat: add floating ip tab in qos policy detail page"
This commit is contained in:
commit
548f6c684d
@ -20,24 +20,26 @@ import Disassociate from './Disassociate';
|
|||||||
import Edit from './Edit';
|
import Edit from './Edit';
|
||||||
import CreateDNAT from './CreateDNAT';
|
import CreateDNAT from './CreateDNAT';
|
||||||
|
|
||||||
|
const rowActions = {
|
||||||
|
firstAction: Edit,
|
||||||
|
moreActions: [
|
||||||
|
{
|
||||||
|
action: Associate,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: Disassociate,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: CreateDNAT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: Release,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
const actionConfigs = {
|
const actionConfigs = {
|
||||||
rowActions: {
|
rowActions,
|
||||||
firstAction: Edit,
|
|
||||||
moreActions: [
|
|
||||||
{
|
|
||||||
action: Associate,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
action: Disassociate,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
action: CreateDNAT,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
action: Release,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
batchActions: [Release],
|
batchActions: [Release],
|
||||||
primaryActions: [Allocate],
|
primaryActions: [Allocate],
|
||||||
};
|
};
|
||||||
@ -58,9 +60,21 @@ const instanceDetailConfigs = {
|
|||||||
|
|
||||||
const instanceDetailAdminConfigs = emptyActionConfig;
|
const instanceDetailAdminConfigs = emptyActionConfig;
|
||||||
|
|
||||||
|
const qosDetailConfigs = {
|
||||||
|
rowActions,
|
||||||
|
};
|
||||||
|
|
||||||
|
const qosDetailAdminConfigs = {
|
||||||
|
rowActions: {
|
||||||
|
firstAction: Release,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
actionConfigs,
|
actionConfigs,
|
||||||
adminConfigs,
|
adminConfigs,
|
||||||
instanceDetailConfigs,
|
instanceDetailConfigs,
|
||||||
instanceDetailAdminConfigs,
|
instanceDetailAdminConfigs,
|
||||||
|
qosDetailConfigs,
|
||||||
|
qosDetailAdminConfigs,
|
||||||
};
|
};
|
||||||
|
@ -37,19 +37,34 @@ export class FloatingIps extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get isFilterByBackend() {
|
get isFilterByBackend() {
|
||||||
return true;
|
return !this.inQosDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isSortByBackend() {
|
get isSortByBackend() {
|
||||||
return true;
|
return !this.inQosDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
get defaultSortKey() {
|
get defaultSortKey() {
|
||||||
return 'status';
|
return 'status';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get inQosDetail() {
|
||||||
|
const { pathname } = this.props.location;
|
||||||
|
return this.inDetailPage && pathname.includes('qos');
|
||||||
|
}
|
||||||
|
|
||||||
|
get isRecycleBinDetail() {
|
||||||
|
const { pathname } = this.props.location;
|
||||||
|
return this.inDetailPage && pathname.includes('recycle-bin');
|
||||||
|
}
|
||||||
|
|
||||||
|
get inInstanceDetail() {
|
||||||
|
const { pathname } = this.props.location;
|
||||||
|
return this.inDetailPage && pathname.includes('instance');
|
||||||
|
}
|
||||||
|
|
||||||
async getData({ silent, ...params } = {}) {
|
async getData({ silent, ...params } = {}) {
|
||||||
if (this.inDetailPage) {
|
if (this.inDetailPage && !this.inQosDetail) {
|
||||||
silent && (this.list.silent = true);
|
silent && (this.list.silent = true);
|
||||||
const { detail: { addresses = [] } = {} } = this.props;
|
const { detail: { addresses = [] } = {} } = this.props;
|
||||||
const ips = [];
|
const ips = [];
|
||||||
@ -78,6 +93,18 @@ export class FloatingIps extends Base {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateFetchParams = (params) => {
|
||||||
|
if (this.inQosDetail) {
|
||||||
|
console.log('params', params);
|
||||||
|
const { id, ...rest } = params;
|
||||||
|
return {
|
||||||
|
qos_policy_id: id,
|
||||||
|
...rest,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
};
|
||||||
|
|
||||||
fetchDataByPage = async (params) => {
|
fetchDataByPage = async (params) => {
|
||||||
await this.store.fetchListWithResourceName(params);
|
await this.store.fetchListWithResourceName(params);
|
||||||
this.list.silent = false;
|
this.list.silent = false;
|
||||||
@ -91,20 +118,20 @@ export class FloatingIps extends Base {
|
|||||||
return t('floating ips');
|
return t('floating ips');
|
||||||
}
|
}
|
||||||
|
|
||||||
get isRecycleBinDetail() {
|
|
||||||
const { pathname } = this.props.location;
|
|
||||||
return pathname.indexOf('recycle-bin') >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
get actionConfigs() {
|
get actionConfigs() {
|
||||||
if (this.isRecycleBinDetail) {
|
if (this.isRecycleBinDetail) {
|
||||||
return emptyActionConfig;
|
return emptyActionConfig;
|
||||||
}
|
}
|
||||||
if (this.inDetailPage) {
|
if (this.inInstanceDetail) {
|
||||||
return this.isAdminPage
|
return this.isAdminPage
|
||||||
? actionConfigs.instanceDetailAdminConfigs
|
? actionConfigs.instanceDetailAdminConfigs
|
||||||
: actionConfigs.instanceDetailConfigs;
|
: actionConfigs.instanceDetailConfigs;
|
||||||
}
|
}
|
||||||
|
if (this.inQosDetail) {
|
||||||
|
return this.isAdminPage
|
||||||
|
? actionConfigs.qosDetailAdminConfigs
|
||||||
|
: actionConfigs.qosDetailConfigs;
|
||||||
|
}
|
||||||
return this.isAdminPage
|
return this.isAdminPage
|
||||||
? actionConfigs.adminConfigs
|
? actionConfigs.adminConfigs
|
||||||
: actionConfigs.actionConfigs;
|
: actionConfigs.actionConfigs;
|
||||||
@ -132,7 +159,7 @@ export class FloatingIps extends Base {
|
|||||||
isLink: true,
|
isLink: true,
|
||||||
routeName: this.getRouteName('networkQosDetail'),
|
routeName: this.getRouteName('networkQosDetail'),
|
||||||
idKey: 'qos_policy_id',
|
idKey: 'qos_policy_id',
|
||||||
hidden: !this.qosEndpoint,
|
hidden: !this.qosEndpoint || this.inQosDetail,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Project ID/Name'),
|
title: t('Project ID/Name'),
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import Base from 'containers/TabDetail';
|
import Base from 'containers/TabDetail';
|
||||||
import { QoSPolicyStore } from 'stores/neutron/qos-policy';
|
import { QoSPolicyStore } from 'stores/neutron/qos-policy';
|
||||||
|
import FloatingIp from 'pages/network/containers/FloatingIp';
|
||||||
import BaseDetail from './BaseDetail';
|
import BaseDetail from './BaseDetail';
|
||||||
import actionConfigs from '../actions';
|
import actionConfigs from '../actions';
|
||||||
|
|
||||||
@ -87,6 +88,11 @@ export default class QoSPolicyDetail extends Base {
|
|||||||
key: 'BaseDetail',
|
key: 'BaseDetail',
|
||||||
component: BaseDetail,
|
component: BaseDetail,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t('Floating IP'),
|
||||||
|
key: 'fip',
|
||||||
|
component: FloatingIp,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,14 @@ export class FloatingIpStore extends Base {
|
|||||||
externalNetworkName: '-',
|
externalNetworkName: '-',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async listDidFetch(items, allProjects, filters) {
|
||||||
|
const { qos_policy_id } = filters;
|
||||||
|
if (!qos_policy_id) {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
return items.filter((it) => it.qos_policy_id === qos_policy_id);
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async fetchListWithResourceName({
|
async fetchListWithResourceName({
|
||||||
limit,
|
limit,
|
||||||
|
Loading…
Reference in New Issue
Block a user