Skip to content

Commit

Permalink
Merge pull request #200 from mzazrivec/migrate_display_names_for_models
Browse files Browse the repository at this point in the history
Migrate model display names from locale/en.yml to plugin
  • Loading branch information
mansam authored Jan 24, 2018
2 parents f34d224 + 409e2e7 commit 1d15688
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/openstack/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,8 @@ def block_storage_disk_usage
def object_storage_disk_usage(swift_replicas = 1)
cloud_object_store_containers.sum(:bytes).to_f * swift_replicas
end

def self.display_name(number = 1)
n_('Cloud Provider (OpenStack)', 'Cloud Providers (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def self.connection_options
connection_options
end

def self.display_name(number = 1)
n_('Cloud Tenant (OpenStack)', 'Cloud Tenants (OpenStack)', number)
end

private

def connection_options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ def self.transform_parameters(template, deploy_parameters)
end
end
end

def self.display_name(number = 1)
n_('Orchestration Stack (OpenStack)', 'Orchestration Stacks (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def format
content.strip.start_with?('{') ? 'json'.freeze : 'yaml'.freeze
end

def self.display_name(number = 1)
n_('Heat Template', 'Heat Templates', number)
end

private

def parse
Expand Down
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/openstack/cloud_manager/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,8 @@ def requires_storage_for_scan?
def memory_mb_available?
true
end

def self.display_name(number = 1)
n_('Instance (OpenStack)', 'Instances (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ def save_as_orderable!
self.orderable = true
save!
end

def self.display_name(number = 1)
n_('VNF Template', 'VNF Templates', number)
end
end
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/openstack/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,8 @@ def register_and_configure_nodes(nodes_json)
def validate_shutdown
{:available => false, :message => nil}
end

def self.display_name(number = 1)
n_('Infrastructure Provider (OpenStack)', 'Infrastructure Providers (OpenStack)', number)
end
end
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/openstack/infra_manager/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,8 @@ def refresh_network_interfaces(ssu)
_log.warn("Error in refreshing network interfaces of host #{id}. Error: #{e.message}")
_log.warn(e.backtrace.join("\n"))
end

def self.display_name(number = 1)
n_('Host (OpenStack)', 'Hosts (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ def scale_up_using_workflows(stack_parameters)
log_and_raise_update_error(__method__, err)
end

def self.display_name(number = 1)
n_('Orchestration Stack (OpenStack)', 'Orchestration Stacks (OpenStack)', number)
end

private

def scale_queue(method_name, userid, parameters)
Expand Down
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/openstack/network_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,8 @@ def create_security_group_queue(userid, options = {})
}
MiqTask.generic_action_with_callback(task_opts, queue_opts)
end

def self.display_name(number = 1)
n_('Network Provider (OpenStack)', 'Network Providers (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ def ip_address_utilization_live(reload = false)
end
end

def self.display_name(number = 1)
n_('Cloud Network (OpenStack)', 'Cloud Networks (OpenStack)', number)
end

private

def connection_options(cloud_tenant = nil)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
class ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork::Private < ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork
def self.display_name(number = 1)
n_('Cloud Network (OpenStack)', 'Cloud Networks (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
class ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork::Public < ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork
def self.display_name(number = 1)
n_('External Cloud Network (OpenStack)', 'External Cloud Networks (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def self.connection_options(cloud_tenant = nil)
connection_options
end

def self.display_name(number = 1)
n_('Cloud Subnet (OpenStack)', 'Cloud Subnets (OpenStack)', number)
end

private

def connection_options(cloud_tenant = nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ def self.connection_options(cloud_tenant = nil)
connection_options
end

def self.display_name(number = 1)
n_('Floating IP (OpenStack)', 'Floating IPs (OpenStack)', number)
end

private

def connection_options(cloud_tenant = nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ def disconnect_port
end
delete
end

def self.display_name(number = 1)
n_('Network Port (OpenStack)', 'Network Ports (OpenStack)', number)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def self.connection_options(cloud_tenant = nil)
connection_options
end

def self.display_name(number = 1)
n_('Network Router (OpenStack)', 'Network Routers (OpenStack)', number)
end

private

def connection_options(cloud_tenant = nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def self.connection_options(cloud_tenant = nil)
connection_options
end

def self.display_name(number = 1)
n_('Security Group (OpenStack)', 'Security Groups (OpenStack)', number)
end

private

def parse_direction(val)
Expand Down

0 comments on commit 1d15688

Please sign in to comment.