From 26289cb7c616c4d6b94b6ee3ca6f58ba55ed4aaf Mon Sep 17 00:00:00 2001 From: Aparna Karve Date: Tue, 11 Sep 2018 10:42:00 -0700 Subject: [PATCH] virtual col for parent blue folder path with no non-display folders --- app/models/transformation_mapping.rb | 2 +- app/models/vm_or_template.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/transformation_mapping.rb b/app/models/transformation_mapping.rb index acc2d677a319..925e717b4392 100644 --- a/app/models/transformation_mapping.rb +++ b/app/models/transformation_mapping.rb @@ -84,7 +84,7 @@ def describe_vm(vm, reason) { "name" => vm.name, "cluster" => vm.ems_cluster.try(:name) || '', - "path" => vm.ext_management_system ? "#{vm.ext_management_system.name}/#{vm.parent_blue_folder_path(:exclude_non_display_folders => true)}" : '', + "path" => vm.ext_management_system ? "#{vm.ext_management_system.name}/#{vm.v_parent_blue_folder_display_path}" : '', "allocated_size" => vm.allocated_disk_storage, "id" => vm.id, "ems_cluster_id" => vm.ems_cluster_id, diff --git a/app/models/vm_or_template.rb b/app/models/vm_or_template.rb index 650436d50c94..8830a7af673e 100644 --- a/app/models/vm_or_template.rb +++ b/app/models/vm_or_template.rb @@ -151,6 +151,7 @@ class VmOrTemplate < ApplicationRecord virtual_column :v_owning_blue_folder, :type => :string, :uses => :all_relationships virtual_column :v_owning_blue_folder_path, :type => :string, :uses => :all_relationships virtual_column :v_datastore_path, :type => :string, :uses => :storage + virtual_column :v_parent_blue_folder_display_path, :type => :string, :uses => :all_relationships virtual_column :thin_provisioned, :type => :boolean, :uses => {:hardware => :disks} virtual_column :used_storage, :type => :integer, :uses => [:used_disk_storage, :mem_cpu] virtual_column :used_storage_by_state, :type => :integer, :uses => :used_storage @@ -803,6 +804,11 @@ def parent_datacenter end alias_method :owning_datacenter, :parent_datacenter + def parent_blue_folder_path_with_excluded_non_display_folders + parent_blue_folder_path(:exclude_non_display_folders => true) + end + alias_method :v_parent_blue_folder_display_path, :parent_blue_folder_path_with_excluded_non_display_folders + def lans !hardware.nil? ? hardware.nics.collect(&:lan).compact : [] end