From 3776b5342ea7ad3d47398112626f8723ddb91fd4 Mon Sep 17 00:00:00 2001 From: Sowmya Nethi Date: Fri, 26 Sep 2025 18:37:43 +0530 Subject: [PATCH] feat: hide fip input based on policy, add description field to secgroup rule, show project description on the project switch page Change-Id: I6893392992f012470e64835f8ffede7c1846416a Signed-off-by: Sowmya Nethi --- .../Layout/GlobalHeader/ProjectTable.jsx | 4 ++++ .../containers/FloatingIp/actions/Allocate.jsx | 9 +++++++++ .../Detail/Rule/actions/Create.jsx | 17 +++++++++++------ src/resources/neutron/security-group-rule.jsx | 5 +++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/Layout/GlobalHeader/ProjectTable.jsx b/src/components/Layout/GlobalHeader/ProjectTable.jsx index 51d6a68e..1dc3fe51 100644 --- a/src/components/Layout/GlobalHeader/ProjectTable.jsx +++ b/src/components/Layout/GlobalHeader/ProjectTable.jsx @@ -135,6 +135,10 @@ export class ProjectSelect extends ModalAction { title: t('ID'), dataIndex: 'id', }, + { + title: t('Description'), + dataIndex: 'description', + }, { title: t('Enabled'), dataIndex: 'enabled', diff --git a/src/pages/network/containers/FloatingIp/actions/Allocate.jsx b/src/pages/network/containers/FloatingIp/actions/Allocate.jsx index f34ba1e4..720ada21 100644 --- a/src/pages/network/containers/FloatingIp/actions/Allocate.jsx +++ b/src/pages/network/containers/FloatingIp/actions/Allocate.jsx @@ -25,6 +25,7 @@ import { qosEndpoint } from 'client/client/constants'; import { projectTableOptions } from 'resources/keystone/project'; import { isAdminPage } from 'utils'; import { toJS } from 'mobx'; +import { checkPolicyRule } from 'resources/skyline/policy'; export class Allocate extends ModalAction { static id = 'allocate'; @@ -248,6 +249,13 @@ export class Allocate extends ModalAction { ); }; + canSpecifyFloatingIp() { + return ( + checkPolicyRule('create_floatingip') && + checkPolicyRule('create_floatingip:floating_ip_address') + ); + } + get formItems() { const { networks, @@ -325,6 +333,7 @@ export class Allocate extends ModalAction { name: 'floating_ip_address', label: t('Floating IP Address'), hidden: !selectedSubnet || batchAllocate, + display: this.canSpecifyFloatingIp(), type: 'ip-input', version: selectedSubnet && (selectedSubnet.ip_version || 4), }, diff --git a/src/pages/network/containers/SecurityGroup/Detail/Rule/actions/Create.jsx b/src/pages/network/containers/SecurityGroup/Detail/Rule/actions/Create.jsx index eeb5e091..ba01bf2d 100644 --- a/src/pages/network/containers/SecurityGroup/Detail/Rule/actions/Create.jsx +++ b/src/pages/network/containers/SecurityGroup/Detail/Rule/actions/Create.jsx @@ -261,16 +261,14 @@ export class Create extends ModalAction { }, { name: 'sourcePort', - label: + label: t('Port or Port Range'), + extra: direction === 'egress' - ? t('Destination Port/Port Range') - : t('Source Port/Port Range'), + ? t('Input destination port or port range (example: 80 or 80:160)') + : t('Input source port or port range (example: 80 or 80:160)'), type: 'port-range', required: showSourcePort, hidden: !showSourcePort, - extra: - direction === 'egress' && - t('Input destination port or port range (example: 80 or 80:160)'), }, { name: 'ipProtocol', @@ -302,6 +300,13 @@ export class Create extends ModalAction { hidden: !isCustomIcmp, help: t('Please input ICMP code(0-255)'), }, + { + name: 'description', + label: t('Description'), + type: 'textarea', + required: false, + placeholder: t('Description for this rule'), + }, { name: 'remoteType', label: t('Remote Type'), diff --git a/src/resources/neutron/security-group-rule.jsx b/src/resources/neutron/security-group-rule.jsx index a0868843..1e620aa5 100644 --- a/src/resources/neutron/security-group-rule.jsx +++ b/src/resources/neutron/security-group-rule.jsx @@ -77,6 +77,11 @@ export const getSelfColumns = (self) => [ dataIndex: 'port_range', isHideable: true, }, + { + title: t('Description'), + dataIndex: 'description', + isHideable: true, + }, { title: t('Remote IP Prefix'), dataIndex: 'remote_ip_prefix',