Commit 90527581 authored by Ryo Yamashita's avatar Ryo Yamashita Committed by Yas Naoi
Browse files

Issue #3319061 by Ryo Yamashita, yas: Add the SPA form and REST API to review...

Issue #3319061 by Ryo Yamashita, yas: Add the SPA form and REST API to review the OpenStack launch template in the Cloud module
parent 07bc0533
Loading
Loading
Loading
Loading
+1 −1
Changes for modules/cloud_dashboard/cloud_dashboard/.node-version: 1 added line, 1 removed line.
Original line number Diff line number Diff line
v15.14.0
v16.0.0
+12 −0
Changes for modules/cloud_dashboard/cloud_dashboard/src/constant/templates/form/openstack/launch_template.ts: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -202,6 +202,18 @@ const OPENSTACK_CLOUD_LAUNCH_TEMPLATE: EntityFormTemplate[] = [
      },
    ]
  },
  {
    cloudServiceProvider: 'openstack',
    entityName: 'cloud_launch_template',
    actionType: 'review',
    entityRecords: [
      {
        type: 'label',
        text: 'Workflow status will be changed from Draft to Review.'
      },
    ],
    submitButtonLabel: 'Review'
  },
]

export default OPENSTACK_CLOUD_LAUNCH_TEMPLATE;
+37 −0
Changes for modules/cloud_service_providers/aws_cloud/src/Controller/Ec2/ApiController.php: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1262,10 +1262,47 @@ class ApiController extends ControllerBase implements ApiControllerInterface {
          break;

        case 'copy_aws_cloud_cloud_launch_template':
          /** @var \Drupal\cloud\Entity\CloudLaunchTemplate $entity */
          $entity->set('name', $request->get('name', ''));
          $entity->set('description', $request->get('field_description', ''));
          $entity->set('instance_type', $request->get('field_instance_type', ''));
          $entity->set('iam_role', $request->get('field_iam_role', ''));
          $entity->set('min_count', $request->get('field_min_count', ''));
          $entity->set('max_count', $request->get('field_max_count', ''));
          $entity->set('test_only', json_decode($request->get('field_test_only', '"false"'), FALSE));
          $entity->set('image_id', $request->get('field_image_id', ''));
          $entity->set('kernel_id', $request->get('field_kernel_id', ''));
          $entity->set('ram_id', $request->get('field_ram', ''));
          $entity->set('availability_zone', $request->get('field_availability_zone', ''));
          $entity->set('vpc', $request->get('field_vpc', ''));
          $entity->set('subnet', $request->get('field_subnet', ''));
          $entity->set('security_groups', $request->get(json_decode('security_groups', '[]'), []));
          $entity->set('ssh_key', $request->get('ssh_key', ''));
          $entity->set('network_interface_id', $request->get('network_interface_id', ''));
          $entity->set('tags', json_decode($request->get('tags', '[]'), TRUE));
          $entity->set('revision_log_message', $request->get('revision_log_message', ''));
          $method_name = 'copyCloudLaunchTemplate';
          break;

        case 'edit_aws_cloud_cloud_launch_template':
          /** @var \Drupal\cloud\Entity\CloudLaunchTemplate $entity */
          $entity->set('description', $request->get('field_description', ''));
          $entity->set('instance_type', $request->get('field_instance_type', ''));
          $entity->set('iam_role', $request->get('field_iam_role', ''));
          $entity->set('min_count', $request->get('field_min_count', ''));
          $entity->set('max_count', $request->get('field_max_count', ''));
          $entity->set('test_only', json_decode($request->get('field_test_only', '"false"'), FALSE));
          $entity->set('image_id', $request->get('field_image_id', ''));
          $entity->set('kernel_id', $request->get('field_kernel_id', ''));
          $entity->set('ram_id', $request->get('field_ram', ''));
          $entity->set('availability_zone', $request->get('field_availability_zone', ''));
          $entity->set('vpc', $request->get('field_vpc', ''));
          $entity->set('subnet', $request->get('field_subnet', ''));
          $entity->set('security_groups', $request->get(json_decode('security_groups', '[]'), []));
          $entity->set('ssh_key', $request->get('ssh_key', ''));
          $entity->set('network_interface_id', $request->get('network_interface_id', ''));
          $entity->set('tags', json_decode($request->get('tags', '[]'), TRUE));
          $entity->set('revision_log_message', $request->get('revision_log_message', ''));
          $method_name = 'editCloudLaunchTemplate';
          break;

+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
@@ -1061,6 +1061,20 @@ entity.openstack_cloud_launch_template.edit:
  options:
    perm: 'edit any cloud server templates+edit own cloud server templates'

entity.openstack_cloud_launch_template.review:
  path: '/cloud_dashboard/openstack/{cloud_context}/cloud_launch_template/{entity_id}/review'
  defaults:
    _controller: '\Drupal\openstack\Controller\ApiController::operateEntity'
    entity_type_id: cloud_launch_template
    command: review
  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: 'edit any cloud server templates+edit own cloud server templates'

entity.openstack_floating_ip.network_interface_ids:
  path: '/cloud_dashboard/openstack/{cloud_context}/network_interface_ids'
  defaults:
+1 −1
Changes for modules/cloud_service_providers/openstack/openstack.services.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -24,4 +24,4 @@ services:

  openstack.operations:
    class: Drupal\openstack\Service\OpenStackOperationsService
    arguments: ['@aws_cloud.openstack.operations', '@plugin.manager.cloud_config_plugin', '@cloud', '@openstack.ec2', '@entity_type.manager', '@messenger', '@openstack.factory', '@request_stack', '@current_route_match', '@entity.link_renderer']
    arguments: ['@aws_cloud.openstack.operations', '@plugin.manager.cloud_config_plugin', '@cloud', '@openstack.ec2', '@entity_type.manager', '@messenger', '@openstack.factory', '@request_stack', '@current_route_match', '@entity.link_renderer', '@datetime.time', '@module_handler']
Loading