Commit ac68376d authored by baldwinlouie's avatar baldwinlouie Committed by Yas Naoi
Browse files

Issue #3306654 by baldwinlouie, yas: Add VMware Host and VMware VM blocks to frontpage

parent f0dcf019
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ class DashboardController extends ControllerBase implements DashboardControllerI
    if ($this->moduleHandler()->moduleExists('terraform') === TRUE) {
      $content[] = $this->getTerraformBlocks();
    }
    if ($this->moduleHandler()->moduleExists('vmware') === TRUE) {
      $content[] = $this->getVmwareBlocks();
    }
    return [
      '#theme' => 'cloud_orchestrator_dashboard',
      '#top' => $this->getBlock('cloud_config_location'),
@@ -71,6 +74,36 @@ class DashboardController extends ControllerBase implements DashboardControllerI
    ];
  }

  /**
   * Helper to get VMware blocks.
   *
   * @return array
   *   Array of blocks;
   */
  private function getVmwareBlocks(): array {
    $vmware_blocks = [];
    $vmware_blocks['label'] = $this->t('VMware');
    $vmware_blocks['top'] = $this->getBlock(
      'vmware_resources_block',
      [
        'cloud_context' => '',
      ],
    );
    $vmware_blocks['first_above'][] = $this->getBlock(
      'vmware_host_block',
      [
        'cloud_context' => '',
      ]
    );
    $vmware_blocks['second_above'][] = $this->getBlock(
      'vmware_vm_block',
      [
        'cloud_context' => '',
      ]
    );
    return $vmware_blocks;
  }

  /**
   * Helper to get Terraform blocks.
   *