Loading modules/cloud_service_providers/openstack/config/install/views.view.openstack_subnet.yml 0 → 100644 +1444 −0 File added.Preview size limit exceeded, changes collapsed. Show changes modules/cloud_service_providers/openstack/openstack.install +12 −0 Original line number Diff line number Diff line Loading @@ -1483,3 +1483,15 @@ function openstack_update_8262() { function openstack_update_8263() { openstack_add_entity_type('openstack_subnet'); } /** * Add openstack_subnet list view. */ function openstack_update_8264() { $files = [ 'views.view.openstack_subnet.yml', ]; \Drupal::service('cloud')->updateYmlDefinitions($files, 'openstack'); drupal_flush_all_caches(); } modules/cloud_service_providers/openstack/openstack.links.task.yml +12 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,18 @@ openstack.local_tasks.network.all: base_route: 'openstack.local_tasks.all_resources' weight: 90 openstack.local_tasks.subnet: title: 'Subnets' route_name: 'view.openstack_subnet.list' base_route: 'openstack.local_tasks.cloud_context' weight: 90 openstack.local_tasks.subnet.all: title: 'Subnets' route_name: 'view.openstack_subnet.all' base_route: 'openstack.local_tasks.all_resources' weight: 90 # OpenStack Instance routing definition openstack_instance.settings_tab: route_name: openstack_instance.settings Loading modules/cloud_service_providers/openstack/src/Entity/OpenStackSubnet.php +11 −4 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\openstack\Entity; use Drupal\cloud\Entity\CloudContentEntityBase; use Drupal\cloud\Service\Util\EntityLinkWithNameHtmlGenerator; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldStorageDefinitionInterface; Loading Loading @@ -295,11 +296,17 @@ class OpenStackSubnet extends CloudContentEntityBase implements OpenStackSubnetI ->setReadOnly(TRUE); $fields['network_id'] = BaseFieldDefinition::create('string') ->setLabel(t('Network ID')) ->setDescription(t('The ID of the network.')) ->setLabel(t('Network')) ->setDescription(t('The network.')) ->setDisplayOptions('view', [ 'label' => 'inline', 'type' => 'string', 'type' => 'entity_link', 'settings' => [ 'target_type' => 'openstack_network', 'field_name' => 'network_id', 'comma_separated' => TRUE, 'html_generator_class' => EntityLinkWithNameHtmlGenerator::class, ], 'weight' => -5, ]) ->setReadOnly(TRUE); Loading Loading @@ -356,7 +363,7 @@ class OpenStackSubnet extends CloudContentEntityBase implements OpenStackSubnetI ->setReadOnly(TRUE); $fields['enable_dhcp'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Admin State')) ->setLabel(t('Enable DHCP')) ->setDescription(t('Indicates whether dhcp is enabled or disabled for the subnet.')) ->setDisplayOptions('view', [ 'label' => 'inline', Loading modules/cloud_service_providers/openstack/src/Service/Rest/OpenStackService.php +6 −2 Original line number Diff line number Diff line Loading @@ -3947,7 +3947,6 @@ class OpenStackService extends CloudServiceBase implements OpenStackServiceInter $response = $this->getClient($credentials); $subnets = $response['body']['subnets'] ?? []; $results['Subnets'] = []; foreach ($subnets ?: [] as $subnet) { $pools = []; Loading @@ -3955,6 +3954,11 @@ class OpenStackService extends CloudServiceBase implements OpenStackServiceInter $pools[] = $allocation_pool['start'] . ' - ' . $allocation_pool['end']; } $routes = []; foreach ($subnet['host_routes'] ?: [] as $host_route) { $routes[] = sprintf('nexthop: %s, destination: %s', $host_route['nexthop'], $host_route['destination']); } $results['Subnets'][] = [ 'SubnetId' => $subnet['id'] ?? NULL, 'Name' => $subnet['name'] ?? NULL, Loading @@ -3967,7 +3971,7 @@ class OpenStackService extends CloudServiceBase implements OpenStackServiceInter 'AllocationPools' => $pools, 'GatewayIp' => $subnet['gateway_ip'], 'EnableDhcp' => $subnet['enable_dhcp'], 'HostRoutes' => $subnet['host_routes'], 'HostRoutes' => $routes, 'DnsNameServers' => $subnet['dns_nameservers'], ]; } Loading Loading
modules/cloud_service_providers/openstack/config/install/views.view.openstack_subnet.yml 0 → 100644 +1444 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
modules/cloud_service_providers/openstack/openstack.install +12 −0 Original line number Diff line number Diff line Loading @@ -1483,3 +1483,15 @@ function openstack_update_8262() { function openstack_update_8263() { openstack_add_entity_type('openstack_subnet'); } /** * Add openstack_subnet list view. */ function openstack_update_8264() { $files = [ 'views.view.openstack_subnet.yml', ]; \Drupal::service('cloud')->updateYmlDefinitions($files, 'openstack'); drupal_flush_all_caches(); }
modules/cloud_service_providers/openstack/openstack.links.task.yml +12 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,18 @@ openstack.local_tasks.network.all: base_route: 'openstack.local_tasks.all_resources' weight: 90 openstack.local_tasks.subnet: title: 'Subnets' route_name: 'view.openstack_subnet.list' base_route: 'openstack.local_tasks.cloud_context' weight: 90 openstack.local_tasks.subnet.all: title: 'Subnets' route_name: 'view.openstack_subnet.all' base_route: 'openstack.local_tasks.all_resources' weight: 90 # OpenStack Instance routing definition openstack_instance.settings_tab: route_name: openstack_instance.settings Loading
modules/cloud_service_providers/openstack/src/Entity/OpenStackSubnet.php +11 −4 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\openstack\Entity; use Drupal\cloud\Entity\CloudContentEntityBase; use Drupal\cloud\Service\Util\EntityLinkWithNameHtmlGenerator; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldStorageDefinitionInterface; Loading Loading @@ -295,11 +296,17 @@ class OpenStackSubnet extends CloudContentEntityBase implements OpenStackSubnetI ->setReadOnly(TRUE); $fields['network_id'] = BaseFieldDefinition::create('string') ->setLabel(t('Network ID')) ->setDescription(t('The ID of the network.')) ->setLabel(t('Network')) ->setDescription(t('The network.')) ->setDisplayOptions('view', [ 'label' => 'inline', 'type' => 'string', 'type' => 'entity_link', 'settings' => [ 'target_type' => 'openstack_network', 'field_name' => 'network_id', 'comma_separated' => TRUE, 'html_generator_class' => EntityLinkWithNameHtmlGenerator::class, ], 'weight' => -5, ]) ->setReadOnly(TRUE); Loading Loading @@ -356,7 +363,7 @@ class OpenStackSubnet extends CloudContentEntityBase implements OpenStackSubnetI ->setReadOnly(TRUE); $fields['enable_dhcp'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Admin State')) ->setLabel(t('Enable DHCP')) ->setDescription(t('Indicates whether dhcp is enabled or disabled for the subnet.')) ->setDisplayOptions('view', [ 'label' => 'inline', Loading
modules/cloud_service_providers/openstack/src/Service/Rest/OpenStackService.php +6 −2 Original line number Diff line number Diff line Loading @@ -3947,7 +3947,6 @@ class OpenStackService extends CloudServiceBase implements OpenStackServiceInter $response = $this->getClient($credentials); $subnets = $response['body']['subnets'] ?? []; $results['Subnets'] = []; foreach ($subnets ?: [] as $subnet) { $pools = []; Loading @@ -3955,6 +3954,11 @@ class OpenStackService extends CloudServiceBase implements OpenStackServiceInter $pools[] = $allocation_pool['start'] . ' - ' . $allocation_pool['end']; } $routes = []; foreach ($subnet['host_routes'] ?: [] as $host_route) { $routes[] = sprintf('nexthop: %s, destination: %s', $host_route['nexthop'], $host_route['destination']); } $results['Subnets'][] = [ 'SubnetId' => $subnet['id'] ?? NULL, 'Name' => $subnet['name'] ?? NULL, Loading @@ -3967,7 +3971,7 @@ class OpenStackService extends CloudServiceBase implements OpenStackServiceInter 'AllocationPools' => $pools, 'GatewayIp' => $subnet['gateway_ip'], 'EnableDhcp' => $subnet['enable_dhcp'], 'HostRoutes' => $subnet['host_routes'], 'HostRoutes' => $routes, 'DnsNameServers' => $subnet['dns_nameservers'], ]; } Loading