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

Issue #3308275 by Ryo Yamashita, yas: Add the function to launch OpenStack Instance in the SPA

parent 818933a2
Loading
Loading
Loading
Loading
+3 −4
Changes for modules/cloud_service_providers/openstack/src/Form/OpenStackInstanceLaunchForm.php: 3 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
namespace Drupal\openstack\Form;

use Drupal\aws_cloud\Form\Ec2\InstanceLaunchForm;
use Drupal\openstack\Entity\Config\Config;
use Drupal\cloud\Entity\CloudConfig;
use Drupal\Core\Form\FormStateInterface;

/**
@@ -31,8 +31,7 @@ class OpenStackInstanceLaunchForm extends InstanceLaunchForm {
   */
  public function buildForm(array $form, FormStateInterface $form_state, $cloud_context = ''): array {

    // @FIXME: Maybe this is a bug.
    $cloudContext = Config::load($cloud_context);
    $cloudContext = CloudConfig::load($cloud_context);

    if (isset($cloudContext)) {
      $this->ec2Service->setCloudContext($cloudContext->getCloudContext());
@@ -43,8 +42,8 @@ class OpenStackInstanceLaunchForm extends InstanceLaunchForm {
      ]));
    }

    /** @var \Drupal\openstack\Entity\Instance $entity */
    $form = parent::buildForm($form, $form_state);
    /** @var \Drupal\openstack\Entity\InstanceInterface $entity */
    $entity = $this->entity;

    $form['key_pair_name'] = [
+1 −1
Changes for modules/cloud_service_providers/openstack/src/Service/OpenStackOperationsService.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -615,7 +615,7 @@ class OpenStackOperationsService implements OpenStackOperationsServiceInterface
    usort($form_tags, static function ($a, $b) {
      return (int) $a['_weight'] - (int) $b['_weight'];
    });
    /** @var \Drupal\openstack\Service\OpenStackServiceInterface */
    /** @var \Drupal\openstack\Service\OpenStackServiceInterface|\Drupal\cloud\Service\CloudResourceTagInterface $ec2_service */
    $ec2_service = $this->openStackServiceFactory->get($entity->getCloudContext());
    $this->ec2Service = $ec2_service;
    $uid_key_name = $ec2_service->getTagKeyCreatedByUid(