Commit 583d586a authored by Tomotaka Hosomi's avatar Tomotaka Hosomi Committed by Yas Naoi
Browse files

Issue #3324719 by yas, hosomitm, Ryo Yamashita: Add the function to delete...

Issue #3324719 by yas, hosomitm, Ryo Yamashita: Add the function to delete OpenStack network in the SPA
parent 50c75181
Loading
Loading
Loading
Loading
+13 −1
Changes for modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/openstack/network.ts: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -21,7 +21,19 @@ const OPENSTACK_NETWORK_TEMPLATE: EntityFormTemplate[] = [
        ]
      }
    ]
  }
  },
  {
    cloudServiceProvider: 'openstack',
    entityName: 'network',
    actionType: 'delete',
    entityRecords: [
      {
        type: 'label',
        text: 'Are you sure you want to delete the {{entityName}} {{name}}?'
      },
    ],
    submitButtonLabel: 'Delete'
  },
]

export default OPENSTACK_NETWORK_TEMPLATE;
+14 −0
Changes for modules/cloud_service_providers/openstack/openstack.routing.yml: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1156,6 +1156,20 @@ entity.openstack_network.create:
  options:
    perm: 'add openstack network'

entity.openstack_network.delete:
  path: '/cloud_dashboard/openstack/{cloud_context}/openstack_network/{entity_id}/delete'
  defaults:
    _controller: '\Drupal\openstack\Controller\ApiController::operateEntity'
    entity_type_id: openstack_network
    command: delete
  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: 'delete any openstack network+delete own openstack network'

entity.openstack_network.add_form:
  path: '/clouds/openstack/{cloud_context}/network/add'
  defaults:
+4 −0
Changes for modules/cloud_service_providers/openstack/src/Controller/ApiController.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -772,6 +772,10 @@ class ApiController extends ControllerBase implements ApiControllerInterface {
        $method_name = 'createOpenStackNetwork';
        break;

      case 'delete_openstack_network':
        $method_name = 'deleteOpenStackNetwork';
        break;

      case 'create_openstack_subnet':
        /** @var \Drupal\aws_cloud\Entity\Vpc\SubnetInterface $entity */
        $entity->setName($request->get('name', ''));