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