Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add top row information into the storage manager quadicons #4987

Merged
merged 1 commit into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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