diff --git a/app/decorators/manageiq/providers/storage_manager_decorator.rb b/app/decorators/manageiq/providers/storage_manager_decorator.rb index 792ee1b5a3a..970f1dced33 100644 --- a/app/decorators/manageiq/providers/storage_manager_decorator.rb +++ b/app/decorators/manageiq/providers/storage_manager_decorator.rb @@ -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 diff --git a/spec/decorators/manageiq/providers/storage_manager_decorator_spec.rb b/spec/decorators/manageiq/providers/storage_manager_decorator_spec.rb new file mode 100644 index 00000000000..3537b1ab430 --- /dev/null +++ b/spec/decorators/manageiq/providers/storage_manager_decorator_spec.rb @@ -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