Skip to content

Commit

Permalink
Add the hidden column into EmsFolder's MiqHasStruct.
Browse files Browse the repository at this point in the history
Commit 7eec1c6 has changed the way to use the hidden column to determine if a ems_folder should be displayed to the user or not.
However, the hidden column got lost when an EmsFolder object is  converted to a MiqHashStruct.

https://bugzilla.redhat.com/show_bug.cgi?id=1363880
  • Loading branch information
lfu committed Aug 15, 2016
1 parent 323c04d commit d80ef71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/miq_request_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ def ems_has_clusters?
end

def get_ems_folders(folder, dh = {}, full_path = "")
if folder.evm_object_class == :EmsFolder && !folder.hidden?
if folder.evm_object_class == :EmsFolder && !folder.hidden
full_path += full_path.blank? ? "#{folder.name}" : " / #{folder.name}"
dh[folder.id] = full_path unless folder.type == "Datacenter"
end
Expand Down Expand Up @@ -1021,7 +1021,7 @@ def vm_or_template_to_hash_struct(ci)
end

def ems_folder_to_hash_struct(ci)
build_ci_hash_struct(ci, [:name, :type])
build_ci_hash_struct(ci, [:name, :type, :hidden])
end

def storage_to_hash_struct(ci)
Expand Down
11 changes: 11 additions & 0 deletions spec/models/miq_request_workflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,17 @@
end
end

context "#ems_folder_to_hash_struct" do
it 'contains hidden column' do
hs = workflow.ems_folder_to_hash_struct(FactoryGirl.create(:ems_folder, :name => 'vm', :hidden => true))

expect(hs.id).to be_kind_of(Integer)
expect(hs.evm_object_class).to eq(:EmsFolder)
expect(hs.name).to be_kind_of(String)
expect(hs.hidden).to be true
end
end

context "#validate regex" do
let(:regex) { {:required_regex => "^n@test.com$"} }
let(:regex_two) { {:required_regex => "^n$"} }
Expand Down

0 comments on commit d80ef71

Please sign in to comment.