Skip to content
Snippets Groups Projects
Commit fc15a385 authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3040046 by Xiaohua Guan, yas, baldwinlouie, Masami: Display...

Issue #3040046 by Xiaohua Guan, yas, baldwinlouie, Masami: Display comprehensive name as the default value (by "Name" tag) on Name field on EBS Volume list
parent d6d6f67a
No related branches found
No related tags found
No related merge requests found
......@@ -437,6 +437,14 @@ function aws_cloud_update_8128() {
aws_cloud_add_fields('cloud_server_template', 'aws_cloud', 'field_tags');
}
/**
* Add column volume_id to Volumes view.
*/
function aws_cloud_update_8129() {
$files = ['views.view.aws_volume.yml'];
cloud_update_yml_definitions($files, 'aws_cloud');
}
/**
* Helper function to add fields to the entity type.
*
......
......@@ -77,6 +77,7 @@ display:
description: ''
columns:
name: name
volume_id: volume_id
iops: iops
size: size
availability_zone: availability_zone
......@@ -93,6 +94,13 @@ display:
separator: ''
empty_column: false
responsive: ''
volume_id:
sortable: true
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
iops:
sortable: true
default_sort_order: asc
......@@ -147,7 +155,7 @@ display:
separator: ''
empty_column: false
responsive: ''
default: '-1'
default: name
empty_table: false
row:
type: 'entity:aws_cloud_volume'
......@@ -217,6 +225,71 @@ display:
entity_type: null
entity_field: name
plugin_id: field
volume_id:
id: volume_id
table: aws_cloud_volume
field: volume_id
relationship: none
group_type: group
admin_label: ''
label: 'Volume ID'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: aws_cloud_volume
entity_field: volume_id
plugin_id: field
iops:
id: iops
table: aws_cloud_volume
......
......@@ -1665,12 +1665,15 @@ class AwsEc2Service implements AwsEc2ServiceInterface {
$attachments[] = $attachment['InstanceId'];
}
$name = $this->getTagName($volume, $volume['VolumeId']);
$entity_id = $this->getEntityId($entity_type, 'volume_id', $volume['VolumeId']);
// Skip if $entity already exists, by updating 'refreshed' time.
if (!empty($entity_id)) {
/* @var \Drupal\aws_cloud\Entity\Ec2\Volume $entity */
$entity = Volume::load($entity_id);
$entity->setName($name);
$entity->setRefreshed($timestamp);
$entity->setState($volume['State']);
$entity->setAttachmentInformation(implode(', ', $attachments));
......@@ -1685,7 +1688,7 @@ class AwsEc2Service implements AwsEc2ServiceInterface {
}
$entity = Volume::create([
'cloud_context' => $this->cloudContext,
'name' => $volume['VolumeId'],
'name' => $name,
'volume_id' => $volume['VolumeId'],
'size' => $volume['Size'],
'state' => $volume['State'],
......
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