Skip to content

Commit

Permalink
Merge pull request #4987 from skateman/storage-manager-quad
Browse files Browse the repository at this point in the history
Add top row information into the storage manager quadicons
  • Loading branch information
martinpovolny authored Dec 4, 2018
2 parents 189dfe3 + e16922e commit c6662af
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/decorators/manageiq/providers/storage_manager_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ def quadicon
},
:bottom_right => QuadiconHelper.provider_status(authentication_status, enabled?)
}

# Due to the lack of the separate STI classes this has to be done :(
if supports_block_storage?
icon[:top_left] = {
:text => t = cloud_volumes.size,
:tooltip => n_("%{number} Cloud Volume", "%{number} Cloud Volumes", t) % {:number => t}
}
icon[:top_right] = {
:text => t = cloud_volume_snapshots.size,
:tooltip => n_("%{number} Cloud Volume Snapshot", "%{number} Cloud Volume Snapshots", t) % {:number => t}
}
elsif supports_object_storage?
icon[:top_left] = {
:text => t = cloud_object_store_containers.size,
:tooltip => n_("%{number} Cloud Object Store Container", "%{number} Cloud Object Store Containers", t) % {:number => t}
}
end

icon[:middle] = QuadiconHelper::POLICY_SHIELD if get_policies.present?
icon
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe ManageIQ::Providers::StorageManagerDecorator do
describe '#quadicon' do
subject { model.decorate.quadicon }

context 'block storage' do
let(:model) { FactoryGirl.create(:ems_cinder) }

it 'includes cloud volumes and snapshots' do
expect(subject[:top_left][:tooltip]).to include("Cloud Volume")
expect(subject[:top_right][:tooltip]).to include("Cloud Volume Snapshot")
end
end

context 'object storage' do
let(:model) { FactoryGirl.create(:ems_swift) }

it 'includes cloud object store containers' do
expect(subject[:top_left][:tooltip]).to include("Cloud Object Store Container")
end
end
end
end

0 comments on commit c6662af

Please sign in to comment.