fix: Fix environment with no pfw
fix environment with no pfw Change-Id: I5f836eb028e5d2a3376575fad7e02545c5b513f7
This commit is contained in:
parent
5c3c89c78a
commit
8241ff8be7
@ -80,6 +80,10 @@ class NeutronClient extends Base {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'extensions',
|
||||||
|
responseKey: 'extensions',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'agents',
|
key: 'agents',
|
||||||
responseKey: 'agent',
|
responseKey: 'agent',
|
||||||
|
@ -22,6 +22,7 @@ import { PortStore } from 'stores/neutron/port';
|
|||||||
import { getPortFormItem, getPortsAndReasons } from 'resources/port';
|
import { getPortFormItem, getPortsAndReasons } from 'resources/port';
|
||||||
import { getInterfaceWithReason } from 'resources/floatingip';
|
import { getInterfaceWithReason } from 'resources/floatingip';
|
||||||
import globalPortForwardingStore from 'stores/neutron/port-forwarding';
|
import globalPortForwardingStore from 'stores/neutron/port-forwarding';
|
||||||
|
import { enablePFW } from 'resources/neutron';
|
||||||
|
|
||||||
@inject('rootStore')
|
@inject('rootStore')
|
||||||
@observer
|
@observer
|
||||||
@ -110,7 +111,9 @@ export default class CreateDNAT extends ModalAction {
|
|||||||
|
|
||||||
static policy = 'create_floatingip_port_forwarding';
|
static policy = 'create_floatingip_port_forwarding';
|
||||||
|
|
||||||
static allowed = (item) => Promise.resolve(isNull(item.fixed_ip_address));
|
static allowed = (item) => {
|
||||||
|
return Promise.resolve(isNull(item.fixed_ip_address) && enablePFW());
|
||||||
|
};
|
||||||
|
|
||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
const {
|
const {
|
||||||
|
@ -21,6 +21,7 @@ import { emptyActionConfig } from 'utils/constants';
|
|||||||
import { Col, Popover, Row } from 'antd';
|
import { Col, Popover, Row } from 'antd';
|
||||||
import { FileTextOutlined } from '@ant-design/icons';
|
import { FileTextOutlined } from '@ant-design/icons';
|
||||||
import { qosEndpoint } from 'client/client/constants';
|
import { qosEndpoint } from 'client/client/constants';
|
||||||
|
import { enablePFW } from 'resources/neutron';
|
||||||
import styles from './styles.less';
|
import styles from './styles.less';
|
||||||
import actionConfigs from './actions';
|
import actionConfigs from './actions';
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ export class FloatingIps extends Base {
|
|||||||
render: (resource_name, record) => {
|
render: (resource_name, record) => {
|
||||||
if (
|
if (
|
||||||
!resource_name &&
|
!resource_name &&
|
||||||
record.port_forwardings &&
|
enablePFW() &&
|
||||||
record.port_forwardings.length !== 0
|
record.port_forwardings.length !== 0
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
import globalRootStore from 'stores/root';
|
||||||
|
|
||||||
export const availabilityZoneState = {
|
export const availabilityZoneState = {
|
||||||
available: t('Available'),
|
available: t('Available'),
|
||||||
unavailable: t('Unavailable'),
|
unavailable: t('Unavailable'),
|
||||||
@ -21,3 +23,17 @@ export const availabilityZoneResource = {
|
|||||||
router: t('Router'),
|
router: t('Router'),
|
||||||
network: t('Network'),
|
network: t('Network'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function enablePFW() {
|
||||||
|
const { neutronExtensions: extensions } = globalRootStore;
|
||||||
|
let enabled = false;
|
||||||
|
let pfwInFip = false;
|
||||||
|
extensions.forEach((i) => {
|
||||||
|
if (i.alias === 'floating-ip-port-forwarding') {
|
||||||
|
enabled = true;
|
||||||
|
} else if (i.alias === 'expose-port-forwarding-in-fip') {
|
||||||
|
pfwInFip = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return enabled && pfwInFip;
|
||||||
|
}
|
||||||
|
@ -76,6 +76,9 @@ export class RootStore {
|
|||||||
@observable
|
@observable
|
||||||
enableBilling = false;
|
enableBilling = false;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
neutronExtensions = [];
|
||||||
|
|
||||||
// @observable
|
// @observable
|
||||||
// menu = renderMenu(i18n.t);
|
// menu = renderMenu(i18n.t);
|
||||||
|
|
||||||
@ -179,6 +182,17 @@ export class RootStore {
|
|||||||
this.client.policies.list(),
|
this.client.policies.list(),
|
||||||
]);
|
]);
|
||||||
this.updateUser(profile, policies.policies || []);
|
this.updateUser(profile, policies.policies || []);
|
||||||
|
this.getNeutronExtensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
async getNeutronExtensions() {
|
||||||
|
try {
|
||||||
|
const { extensions } = await client.neutron.extensions.list();
|
||||||
|
this.neutronExtensions = extensions;
|
||||||
|
} catch (error) {
|
||||||
|
this.neutronExtensions = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
Loading…
Reference in New Issue
Block a user