From fcb94f03b03dcf67b282df104560067d716ccce3 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Tue, 17 Dec 2024 16:27:42 +0100 Subject: [PATCH] fix: Fix few tui generated code issues (#877) Change-Id: Iac7169de7ee07fa06e48dec56d0e9656c2d7e45a Changes are triggered by https://review.opendev.org/937856 --- .../block_storage/v3/backup/delete.rs | 6 ++++- .../block_storage/v3/snapshot/delete.rs | 6 ++++- .../block_storage/v3/volume/delete.rs | 6 ++++- .../compute/v2/aggregate/delete.rs | 6 ++++- .../cloud_worker/compute/v2/aggregate/get.rs | 6 ++++- .../cloud_worker/compute/v2/flavor/delete.rs | 6 ++++- .../src/cloud_worker/compute/v2/flavor/get.rs | 6 ++++- .../cloud_worker/compute/v2/hypervisor/get.rs | 6 ++++- .../compute/v2/quota_set/details.rs | 6 ++++- .../cloud_worker/compute/v2/server/delete.rs | 6 ++++- .../src/cloud_worker/compute/v2/server/get.rs | 6 ++++- .../compute/v2/server/instance_action/get.rs | 4 ++++ .../cloud_worker/compute/v2/server/list.rs | 22 ++++++++++++++----- .../src/cloud_worker/dns/v2/recordset/list.rs | 2 +- .../src/cloud_worker/dns/v2/zone/delete.rs | 6 ++++- .../dns/v2/zone/recordset/delete.rs | 4 ++++ .../cloud_worker/identity/v3/group/delete.rs | 6 ++++- .../cloud_worker/identity/v3/group/list.rs | 2 +- .../identity/v3/group/user/delete.rs | 4 ++++ .../identity/v3/project/delete.rs | 6 ++++- .../cloud_worker/identity/v3/project/list.rs | 4 ++-- .../v3/user/application_credential/delete.rs | 4 ++++ .../cloud_worker/identity/v3/user/delete.rs | 6 ++++- .../src/cloud_worker/identity/v3/user/list.rs | 8 +++---- .../load_balancer/v2/healthmonitor/delete.rs | 6 ++++- .../load_balancer/v2/healthmonitor/get.rs | 6 ++++- .../load_balancer/v2/healthmonitor/list.rs | 14 ++++++++++-- .../load_balancer/v2/listener/delete.rs | 6 ++++- .../load_balancer/v2/listener/get.rs | 6 ++++- .../load_balancer/v2/listener/list.rs | 16 +++++++++++--- .../load_balancer/v2/loadbalancer/delete.rs | 6 ++++- .../load_balancer/v2/loadbalancer/get.rs | 6 ++++- .../load_balancer/v2/loadbalancer/list.rs | 22 ++++++++++++++----- .../load_balancer/v2/pool/delete.rs | 6 ++++- .../cloud_worker/load_balancer/v2/pool/get.rs | 6 ++++- .../load_balancer/v2/pool/list.rs | 14 ++++++++++-- .../load_balancer/v2/pool/member/delete.rs | 4 ++++ .../load_balancer/v2/pool/member/get.rs | 4 ++++ .../load_balancer/v2/pool/member/list.rs | 14 ++++++++++-- 39 files changed, 228 insertions(+), 52 deletions(-) diff --git a/openstack_tui/src/cloud_worker/block_storage/v3/backup/delete.rs b/openstack_tui/src/cloud_worker/block_storage/v3/backup/delete.rs index f90b53ef..00eb6721 100644 --- a/openstack_tui/src/cloud_worker/block_storage/v3/backup/delete.rs +++ b/openstack_tui/src/cloud_worker/block_storage/v3/backup/delete.rs @@ -36,7 +36,11 @@ pub struct BlockStorageBackupDelete { impl fmt::Display for BlockStorageBackupDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/block_storage/v3/snapshot/delete.rs b/openstack_tui/src/cloud_worker/block_storage/v3/snapshot/delete.rs index 8c19d26b..4ddf02d3 100644 --- a/openstack_tui/src/cloud_worker/block_storage/v3/snapshot/delete.rs +++ b/openstack_tui/src/cloud_worker/block_storage/v3/snapshot/delete.rs @@ -36,7 +36,11 @@ pub struct BlockStorageSnapshotDelete { impl fmt::Display for BlockStorageSnapshotDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/block_storage/v3/volume/delete.rs b/openstack_tui/src/cloud_worker/block_storage/v3/volume/delete.rs index f637ee01..60729691 100644 --- a/openstack_tui/src/cloud_worker/block_storage/v3/volume/delete.rs +++ b/openstack_tui/src/cloud_worker/block_storage/v3/volume/delete.rs @@ -36,7 +36,11 @@ pub struct BlockStorageVolumeDelete { impl fmt::Display for BlockStorageVolumeDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/aggregate/delete.rs b/openstack_tui/src/cloud_worker/compute/v2/aggregate/delete.rs index f83676da..a97c4234 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/aggregate/delete.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/aggregate/delete.rs @@ -36,7 +36,11 @@ pub struct ComputeAggregateDelete { impl fmt::Display for ComputeAggregateDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/aggregate/get.rs b/openstack_tui/src/cloud_worker/compute/v2/aggregate/get.rs index acccbe33..d17c1238 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/aggregate/get.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/aggregate/get.rs @@ -34,7 +34,11 @@ pub struct ComputeAggregateShow { impl fmt::Display for ComputeAggregateShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/flavor/delete.rs b/openstack_tui/src/cloud_worker/compute/v2/flavor/delete.rs index 2aa23fdd..8b1ef96d 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/flavor/delete.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/flavor/delete.rs @@ -36,7 +36,11 @@ pub struct ComputeFlavorDelete { impl fmt::Display for ComputeFlavorDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/flavor/get.rs b/openstack_tui/src/cloud_worker/compute/v2/flavor/get.rs index d1a839e3..67d2adf3 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/flavor/get.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/flavor/get.rs @@ -34,7 +34,11 @@ pub struct ComputeFlavorShow { impl fmt::Display for ComputeFlavorShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/hypervisor/get.rs b/openstack_tui/src/cloud_worker/compute/v2/hypervisor/get.rs index 113b081d..de0d1a7c 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/hypervisor/get.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/hypervisor/get.rs @@ -35,7 +35,11 @@ pub struct ComputeHypervisorShow { impl fmt::Display for ComputeHypervisorShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/quota_set/details.rs b/openstack_tui/src/cloud_worker/compute/v2/quota_set/details.rs index 85d6e1d6..05c2e33c 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/quota_set/details.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/quota_set/details.rs @@ -37,13 +37,17 @@ pub struct ComputeQuotaSetShow { impl fmt::Display for ComputeQuotaSetShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); if self.user_id.is_some() || self.user_name.is_some() { parts.push(format!( "user: {}", self.user_name .as_ref() .or(self.user_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/compute/v2/server/delete.rs b/openstack_tui/src/cloud_worker/compute/v2/server/delete.rs index b25ef9ef..0d35d7db 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/server/delete.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/server/delete.rs @@ -36,7 +36,11 @@ pub struct ComputeServerDelete { impl fmt::Display for ComputeServerDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/server/get.rs b/openstack_tui/src/cloud_worker/compute/v2/server/get.rs index 9635e5da..149163c1 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/server/get.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/server/get.rs @@ -34,7 +34,11 @@ pub struct ComputeServerShow { impl fmt::Display for ComputeServerShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/compute/v2/server/instance_action/get.rs b/openstack_tui/src/cloud_worker/compute/v2/server/instance_action/get.rs index 0d69d669..98546dc0 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/server/instance_action/get.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/server/instance_action/get.rs @@ -37,6 +37,10 @@ pub struct ComputeInstanceActionShow { impl fmt::Display for ComputeInstanceActionShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); parts.push(format!( "server: {}", self.server_name.clone().unwrap_or(self.server_id.clone()) diff --git a/openstack_tui/src/cloud_worker/compute/v2/server/list.rs b/openstack_tui/src/cloud_worker/compute/v2/server/list.rs index a6d546af..042e99ea 100644 --- a/openstack_tui/src/cloud_worker/compute/v2/server/list.rs +++ b/openstack_tui/src/cloud_worker/compute/v2/server/list.rs @@ -104,7 +104,7 @@ impl fmt::Display for ComputeServerList { self.kernel_name .as_ref() .or(self.kernel_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -114,7 +114,7 @@ impl fmt::Display for ComputeServerList { self.project_name .as_ref() .or(self.project_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -124,7 +124,7 @@ impl fmt::Display for ComputeServerList { self.ramdisk_name .as_ref() .or(self.ramdisk_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -134,7 +134,7 @@ impl fmt::Display for ComputeServerList { self.reservation_name .as_ref() .or(self.reservation_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -144,7 +144,7 @@ impl fmt::Display for ComputeServerList { self.tenant_name .as_ref() .or(self.tenant_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -154,7 +154,17 @@ impl fmt::Display for ComputeServerList { self.user_name .as_ref() .or(self.user_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) + )); + } + + if self.uuid.is_some() || self.uuname.is_some() { + parts.push(format!( + "u: {}", + self.uuname + .as_ref() + .or(self.uuid.as_ref()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/dns/v2/recordset/list.rs b/openstack_tui/src/cloud_worker/dns/v2/recordset/list.rs index 17dbaf7a..a33158fb 100644 --- a/openstack_tui/src/cloud_worker/dns/v2/recordset/list.rs +++ b/openstack_tui/src/cloud_worker/dns/v2/recordset/list.rs @@ -52,7 +52,7 @@ impl fmt::Display for DnsRecordsetList { self.zone_name .as_ref() .or(self.zone_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/dns/v2/zone/delete.rs b/openstack_tui/src/cloud_worker/dns/v2/zone/delete.rs index b103333a..bd99bbf1 100644 --- a/openstack_tui/src/cloud_worker/dns/v2/zone/delete.rs +++ b/openstack_tui/src/cloud_worker/dns/v2/zone/delete.rs @@ -36,7 +36,11 @@ pub struct DnsZoneDelete { impl fmt::Display for DnsZoneDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/dns/v2/zone/recordset/delete.rs b/openstack_tui/src/cloud_worker/dns/v2/zone/recordset/delete.rs index 399945c0..75bd9afd 100644 --- a/openstack_tui/src/cloud_worker/dns/v2/zone/recordset/delete.rs +++ b/openstack_tui/src/cloud_worker/dns/v2/zone/recordset/delete.rs @@ -39,6 +39,10 @@ pub struct DnsRecordsetDelete { impl fmt::Display for DnsRecordsetDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); parts.push(format!( "zone: {}", self.zone_name.clone().unwrap_or(self.zone_id.clone()) diff --git a/openstack_tui/src/cloud_worker/identity/v3/group/delete.rs b/openstack_tui/src/cloud_worker/identity/v3/group/delete.rs index 4ef84478..6a0a1e21 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/group/delete.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/group/delete.rs @@ -36,7 +36,11 @@ pub struct IdentityGroupDelete { impl fmt::Display for IdentityGroupDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/identity/v3/group/list.rs b/openstack_tui/src/cloud_worker/identity/v3/group/list.rs index 96cc611b..8aceaf67 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/group/list.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/group/list.rs @@ -41,7 +41,7 @@ impl fmt::Display for IdentityGroupList { self.domain_name .as_ref() .or(self.domain_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/identity/v3/group/user/delete.rs b/openstack_tui/src/cloud_worker/identity/v3/group/user/delete.rs index 8cbf2fed..d7f34137 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/group/user/delete.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/group/user/delete.rs @@ -43,6 +43,10 @@ impl fmt::Display for IdentityUserDelete { "group: {}", self.group_name.clone().unwrap_or(self.group_id.clone()) )); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/identity/v3/project/delete.rs b/openstack_tui/src/cloud_worker/identity/v3/project/delete.rs index c4da56f1..8e78f3ca 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/project/delete.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/project/delete.rs @@ -36,7 +36,11 @@ pub struct IdentityProjectDelete { impl fmt::Display for IdentityProjectDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/identity/v3/project/list.rs b/openstack_tui/src/cloud_worker/identity/v3/project/list.rs index 88b5d6bb..7d09d701 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/project/list.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/project/list.rs @@ -53,7 +53,7 @@ impl fmt::Display for IdentityProjectList { self.domain_name .as_ref() .or(self.domain_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -63,7 +63,7 @@ impl fmt::Display for IdentityProjectList { self.parent_name .as_ref() .or(self.parent_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/identity/v3/user/application_credential/delete.rs b/openstack_tui/src/cloud_worker/identity/v3/user/application_credential/delete.rs index 1d691571..daa78ee7 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/user/application_credential/delete.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/user/application_credential/delete.rs @@ -39,6 +39,10 @@ pub struct IdentityApplicationCredentialDelete { impl fmt::Display for IdentityApplicationCredentialDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); parts.push(format!( "user: {}", self.user_name.clone().unwrap_or(self.user_id.clone()) diff --git a/openstack_tui/src/cloud_worker/identity/v3/user/delete.rs b/openstack_tui/src/cloud_worker/identity/v3/user/delete.rs index d9735493..642064b9 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/user/delete.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/user/delete.rs @@ -36,7 +36,11 @@ pub struct IdentityUserDelete { impl fmt::Display for IdentityUserDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/identity/v3/user/list.rs b/openstack_tui/src/cloud_worker/identity/v3/user/list.rs index 744b1838..222ab454 100644 --- a/openstack_tui/src/cloud_worker/identity/v3/user/list.rs +++ b/openstack_tui/src/cloud_worker/identity/v3/user/list.rs @@ -50,7 +50,7 @@ impl fmt::Display for IdentityUserList { self.domain_name .as_ref() .or(self.domain_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -60,7 +60,7 @@ impl fmt::Display for IdentityUserList { self.idp_name .as_ref() .or(self.idp_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -70,7 +70,7 @@ impl fmt::Display for IdentityUserList { self.protocol_name .as_ref() .or(self.protocol_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -80,7 +80,7 @@ impl fmt::Display for IdentityUserList { self.unique_name .as_ref() .or(self.unique_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/delete.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/delete.rs index d74caf64..b53ef60f 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/delete.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/delete.rs @@ -36,7 +36,11 @@ pub struct LoadBalancerHealthmonitorDelete { impl fmt::Display for LoadBalancerHealthmonitorDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/get.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/get.rs index a1b48afb..da1a9d72 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/get.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/get.rs @@ -34,7 +34,11 @@ pub struct LoadBalancerHealthmonitorShow { impl fmt::Display for LoadBalancerHealthmonitorShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/list.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/list.rs index b8584989..7f8646f0 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/list.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/healthmonitor/list.rs @@ -61,13 +61,23 @@ pub struct LoadBalancerHealthmonitorList { impl fmt::Display for LoadBalancerHealthmonitorList { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + if self.id.is_some() || self.name.is_some() { + parts.push(format!( + "name/id: {}", + self.name + .as_ref() + .or(self.id.as_ref()) + .unwrap_or(&String::default()) + )); + } + if self.pool_id.is_some() || self.pool_name.is_some() { parts.push(format!( "pool: {}", self.pool_name .as_ref() .or(self.pool_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -77,7 +87,7 @@ impl fmt::Display for LoadBalancerHealthmonitorList { self.project_name .as_ref() .or(self.project_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/listener/delete.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/listener/delete.rs index 2a6986b3..727b1465 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/listener/delete.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/listener/delete.rs @@ -36,7 +36,11 @@ pub struct LoadBalancerListenerDelete { impl fmt::Display for LoadBalancerListenerDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/listener/get.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/listener/get.rs index 18999343..6d437353 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/listener/get.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/listener/get.rs @@ -34,7 +34,11 @@ pub struct LoadBalancerListenerShow { impl fmt::Display for LoadBalancerListenerShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/listener/list.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/listener/list.rs index 3839f159..9449850d 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/listener/list.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/listener/list.rs @@ -74,7 +74,17 @@ impl fmt::Display for LoadBalancerListenerList { self.default_pool_name .as_ref() .or(self.default_pool_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) + )); + } + + if self.id.is_some() || self.name.is_some() { + parts.push(format!( + "name/id: {}", + self.name + .as_ref() + .or(self.id.as_ref()) + .unwrap_or(&String::default()) )); } @@ -84,7 +94,7 @@ impl fmt::Display for LoadBalancerListenerList { self.load_balancer_name .as_ref() .or(self.load_balancer_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -94,7 +104,7 @@ impl fmt::Display for LoadBalancerListenerList { self.project_name .as_ref() .or(self.project_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/delete.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/delete.rs index 1f7a99bb..4eb94c28 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/delete.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/delete.rs @@ -36,7 +36,11 @@ pub struct LoadBalancerLoadbalancerDelete { impl fmt::Display for LoadBalancerLoadbalancerDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/get.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/get.rs index d1d380f3..a6c7420a 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/get.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/get.rs @@ -34,7 +34,11 @@ pub struct LoadBalancerLoadbalancerShow { impl fmt::Display for LoadBalancerLoadbalancerShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/list.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/list.rs index 7f0a77fe..7b4a8f56 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/list.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/loadbalancer/list.rs @@ -69,7 +69,17 @@ impl fmt::Display for LoadBalancerLoadbalancerList { self.flavor_name .as_ref() .or(self.flavor_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) + )); + } + + if self.id.is_some() || self.name.is_some() { + parts.push(format!( + "name/id: {}", + self.name + .as_ref() + .or(self.id.as_ref()) + .unwrap_or(&String::default()) )); } @@ -79,7 +89,7 @@ impl fmt::Display for LoadBalancerLoadbalancerList { self.project_name .as_ref() .or(self.project_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -89,7 +99,7 @@ impl fmt::Display for LoadBalancerLoadbalancerList { self.vip_network_name .as_ref() .or(self.vip_network_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -99,7 +109,7 @@ impl fmt::Display for LoadBalancerLoadbalancerList { self.vip_port_name .as_ref() .or(self.vip_port_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -109,7 +119,7 @@ impl fmt::Display for LoadBalancerLoadbalancerList { self.vip_qos_policy_name .as_ref() .or(self.vip_qos_policy_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -119,7 +129,7 @@ impl fmt::Display for LoadBalancerLoadbalancerList { self.vip_subnet_name .as_ref() .or(self.vip_subnet_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/delete.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/delete.rs index efe31e9b..4f45171f 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/delete.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/delete.rs @@ -36,7 +36,11 @@ pub struct LoadBalancerPoolDelete { impl fmt::Display for LoadBalancerPoolDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/get.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/get.rs index ee56c51a..203f8dc3 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/get.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/get.rs @@ -34,7 +34,11 @@ pub struct LoadBalancerPoolShow { impl fmt::Display for LoadBalancerPoolShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let parts: Vec = Vec::new(); + let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); write!(f, "{}", parts.join(",")) } } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/list.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/list.rs index 5d54d868..4bbd6c8d 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/list.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/list.rs @@ -57,13 +57,23 @@ pub struct LoadBalancerPoolList { impl fmt::Display for LoadBalancerPoolList { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + if self.id.is_some() || self.name.is_some() { + parts.push(format!( + "name/id: {}", + self.name + .as_ref() + .or(self.id.as_ref()) + .unwrap_or(&String::default()) + )); + } + if self.loadbalancer_id.is_some() || self.loadbalancer_name.is_some() { parts.push(format!( "loadbalancer: {}", self.loadbalancer_name .as_ref() .or(self.loadbalancer_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -73,7 +83,7 @@ impl fmt::Display for LoadBalancerPoolList { self.project_name .as_ref() .or(self.project_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/delete.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/delete.rs index 1895db8c..244fd70c 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/delete.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/delete.rs @@ -39,6 +39,10 @@ pub struct LoadBalancerMemberDelete { impl fmt::Display for LoadBalancerMemberDelete { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); parts.push(format!( "pool: {}", self.pool_name.clone().unwrap_or(self.pool_id.clone()) diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/get.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/get.rs index 87a372b5..d6e344a7 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/get.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/get.rs @@ -37,6 +37,10 @@ pub struct LoadBalancerMemberShow { impl fmt::Display for LoadBalancerMemberShow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + parts.push(format!( + ": {}", + self.name.clone().unwrap_or(self.id.clone()) + )); parts.push(format!( "pool: {}", self.pool_name.clone().unwrap_or(self.pool_id.clone()) diff --git a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/list.rs b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/list.rs index e5762af7..14eaaff6 100644 --- a/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/list.rs +++ b/openstack_tui/src/cloud_worker/load_balancer/v2/pool/member/list.rs @@ -61,6 +61,16 @@ pub struct LoadBalancerMemberList { impl fmt::Display for LoadBalancerMemberList { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut parts: Vec = Vec::new(); + if self.id.is_some() || self.name.is_some() { + parts.push(format!( + "name/id: {}", + self.name + .as_ref() + .or(self.id.as_ref()) + .unwrap_or(&String::default()) + )); + } + parts.push(format!( "pool: {}", self.pool_name.clone().unwrap_or(self.pool_id.clone()) @@ -71,7 +81,7 @@ impl fmt::Display for LoadBalancerMemberList { self.project_name .as_ref() .or(self.project_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); } @@ -81,7 +91,7 @@ impl fmt::Display for LoadBalancerMemberList { self.subnet_name .as_ref() .or(self.subnet_id.as_ref()) - .unwrap_or(&String::new()) + .unwrap_or(&String::default()) )); }