Skip to content

Commit

Permalink
Merge pull request #4711 from skateman/treeview-archorph
Browse files Browse the repository at this point in the history
Put background under archived/orphaned tree node icons in VMs

(cherry picked from commit 5fae302)
  • Loading branch information
mzazrivec authored and simaishi committed Oct 2, 2018
1 parent fe12dc4 commit f300d95
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
7 changes: 5 additions & 2 deletions app/presenters/tree_builder_archived.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ def x_get_tree_custom_kids(object, count_only, options)
end

def x_get_tree_arch_orph_nodes(model_name)
archived = QuadiconHelper.machine_state('archived').values_at(:fonticon, :background)
orphaned = QuadiconHelper.machine_state('orphaned').values_at(:fonticon, :background)

[
{:id => "arch", :text => _("<Archived>"), :icon => "fa fa-archive", :tip => _("Archived %{model}") % {:model => model_name}},
{:id => "orph", :text => _("<Orphaned>"), :icon => "ff ff-orphaned", :tip => _("Orphaned %{model}") % {:model => model_name}}
{:id => "arch", :text => _("<Archived>"), :icon => archived[0], :icon_background => archived[1], :tip => _("Archived %{model}") % {:model => model_name}},
{:id => "orph", :text => _("<Orphaned>"), :icon => orphaned[0], :icon_background => orphaned[1], :tip => _("Orphaned %{model}") % {:model => model_name}}
]
end
end
18 changes: 10 additions & 8 deletions spec/presenters/tree_builder_archived_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

it '#x_get_tree_arch_orph_nodes' do
nodes = archived.x_get_tree_arch_orph_nodes('VMs/Templates')
expect(nodes).to eq([{:id => "arch",
:text => "<Archived>",
:icon => "fa fa-archive",
:tip => "Archived VMs/Templates"},
{:id => "orph",
:text => "<Orphaned>",
:icon => "ff ff-orphaned",
:tip => "Orphaned VMs/Templates"}])
expect(nodes).to eq([{:id => "arch",
:text => "<Archived>",
:icon => "fa fa-archive",
:icon_background => "#336699",
:tip => "Archived VMs/Templates"},
{:id => "orph",
:text => "<Orphaned>",
:icon => "ff ff-orphaned",
:icon_background => "#336699",
:tip => "Orphaned VMs/Templates"}])
end

it '#x_get_tree_custom_kids with hidden Infra VMs returns empty Array' do
Expand Down
18 changes: 10 additions & 8 deletions spec/presenters/tree_builder_images_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@
it 'sets providers nodes correctly' do
providers = @images_tree.x_get_tree_roots(false, nil)
expect(providers).to eq([@template_cloud_with_az.ext_management_system,
{:id => "arch",
:text => "<Archived>",
:icon => "fa fa-archive",
:tip => "Archived Images"},
{:id => "orph",
:text => "<Orphaned>",
:icon => "ff ff-orphaned",
:tip => "Orphaned Images"}])
{:id => "arch",
:text => "<Archived>",
:icon => "fa fa-archive",
:icon_background => "#336699",
:tip => "Archived Images"},
{:id => "orph",
:text => "<Orphaned>",
:icon => "ff ff-orphaned",
:icon_background => "#336699",
:tip => "Orphaned Images"}])
end

it 'sets Templates nodes to empty Array if VMs/Templates are hidden' do
Expand Down
18 changes: 10 additions & 8 deletions spec/presenters/tree_builder_instances_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@

expect(providers).to eq([@vm_cloud_with_az.ext_management_system,
@vm_cloud_without_az.ext_management_system,
{:id => "arch",
:text => "<Archived>",
:icon => "fa fa-archive",
:tip => "Archived Instances"},
{:id => "orph",
:text => "<Orphaned>",
:icon => "ff ff-orphaned",
:tip => "Orphaned Instances"}])
{:id => "arch",
:text => "<Archived>",
:icon => "fa fa-archive",
:icon_background => "#336699",
:tip => "Archived Instances"},
{:id => "orph",
:text => "<Orphaned>",
:icon => "ff ff-orphaned",
:icon_background => "#336699",
:tip => "Orphaned Instances"}])
end

it 'sets availability zones correctly if vms are hidden' do
Expand Down

0 comments on commit f300d95

Please sign in to comment.