Loading modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/entity_form_template.ts +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import OPENSTACK_SNAPSHOT_TEMPLATE from 'constant/templates/form/openstack/snaps import OPENSTACK_VOLUME_TEMPLATE from 'constant/templates/form/openstack/volume'; import OPENSTACK_NETWORK_TEMPLATE from 'constant/templates/form/openstack/network'; import OPENSTACK_SUBNET_TEMPLATE from 'constant/templates/form/openstack/subnet'; import OPENSTACK_ROUTER_TEMPLATE from 'constant/templates/form/openstack/router'; import VMWARE_VM_TEMPLATE from 'constant/templates/form/vmware/vm'; const ENTITY_FORM_LIST = [ Loading Loading @@ -62,6 +63,7 @@ const ENTITY_FORM_LIST = [ ...OPENSTACK_VOLUME_TEMPLATE, ...OPENSTACK_NETWORK_TEMPLATE, ...OPENSTACK_SUBNET_TEMPLATE, ...OPENSTACK_ROUTER_TEMPLATE, ...OPENSTACK_CLOUD_LAUNCH_TEMPLATE, ...VMWARE_VM_TEMPLATE, ...AWS_CLOUD_LAUNCH_TEMPLATE, Loading modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/openstack/router.ts 0 → 100644 +30 −0 Original line number Diff line number Diff line import EntityFormTemplate from 'model/EntityFormTemplate'; const OPENSTACK_NETWORK_TEMPLATE: EntityFormTemplate[] = [ { cloudServiceProvider: 'openstack', entityName: 'router', actionType: 'create', entityRecords: [ { type: 'panel', panelName: 'Router', keyValueRecords: [ { type: 'default', labelName: 'Name', name: 'name', defaultValue: '', required: true }, { type: 'boolean', labelName: 'Admin state up', name: 'admin_state_up', defaultValue: true }, { type: 'select', labelName: 'External Network', name: 'external_gateway_network_id', url: '/cloud_dashboard/openstack/{cloud_context}/external_gateway_network_ids', defaultValue: '' }, { type: 'boolean', labelName: 'Enable SNAT', name: 'external_gateway_enable_snat', defaultValue: true }, { type: 'multi-select', labelName: 'Availability Zone', name: 'availability_zone', url: '/cloud_dashboard/openstack/{cloud_context}/availability_zones', defaultValue: [] }, ] } ] } ] export default OPENSTACK_NETWORK_TEMPLATE; modules/cloud_dashboard/cloud_dashboard/src/organisms/EntityFormPanel.tsx +11 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,17 @@ const showEntityFormBlockFlg = ( } } // Create Openstack Router if (actionType === 'create' && cloudServiceProvider === 'openstack' && entityName === 'router') { if (entityFormColumn.type === 'boolean') { if (entityFormColumn.name === 'external_gateway_enable_snat') { return formData['external_gateway_network_id'] !== ''; } } } return true; } Loading modules/cloud_service_providers/openstack/openstack.routing.yml +28 −0 Original line number Diff line number Diff line Loading @@ -1283,6 +1283,34 @@ entity.openstack_port.list_update.all: entity_type: 'openstack_port' # OpenStack router's routes. entity.openstack_router.create: path: '/cloud_dashboard/openstack/{cloud_context}/openstack_router/create' defaults: _controller: '\Drupal\openstack\Controller\ApiController::operateEntity' entity_type_id: openstack_router entity_id: '' command: create methods: [POST] requirements: # Use custom access that will check for cloud_context and the desired permission. # Desired permission is passed as an option in the "perm" variable _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'add openstack router' entity.openstack_router.external_gateway_network_ids: path: '/cloud_dashboard/openstack/{cloud_context}/external_gateway_network_ids' defaults: _controller: '\Drupal\openstack\Controller\ApiController::getNetworkOptions' properties: external: 1 requirements: # Use custom access that will check for cloud_context and the desired permission. # Desired permission is passed as an option in the "perm" variable _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'add openstack router' entity.openstack_router.add_form: path: '/clouds/openstack/{cloud_context}/router/add' defaults: Loading modules/cloud_service_providers/openstack/src/Controller/ApiController.php +11 −2 Original line number Diff line number Diff line Loading @@ -816,6 +816,16 @@ class ApiController extends ControllerBase implements ApiControllerInterface { $method_name = 'editOpenStackSubnet'; break; case 'create_openstack_router': /** @var \Drupal\openstack\Entity\OpenStackRouter $entity */ $entity->setName($request->get('name', '')); $entity->setAdminStateUp($request->get('admin_state_up', '') === 'true'); $entity->setExternalGatewayNetworkId($request->get('external_gateway_network_id', '')); $entity->setExternalGatewayEnableSnat($request->get('external_gateway_enable_snat', '') === 'true'); $entity->setAvailabilityZones(json_decode($request->get('availability_zone', '[]'), TRUE)); $method_name = 'createOpenStackRouter'; break; } // Execute the process. Loading Loading @@ -1260,8 +1270,7 @@ class ApiController extends ControllerBase implements ApiControllerInterface { /** * {@inheritdoc} */ public function getNetworkOptions($cloud_context): JsonResponse { $properties = []; public function getNetworkOptions(string $cloud_context, array $properties = []): JsonResponse { $properties['cloud_context'] = $cloud_context; $account = $this->currentUser; Loading Loading
modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/entity_form_template.ts +2 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import OPENSTACK_SNAPSHOT_TEMPLATE from 'constant/templates/form/openstack/snaps import OPENSTACK_VOLUME_TEMPLATE from 'constant/templates/form/openstack/volume'; import OPENSTACK_NETWORK_TEMPLATE from 'constant/templates/form/openstack/network'; import OPENSTACK_SUBNET_TEMPLATE from 'constant/templates/form/openstack/subnet'; import OPENSTACK_ROUTER_TEMPLATE from 'constant/templates/form/openstack/router'; import VMWARE_VM_TEMPLATE from 'constant/templates/form/vmware/vm'; const ENTITY_FORM_LIST = [ Loading Loading @@ -62,6 +63,7 @@ const ENTITY_FORM_LIST = [ ...OPENSTACK_VOLUME_TEMPLATE, ...OPENSTACK_NETWORK_TEMPLATE, ...OPENSTACK_SUBNET_TEMPLATE, ...OPENSTACK_ROUTER_TEMPLATE, ...OPENSTACK_CLOUD_LAUNCH_TEMPLATE, ...VMWARE_VM_TEMPLATE, ...AWS_CLOUD_LAUNCH_TEMPLATE, Loading
modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/openstack/router.ts 0 → 100644 +30 −0 Original line number Diff line number Diff line import EntityFormTemplate from 'model/EntityFormTemplate'; const OPENSTACK_NETWORK_TEMPLATE: EntityFormTemplate[] = [ { cloudServiceProvider: 'openstack', entityName: 'router', actionType: 'create', entityRecords: [ { type: 'panel', panelName: 'Router', keyValueRecords: [ { type: 'default', labelName: 'Name', name: 'name', defaultValue: '', required: true }, { type: 'boolean', labelName: 'Admin state up', name: 'admin_state_up', defaultValue: true }, { type: 'select', labelName: 'External Network', name: 'external_gateway_network_id', url: '/cloud_dashboard/openstack/{cloud_context}/external_gateway_network_ids', defaultValue: '' }, { type: 'boolean', labelName: 'Enable SNAT', name: 'external_gateway_enable_snat', defaultValue: true }, { type: 'multi-select', labelName: 'Availability Zone', name: 'availability_zone', url: '/cloud_dashboard/openstack/{cloud_context}/availability_zones', defaultValue: [] }, ] } ] } ] export default OPENSTACK_NETWORK_TEMPLATE;
modules/cloud_dashboard/cloud_dashboard/src/organisms/EntityFormPanel.tsx +11 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,17 @@ const showEntityFormBlockFlg = ( } } // Create Openstack Router if (actionType === 'create' && cloudServiceProvider === 'openstack' && entityName === 'router') { if (entityFormColumn.type === 'boolean') { if (entityFormColumn.name === 'external_gateway_enable_snat') { return formData['external_gateway_network_id'] !== ''; } } } return true; } Loading
modules/cloud_service_providers/openstack/openstack.routing.yml +28 −0 Original line number Diff line number Diff line Loading @@ -1283,6 +1283,34 @@ entity.openstack_port.list_update.all: entity_type: 'openstack_port' # OpenStack router's routes. entity.openstack_router.create: path: '/cloud_dashboard/openstack/{cloud_context}/openstack_router/create' defaults: _controller: '\Drupal\openstack\Controller\ApiController::operateEntity' entity_type_id: openstack_router entity_id: '' command: create methods: [POST] requirements: # Use custom access that will check for cloud_context and the desired permission. # Desired permission is passed as an option in the "perm" variable _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'add openstack router' entity.openstack_router.external_gateway_network_ids: path: '/cloud_dashboard/openstack/{cloud_context}/external_gateway_network_ids' defaults: _controller: '\Drupal\openstack\Controller\ApiController::getNetworkOptions' properties: external: 1 requirements: # Use custom access that will check for cloud_context and the desired permission. # Desired permission is passed as an option in the "perm" variable _custom_access: '\Drupal\cloud\Controller\CloudConfigController::access' options: perm: 'add openstack router' entity.openstack_router.add_form: path: '/clouds/openstack/{cloud_context}/router/add' defaults: Loading
modules/cloud_service_providers/openstack/src/Controller/ApiController.php +11 −2 Original line number Diff line number Diff line Loading @@ -816,6 +816,16 @@ class ApiController extends ControllerBase implements ApiControllerInterface { $method_name = 'editOpenStackSubnet'; break; case 'create_openstack_router': /** @var \Drupal\openstack\Entity\OpenStackRouter $entity */ $entity->setName($request->get('name', '')); $entity->setAdminStateUp($request->get('admin_state_up', '') === 'true'); $entity->setExternalGatewayNetworkId($request->get('external_gateway_network_id', '')); $entity->setExternalGatewayEnableSnat($request->get('external_gateway_enable_snat', '') === 'true'); $entity->setAvailabilityZones(json_decode($request->get('availability_zone', '[]'), TRUE)); $method_name = 'createOpenStackRouter'; break; } // Execute the process. Loading Loading @@ -1260,8 +1270,7 @@ class ApiController extends ControllerBase implements ApiControllerInterface { /** * {@inheritdoc} */ public function getNetworkOptions($cloud_context): JsonResponse { $properties = []; public function getNetworkOptions(string $cloud_context, array $properties = []): JsonResponse { $properties['cloud_context'] = $cloud_context; $account = $this->currentUser; Loading