Skip to content
Snippets Groups Projects
Commit 5aa5559e authored by Yas Naoi's avatar Yas Naoi Committed by Yas Naoi
Browse files

Issue #3067465 by yas, Masami: Add a filter to only show aws_ec2 cloud_config...

Issue #3067465 by yas, Masami: Add a filter to only show aws_ec2 cloud_config entities in the admin/config/services/cloud/aws_cloud view
parent 756918f6
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ status: true ...@@ -3,6 +3,7 @@ status: true
dependencies: dependencies:
module: module:
- cloud - cloud
- options
- user - user
id: cloud_config id: cloud_config
label: 'Cloud Service Provider' label: 'Cloud Service Provider'
...@@ -428,6 +429,8 @@ display: ...@@ -428,6 +429,8 @@ display:
defaults: defaults:
sorts: false sorts: false
fields: false fields: false
filters: false
filter_groups: false
display_comment: 'Listing page showing all cloud service providers to administer' display_comment: 'Listing page showing all cloud service providers to administer'
fields: fields:
cloud_config_bulk_form: cloud_config_bulk_form:
...@@ -728,6 +731,50 @@ display: ...@@ -728,6 +731,50 @@ display:
destination: false destination: false
entity_type: cloud_config entity_type: cloud_config
plugin_id: entity_operations plugin_id: entity_operations
filters:
field_cloud_type_value:
id: field_cloud_type_value
table: cloud_config__field_cloud_type
field: field_cloud_type_value
relationship: none
group_type: group
admin_label: ''
operator: or
value:
amazon_ec2: amazon_ec2
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
reduce_duplicates: false
plugin_id: list_field
filter_groups:
operator: AND
groups:
1: AND
cache_metadata: cache_metadata:
max-age: 0 max-age: 0
contexts: contexts:
......
...@@ -16,9 +16,6 @@ settings: ...@@ -16,9 +16,6 @@ settings:
- -
value: openstack_nova value: openstack_nova
label: 'OpenStack Nova' label: 'OpenStack Nova'
-
value: cloudn
label: Cloudn
allowed_values_function: '' allowed_values_function: ''
module: options module: options
locked: false locked: false
......
...@@ -8,6 +8,7 @@ use Drupal\Tests\aws_cloud\Traits\AwsCloudTestEntityTrait; ...@@ -8,6 +8,7 @@ use Drupal\Tests\aws_cloud\Traits\AwsCloudTestEntityTrait;
use Drupal\Tests\aws_cloud\Traits\AwsCloudTestFormDataTrait; use Drupal\Tests\aws_cloud\Traits\AwsCloudTestFormDataTrait;
use Drupal\Tests\aws_cloud\Traits\AwsCloudTestMockTrait; use Drupal\Tests\aws_cloud\Traits\AwsCloudTestMockTrait;
use Drupal\Tests\BrowserTestBase; use Drupal\Tests\BrowserTestBase;
use Drupal\cloud\Entity\CloudConfig;
use Drupal\aws_cloud\Service\GoogleSpreadsheetService; use Drupal\aws_cloud\Service\GoogleSpreadsheetService;
/** /**
...@@ -112,29 +113,35 @@ abstract class AwsCloudTestCase extends BrowserTestBase { ...@@ -112,29 +113,35 @@ abstract class AwsCloudTestCase extends BrowserTestBase {
/** /**
* Create cloud context. * Create cloud context.
*
* @param string $bundle_type
* The CloudConfig Bundle Type ('aws_ec2' or 'openstack')
*
* @param string $cloud_type
* The Cloud Type ('amazon_ec2' or 'openstack_nova')
*
* @throws
*/ */
private function createCloudContext() { private function createCloudContext($bundle_type = 'aws_ec2', $cloud_type = 'amazon_ec2') {
$random = $this->random; $random = $this->random;
$this->cloudContext = $random->name(8); $this->cloudContext = $random->name(8);
$num = 1; $num = 1;
$data = [ $cloud = CloudConfig::create([
'cloud_context' => $this->cloudContext, 'cloud_context' => $this->cloudContext,
'type' => 'aws_ec2', 'type' => $bundle_type,
'label' => "Amazon EC2 US West ($num) - " . $random->name(8, TRUE), 'label' => "Amazon EC2 US West ($num) - " . $random->name(8, TRUE),
]; 'field_cloud_type' => $cloud_type,
'field_description' => "#$num: " . date('Y/m/d H:i:s - D M j G:i:s T Y') . $random->string(64, TRUE),
$cloud = entity_create('cloud_config', $data); 'field_api_version' => 'latest',
$cloud->field_cloud_type->value = 'amazon_ec2'; 'field_region' => "us-west-$num",
$cloud->field_description->value = "#$num: " . date('Y/m/d H:i:s - D M j G:i:s T Y') . $random->string(64, TRUE); 'field_api_endpoint_uri' => "https://ec2.us-west-$num.amazonaws.com",
$cloud->field_api_version->value = 'latest'; 'field_access_key' => $random->name(20, TRUE),
$cloud->field_region->value = "us-west-$num"; 'field_secret_key' => $random->name(40, TRUE),
$cloud->field_api_endpoint_uri->value = "https://ec2.us-west-$num.amazonaws.com"; 'field_account_id' => $random->name(16, TRUE),
$cloud->field_access_key->value = $random->name(20, TRUE); 'field_image_upload_url' => "https://ec2.us-west-$num.amazonaws.com",
$cloud->field_secret_key->value = $random->name(40, TRUE); 'field_x_509_certificate' => $random->string(255, TRUE),
$cloud->field_account_id->value = $random->name(16, TRUE); ]);
$cloud->field_image_upload_url->value = "https://ec2.us-west-$num.amazonaws.com";
$cloud->field_x_509_certificate->value = $random->string(255, TRUE);
// Set the cloud region so it is available. // Set the cloud region so it is available.
$this->cloudRegion = "us-west-$num"; $this->cloudRegion = "us-west-$num";
......
...@@ -302,6 +302,8 @@ trait AwsCloudTestEntityTrait { ...@@ -302,6 +302,8 @@ trait AwsCloudTestEntityTrait {
* The Cloud Context. * The Cloud Context.
* @param string $name * @param string $name
* The Cloud Config name. * The Cloud Config name.
* @param string $bundle_type
* The CloudConfig bundle Type string.
* @param string $cloud_type * @param string $cloud_type
* The Cloud Type string. * The Cloud Type string.
* *
...@@ -310,11 +312,12 @@ trait AwsCloudTestEntityTrait { ...@@ -310,11 +312,12 @@ trait AwsCloudTestEntityTrait {
* *
* @throws \Drupal\Core\Entity\EntityStorageException * @throws \Drupal\Core\Entity\EntityStorageException
*/ */
protected function createCloudConfigTestEntity($index = 0, $cloud_context = '', $name = '', $cloud_type = 'aws_ec2') { protected function createCloudConfigTestEntity($index = 0, $cloud_context = '', $name = '', $bundle_type = 'aws_ec2', $cloud_type = 'amazon_ec2') {
$entity = CloudConfig::create([ $entity = CloudConfig::create([
'cloud_context' => $cloud_context, 'cloud_context' => $cloud_context,
'name' => $name ?: sprintf('config-entity #%d - %s - %s', $index + 1, date('Y/m/d H:i:s'), $this->random->name(4, TRUE)), 'name' => $name ?: sprintf('config-entity #%d - %s - %s', $index + 1, date('Y/m/d H:i:s'), $this->random->name(4, TRUE)),
'type' => $cloud_type, 'type' => $bundle_type,
'field_cloud_type' => $cloud_type,
]); ]);
$entity->save(); $entity->save();
return $entity; return $entity;
...@@ -358,6 +361,8 @@ trait AwsCloudTestEntityTrait { ...@@ -358,6 +361,8 @@ trait AwsCloudTestEntityTrait {
* *
* @return \Drupal\aws_cloud\Entity\Ec2\SecurityGroup * @return \Drupal\aws_cloud\Entity\Ec2\SecurityGroup
* The Security Group entity. * The Security Group entity.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/ */
protected function createSecurityGroupTestEntity($index = 0, $group_id = '', $name = '', $cloud_context = '') { protected function createSecurityGroupTestEntity($index = 0, $group_id = '', $name = '', $cloud_context = '') {
......
...@@ -24,7 +24,8 @@ trait AwsCloudTestFormDataTrait { ...@@ -24,7 +24,8 @@ trait AwsCloudTestFormDataTrait {
for ($i = 0, $num = 1; $i < self::AWS_CLOUD_CONFIG_REPEAT_COUNT; $i++, $num++) { for ($i = 0, $num = 1; $i < self::AWS_CLOUD_CONFIG_REPEAT_COUNT; $i++, $num++) {
$data[] = [ $data[] = [
'field_cloud_type' => 'amazon_ec2', // 1 (TRUE) = 'openstack_nova', 0 (FALSE) = 'amazon_ec2'
'field_cloud_type' => $i % 2 ? 'openstack_nova' : 'amazon_ec2',
'name[0][value]' => sprintf('config-entity-%s - %s', $this->random->name(8, TRUE), date('Y/m/d H:i:s')), 'name[0][value]' => sprintf('config-entity-%s - %s', $this->random->name(8, TRUE), date('Y/m/d H:i:s')),
'field_description[0][value]' => "description #$num: " . date('Y/m/d H:i:s - D M j G:i:s T Y') . $this->random->string(64, TRUE), 'field_description[0][value]' => "description #$num: " . date('Y/m/d H:i:s - D M j G:i:s T Y') . $this->random->string(64, TRUE),
'field_api_version[0][value]' => 'latest', 'field_api_version[0][value]' => 'latest',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment