From 66b808b27e71b91a34c2623e01352340705274f4 Mon Sep 17 00:00:00 2001 From: Milan Zazrivec Date: Wed, 17 Jan 2018 17:57:09 +0100 Subject: [PATCH] Migrate model display names from locale/en.yml to models --- app/models/audit_event.rb | 4 ++++ app/models/availability_zone.rb | 4 ++++ app/models/bottleneck_event.rb | 4 ++++ app/models/chargeback_container_image.rb | 4 ++++ app/models/chargeback_container_project.rb | 4 ++++ app/models/chargeback_rate.rb | 4 ++++ app/models/chargeback_vm.rb | 4 ++++ app/models/classification.rb | 4 ++++ app/models/cloud_network.rb | 4 ++++ app/models/cloud_resource_quota.rb | 4 ++++ app/models/cloud_subnet.rb | 4 ++++ app/models/cloud_tenant.rb | 4 ++++ app/models/cloud_volume.rb | 4 ++++ app/models/cloud_volume_backup.rb | 4 ++++ app/models/cloud_volume_snapshot.rb | 4 ++++ app/models/compliance.rb | 4 ++++ app/models/condition.rb | 3 +++ app/models/configuration_script_source.rb | 4 ++++ app/models/container.rb | 4 ++++ app/models/container_build.rb | 4 ++++ app/models/container_group.rb | 4 ++++ app/models/container_group_performance.rb | 4 ++++ app/models/container_image.rb | 4 ++++ app/models/container_image_registry.rb | 4 ++++ app/models/container_node.rb | 4 ++++ app/models/container_node_performance.rb | 4 ++++ app/models/container_performance.rb | 4 ++++ app/models/container_project.rb | 4 ++++ app/models/container_project_performance.rb | 4 ++++ app/models/container_quota.rb | 4 ++++ app/models/container_replicator.rb | 4 ++++ app/models/container_route.rb | 4 ++++ app/models/container_service.rb | 4 ++++ app/models/container_template.rb | 4 ++++ app/models/custom_button.rb | 4 ++++ app/models/custom_button_set.rb | 4 ++++ app/models/ems_cluster.rb | 4 ++++ app/models/ems_cluster_performance.rb | 4 ++++ app/models/ems_event.rb | 4 ++++ app/models/ems_folder.rb | 4 ++++ app/models/ext_management_system.rb | 4 ++++ app/models/ext_management_system_performance.rb | 4 ++++ app/models/file_depot_ftp.rb | 4 ++++ app/models/file_depot_ftp_anonymous.rb | 4 ++++ app/models/file_depot_smb.rb | 4 ++++ app/models/filesystem.rb | 4 ++++ app/models/flavor.rb | 4 ++++ app/models/floating_ip.rb | 4 ++++ app/models/generic_object.rb | 4 ++++ app/models/generic_object_definition.rb | 4 ++++ app/models/guest_application.rb | 4 ++++ app/models/host.rb | 4 ++++ app/models/host_aggregate.rb | 4 ++++ app/models/host_performance.rb | 4 ++++ app/models/iso_datastore.rb | 4 ++++ app/models/iso_image.rb | 4 ++++ app/models/ldap_domain.rb | 4 ++++ app/models/ldap_region.rb | 4 ++++ app/models/ldap_server.rb | 4 ++++ app/models/load_balancer.rb | 4 ++++ .../providers/automation_manager/authentication.rb | 3 +++ app/models/manageiq/providers/base_manager.rb | 4 ++++ app/models/manageiq/providers/cloud_manager.rb | 4 ++++ .../manageiq/providers/cloud_manager/auth_key_pair.rb | 4 ++++ .../providers/cloud_manager/orchestration_stack.rb | 4 ++++ app/models/manageiq/providers/cloud_manager/template.rb | 4 ++++ app/models/manageiq/providers/cloud_manager/vm.rb | 4 ++++ app/models/manageiq/providers/configuration_manager.rb | 4 ++++ app/models/manageiq/providers/container_manager.rb | 4 ++++ .../automation_manager/amazon_credential.rb | 4 ++++ .../automation_manager/azure_credential.rb | 4 ++++ .../automation_manager/configuration_script_source.rb | 4 ++++ .../automation_manager/google_credential.rb | 4 ++++ .../automation_manager/machine_credential.rb | 4 ++++ .../automation_manager/network_credential.rb | 4 ++++ .../automation_manager/openstack_credential.rb | 4 ++++ .../embedded_ansible/automation_manager/playbook.rb | 4 ++++ .../automation_manager/rackspace_credential.rb | 4 ++++ .../automation_manager/scm_credential.rb | 4 ++++ .../automation_manager/vmware_credential.rb | 4 ++++ .../embedded_automation_manager/authentication.rb | 4 ++++ .../configuration_script_source.rb | 4 ++++ app/models/manageiq/providers/infra_manager.rb | 4 ++++ app/models/manageiq/providers/infra_manager/template.rb | 4 ++++ app/models/manageiq/providers/infra_manager/vm.rb | 4 ++++ app/models/manageiq/providers/network_manager.rb | 4 ++++ app/models/manageiq/providers/physical_infra_manager.rb | 4 ++++ app/models/manageiq/providers/storage_manager.rb | 4 ++++ .../manageiq/providers/storage_manager/cinder_manager.rb | 4 ++++ .../manageiq/providers/storage_manager/swift_manager.rb | 4 ++++ app/models/metering_container_image.rb | 4 ++++ app/models/metering_container_project.rb | 4 ++++ app/models/metering_vm.rb | 4 ++++ app/models/miq_action.rb | 4 ++++ app/models/miq_ae_class.rb | 4 ++++ app/models/miq_ae_instance.rb | 4 ++++ app/models/miq_ae_method.rb | 4 ++++ app/models/miq_ae_namespace.rb | 4 ++++ app/models/miq_alert.rb | 8 ++++---- app/models/miq_alert_set.rb | 4 ++++ app/models/miq_dialog.rb | 4 ++++ app/models/miq_enterprise.rb | 4 ++++ app/models/miq_event_definition.rb | 4 ++++ app/models/miq_group.rb | 4 ++++ app/models/miq_policy.rb | 9 +++++---- app/models/miq_policy_set.rb | 4 ++++ app/models/miq_provision.rb | 4 ++++ app/models/miq_region.rb | 4 ++++ app/models/miq_report.rb | 4 ++++ app/models/miq_request.rb | 4 ++++ app/models/miq_schedule.rb | 4 ++++ app/models/miq_search.rb | 4 ++++ app/models/miq_server.rb | 4 ++++ app/models/miq_task.rb | 4 ++++ app/models/miq_template.rb | 4 ++++ app/models/miq_user_role.rb | 4 ++++ app/models/miq_widget.rb | 4 ++++ app/models/miq_widget_set.rb | 4 ++++ app/models/miq_worker.rb | 5 +++++ app/models/network_port.rb | 4 ++++ app/models/network_router.rb | 4 ++++ app/models/orchestration_stack.rb | 4 ++++ app/models/orchestration_template.rb | 4 ++++ app/models/persistent_volume.rb | 4 ++++ app/models/physical_server.rb | 4 ++++ app/models/policy_event.rb | 4 ++++ app/models/pxe_image.rb | 4 ++++ app/models/pxe_image_type.rb | 4 ++++ app/models/pxe_server.rb | 4 ++++ app/models/resource_pool.rb | 4 ++++ app/models/scan_item.rb | 4 ++++ app/models/scan_item_set.rb | 4 ++++ app/models/security_group.rb | 4 ++++ app/models/service.rb | 4 ++++ app/models/service_template.rb | 4 ++++ app/models/service_template_catalog.rb | 4 ++++ app/models/snapshot.rb | 4 ++++ app/models/storage.rb | 4 ++++ app/models/storage_file.rb | 4 ++++ app/models/storage_performance.rb | 4 ++++ app/models/switch.rb | 4 ++++ app/models/tenant.rb | 4 ++++ app/models/time_profile.rb | 4 ++++ app/models/user.rb | 4 ++++ app/models/vim_performance_trend.rb | 4 ++++ app/models/vm.rb | 4 ++++ app/models/vm_or_template.rb | 4 ++++ app/models/vm_performance.rb | 4 ++++ app/models/vmdb_index.rb | 4 ++++ app/models/vmdb_table.rb | 4 ++++ app/models/windows_image.rb | 4 ++++ app/models/zone.rb | 4 ++++ 152 files changed, 608 insertions(+), 8 deletions(-) diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 58af7fd9de42..fbfb60c87476 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -30,4 +30,8 @@ def self.source(source) /^([^:]+):[^`]+`([^']+).*$/ =~ source[0] "#{File.basename($1, ".*").camelize}.#{$2}" end + + def self.display_name(number = 1) + n_('Audit Event', 'Audit Events', number) + end end diff --git a/app/models/availability_zone.rb b/app/models/availability_zone.rb index 82af032ae1ac..3854d2f1f075 100644 --- a/app/models/availability_zone.rb +++ b/app/models/availability_zone.rb @@ -25,6 +25,10 @@ def self.available where(arel_table[:type].not_eq("ManageIQ::Providers::Openstack::CloudManager::AvailabilityZoneNull")) end + def self.display_name(number = 1) + n_('Availability Zone', 'Availability Zones', number) + end + PERF_ROLLUP_CHILDREN = :vms def perf_rollup_parents(interval_name = nil) diff --git a/app/models/bottleneck_event.rb b/app/models/bottleneck_event.rb index a118cb0cf942..3f27c26d3f6e 100644 --- a/app/models/bottleneck_event.rb +++ b/app/models/bottleneck_event.rb @@ -148,4 +148,8 @@ def self.remove_duplicate_find_results(recs) a << r end end + + def self.display_name(number = 1) + n_('Bottleneck Event', 'Bottleneck Events', number) + end end diff --git a/app/models/chargeback_container_image.rb b/app/models/chargeback_container_image.rb index da760f7570b7..9b981776e0d4 100644 --- a/app/models/chargeback_container_image.rb +++ b/app/models/chargeback_container_image.rb @@ -113,6 +113,10 @@ def self.report_col_options } end + def self.display_name(number = 1) + n_('Chargeback for Image', 'Chargebacks for Image', number) + end + private def init_extra_fields(consumption) diff --git a/app/models/chargeback_container_project.rb b/app/models/chargeback_container_project.rb index 67e00ed0bb5b..7cc310258f57 100644 --- a/app/models/chargeback_container_project.rb +++ b/app/models/chargeback_container_project.rb @@ -72,6 +72,10 @@ def self.report_col_options } end + def self.display_name(number = 1) + n_('Chargeback for Projects', 'Chargebacks for Projects', number) + end + private def init_extra_fields(consumption) diff --git a/app/models/chargeback_rate.rb b/app/models/chargeback_rate.rb index f327fe760f53..befcdf569eb3 100644 --- a/app/models/chargeback_rate.rb +++ b/app/models/chargeback_rate.rb @@ -132,6 +132,10 @@ def assigned_tags? get_assigned_tos[:tags].present? end + def self.display_name(number = 1) + n_('Chargeback Rate', 'Chargeback Rates', number) + end + ########################################################### private diff --git a/app/models/chargeback_vm.rb b/app/models/chargeback_vm.rb index d1220c346453..d303af6b0f1d 100644 --- a/app/models/chargeback_vm.rb +++ b/app/models/chargeback_vm.rb @@ -183,6 +183,10 @@ def self.vms end end + def self.display_name(number = 1) + n_('Chargeback for VMs', 'Chargebacks for VMs', number) + end + private def init_extra_fields(consumption) diff --git a/app/models/classification.rb b/app/models/classification.rb index f30cb4449535..cb8e053cff02 100644 --- a/app/models/classification.rb +++ b/app/models/classification.rb @@ -466,6 +466,10 @@ def self.sanitize_name(name) name.downcase.tr('^a-z0-9_:', '_')[0, NAME_MAX_LENGTH] end + def self.display_name(number = 1) + n_('Category', 'Categories', number) + end + private def self.add_entries_from_hash(cat, entries) diff --git a/app/models/cloud_network.rb b/app/models/cloud_network.rb index 887fcc4dc177..90a16fe159a6 100644 --- a/app/models/cloud_network.rb +++ b/app/models/cloud_network.rb @@ -50,6 +50,10 @@ def self.class_by_ems(ext_management_system, _external = false) ext_management_system && ext_management_system.class::CloudNetwork end + def self.display_name(number = 1) + n_('Cloud Network', 'Cloud Networks', number) + end + private def extra_attributes_save(key, value) diff --git a/app/models/cloud_resource_quota.rb b/app/models/cloud_resource_quota.rb index a230026a7d3c..abf031aa428c 100644 --- a/app/models/cloud_resource_quota.rb +++ b/app/models/cloud_resource_quota.rb @@ -14,4 +14,8 @@ def method_missing(method, *args, &block) # UI should interpret -1 as "Unknown" method.to_s.end_with?("_quota_used") ? -1 : super end + + def self.display_name(number = 1) + n_('Cloud Resource Quota', 'Cloud Resource Quotas', number) + end end diff --git a/app/models/cloud_subnet.rb b/app/models/cloud_subnet.rb index 8762ab1e8d38..1ab132e3acb5 100644 --- a/app/models/cloud_subnet.rb +++ b/app/models/cloud_subnet.rb @@ -61,6 +61,10 @@ def raw_delete_cloud_subnet raise NotImplementedError, _("raw_delete_cloud_subnet must be implemented in a subclass") end + def self.display_name(number = 1) + n_('Cloud Subnet', 'Cloud Subnets', number) + end + private def extra_attributes_save(key, value) diff --git a/app/models/cloud_tenant.rb b/app/models/cloud_tenant.rb index 1fa881695ed1..5340cf0a0e48 100644 --- a/app/models/cloud_tenant.rb +++ b/app/models/cloud_tenant.rb @@ -165,4 +165,8 @@ def self.post_refresh_ems(ems_id, _) def self.tenant_joins_clause(scope) scope.includes(:source_tenant).includes(:ext_management_system) end + + def self.display_name(number = 1) + n_('Cloud Tenant', 'Cloud Tenants', number) + end end diff --git a/app/models/cloud_volume.rb b/app/models/cloud_volume.rb index 13e79e135289..7133af6510a9 100644 --- a/app/models/cloud_volume.rb +++ b/app/models/cloud_volume.rb @@ -129,4 +129,8 @@ def raw_delete_volume def available_vms raise NotImplementedError, _("available_vms must be implemented in a subclass") end + + def self.display_name(number = 1) + n_('Cloud Volume', 'Cloud Volumes', number) + end end diff --git a/app/models/cloud_volume_backup.rb b/app/models/cloud_volume_backup.rb index db14dc2a8f79..85773406fd5b 100644 --- a/app/models/cloud_volume_backup.rb +++ b/app/models/cloud_volume_backup.rb @@ -58,4 +58,8 @@ def delete def raw_delete raise NotImplementedError, _("raw_delete must be implemented in a subclass") end + + def self.display_name(number = 1) + n_('Cloud Volume Backup', 'Cloud Volume Backups', number) + end end diff --git a/app/models/cloud_volume_snapshot.rb b/app/models/cloud_volume_snapshot.rb index dcc2e5e715e3..cfe13506a6e8 100644 --- a/app/models/cloud_volume_snapshot.rb +++ b/app/models/cloud_volume_snapshot.rb @@ -61,4 +61,8 @@ def delete_snapshot def raw_delete_snapshot raise NotImplementedError, _("raw_delete_snapshot must be implemented in a subclass") end + + def self.display_name(number = 1) + n_('Cloud Volume Snapshot', 'Cloud Volume Snapshots', number) + end end diff --git a/app/models/compliance.rb b/app/models/compliance.rb index c887203495d9..b5f04807e900 100644 --- a/app/models/compliance.rb +++ b/app/models/compliance.rb @@ -112,4 +112,8 @@ def self.set_compliancy(compliant, target, event, details) end end end + + def self.display_name(number = 1) + n_('Compliance History', 'Compliance Histories', number) + end end diff --git a/app/models/condition.rb b/app/models/condition.rb index f636b55e999d..6443cd557ebe 100644 --- a/app/models/condition.rb +++ b/app/models/condition.rb @@ -287,4 +287,7 @@ def self.import_from_hash(condition, options = {}) return c, status end + def self.display_name(number = 1) + n_('Condition', 'Conditions', number) + end end # class Condition diff --git a/app/models/configuration_script_source.rb b/app/models/configuration_script_source.rb index fb29152e18c5..26aebf8db3a5 100644 --- a/app/models/configuration_script_source.rb +++ b/app/models/configuration_script_source.rb @@ -4,4 +4,8 @@ class ConfigurationScriptSource < ApplicationRecord belongs_to :manager, :class_name => "ExtManagementSystem" virtual_total :total_payloads, :configuration_script_payloads + + def self.display_name(number = 1) + n_('Repository', 'Repositories', number) + end end diff --git a/app/models/container.rb b/app/models/container.rb index 09e2250cb910..d700e56a3684 100644 --- a/app/models/container.rb +++ b/app/models/container.rb @@ -50,4 +50,8 @@ def disconnect_inv self.deleted_on = Time.now.utc save end + + def self.display_name(number = 1) + n_('Container', 'Containers', number) + end end diff --git a/app/models/container_build.rb b/app/models/container_build.rb index 97301044da90..8edecd388108 100644 --- a/app/models/container_build.rb +++ b/app/models/container_build.rb @@ -12,4 +12,8 @@ class ContainerBuild < ApplicationRecord has_many :container_build_pods acts_as_miq_taggable + + def self.display_name(number = 1) + n_('Container Build', 'Container Builds', number) + end end diff --git a/app/models/container_group.rb b/app/models/container_group.rb index f0c93ba3493c..033874304951 100644 --- a/app/models/container_group.rb +++ b/app/models/container_group.rb @@ -95,4 +95,8 @@ def disconnect_inv self.deleted_on = Time.now.utc save end + + def self.display_name(number = 1) + n_('Container Pod', 'Container Pods', number) + end end diff --git a/app/models/container_group_performance.rb b/app/models/container_group_performance.rb index 9e5e448d2827..9c075bd5e4cd 100644 --- a/app/models/container_group_performance.rb +++ b/app/models/container_group_performance.rb @@ -2,4 +2,8 @@ class ContainerGroupPerformance < MetricRollup default_scope { where("resource_type = 'ContainerGroup' and resource_id IS NOT NULL") } belongs_to :container_group, :foreign_key => :resource_id, :class_name => ContainerGroup.name + + def self.display_name(number = 1) + n_('Performance - Pod', 'Performance - Pods', number) + end end diff --git a/app/models/container_image.rb b/app/models/container_image.rb index c8b78f83bbff..80324c505fb7 100644 --- a/app/models/container_image.rb +++ b/app/models/container_image.rb @@ -111,4 +111,8 @@ def self.disconnect_inv(ids) end alias_method :perform_metadata_sync, :sync_stashed_metadata + + def self.display_name(number = 1) + n_('Container Image', 'Container Images', number) + end end diff --git a/app/models/container_image_registry.rb b/app/models/container_image_registry.rb index 1d34c093b439..0c1dd969801b 100644 --- a/app/models/container_image_registry.rb +++ b/app/models/container_image_registry.rb @@ -11,4 +11,8 @@ class ContainerImageRegistry < ApplicationRecord def full_name port.present? ? "#{host}:#{port}" : host end + + def self.display_name(number = 1) + n_('Container Image Registry', 'Container Image Registries', number) + end end diff --git a/app/models/container_node.rb b/app/models/container_node.rb index e506c35fac79..f8f93882ce77 100644 --- a/app/models/container_node.rb +++ b/app/models/container_node.rb @@ -118,4 +118,8 @@ def disconnect_inv self.deleted_on = Time.now.utc save end + + def self.display_name(number = 1) + n_('Container Node', 'Container Nodes', number) + end end diff --git a/app/models/container_node_performance.rb b/app/models/container_node_performance.rb index 4acd0a09f094..eff8ba861cea 100644 --- a/app/models/container_node_performance.rb +++ b/app/models/container_node_performance.rb @@ -2,4 +2,8 @@ class ContainerNodePerformance < MetricRollup default_scope { where("resource_type = 'ContainerNode' and resource_id IS NOT NULL") } belongs_to :container_node, :foreign_key => :resource_id, :class_name => ContainerNode.name + + def self.display_name(number = 1) + n_('Performance - Container Node', 'Performance - Container Nodes', number) + end end diff --git a/app/models/container_performance.rb b/app/models/container_performance.rb index 71a413af1739..42f080eecdd6 100644 --- a/app/models/container_performance.rb +++ b/app/models/container_performance.rb @@ -2,4 +2,8 @@ class ContainerPerformance < MetricRollup default_scope { where("resource_type = 'Container' and resource_id IS NOT NULL") } belongs_to :container_node, :foreign_key => :resource_id, :class_name => Container.name + + def self.display_name(number = 1) + n_('Performance - Container', 'Performance - Containers', number) + end end diff --git a/app/models/container_project.rb b/app/models/container_project.rb index addc703e831f..512dc19526f8 100644 --- a/app/models/container_project.rb +++ b/app/models/container_project.rb @@ -67,4 +67,8 @@ def disconnect_inv self.deleted_on = Time.now.utc save end + + def self.display_name(number = 1) + n_('Container Project', 'Container Projects', number) + end end diff --git a/app/models/container_project_performance.rb b/app/models/container_project_performance.rb index 6cfc84c9e362..fdd3729a650e 100644 --- a/app/models/container_project_performance.rb +++ b/app/models/container_project_performance.rb @@ -2,4 +2,8 @@ class ContainerProjectPerformance < MetricRollup default_scope { where("resource_type = 'ContainerProject' and resource_id IS NOT NULL") } belongs_to :container_node, :foreign_key => :resource_id, :class_name => ContainerProject.name + + def self.display_name(number = 1) + n_('Performance - Container Project', 'Performance - Container Projects', number) + end end diff --git a/app/models/container_quota.rb b/app/models/container_quota.rb index 653aa05c6d29..469fd594ae28 100644 --- a/app/models/container_quota.rb +++ b/app/models/container_quota.rb @@ -4,4 +4,8 @@ class ContainerQuota < ApplicationRecord has_many :container_quota_scopes, :dependent => :destroy has_many :container_quota_items, :dependent => :destroy + + def self.display_name(number = 1) + n_('Container Quota', 'Container Quotas', number) + end end diff --git a/app/models/container_replicator.rb b/app/models/container_replicator.rb index 7f546aba26f2..646d9066fde9 100644 --- a/app/models/container_replicator.rb +++ b/app/models/container_replicator.rb @@ -40,4 +40,8 @@ def event_where_clause(assoc = :ems_events) def perf_rollup_parents(interval_name = nil) [] end + + def self.display_name(number = 1) + n_('Container Replicator', 'Container Replicators', number) + end end diff --git a/app/models/container_route.rb b/app/models/container_route.rb index 8d12575e2823..19f6e971a173 100644 --- a/app/models/container_route.rb +++ b/app/models/container_route.rb @@ -9,4 +9,8 @@ class ContainerRoute < ApplicationRecord has_many :labels, -> { where(:section => "labels") }, :class_name => "CustomAttribute", :as => :resource, :dependent => :destroy acts_as_miq_taggable + + def self.display_name(number = 1) + n_('Container Route', 'Container Routes', number) + end end diff --git a/app/models/container_service.rb b/app/models/container_service.rb index b269bce7e75a..a4647708fd89 100644 --- a/app/models/container_service.rb +++ b/app/models/container_service.rb @@ -35,4 +35,8 @@ def container_groups_count def perf_rollup_parents(interval_name = nil) [] end + + def self.display_name(number = 1) + n_('Container Service', 'Container Services', number) + end end diff --git a/app/models/container_template.rb b/app/models/container_template.rb index 172d2eba6dec..8cbbb39b601d 100644 --- a/app/models/container_template.rb +++ b/app/models/container_template.rb @@ -14,4 +14,8 @@ class ContainerTemplate < ApplicationRecord serialize :object_labels, Hash acts_as_miq_taggable + + def self.display_name(number = 1) + n_('Container Template', 'Container Templates', number) + end end diff --git a/app/models/custom_button.rb b/app/models/custom_button.rb index 466103bc4a0a..f27a4ae074d6 100644 --- a/app/models/custom_button.rb +++ b/app/models/custom_button.rb @@ -197,4 +197,8 @@ def copy(options = {}) options[:guid] = SecureRandom.uuid options.each_with_object(dup) { |(k, v), button| button.send("#{k}=", v) }.tap(&:save!) end + + def self.display_name(number = 1) + n_('Button', 'Buttons', number) + end end diff --git a/app/models/custom_button_set.rb b/app/models/custom_button_set.rb index db43d1b9385f..1bc9ad39e76a 100644 --- a/app/models/custom_button_set.rb +++ b/app/models/custom_button_set.rb @@ -76,4 +76,8 @@ def deep_copy(options) custom_buttons.each { |cb| cbs.add_member(cb.copy(:applies_to => options[:owner])) } end end + + def self.display_name(number = 1) + n_('Button Group', 'Button Groups', number) + end end diff --git a/app/models/ems_cluster.rb b/app/models/ems_cluster.rb index cb6784f51ca3..5a1106014ff9 100644 --- a/app/models/ems_cluster.rb +++ b/app/models/ems_cluster.rb @@ -336,4 +336,8 @@ def self.non_openstack_clusters_exists? def openstack_cluster? ext_management_system.class == ManageIQ::Providers::Openstack::InfraManager end + + def self.display_name(number = 1) + n_('Cluster / Deployment Role', 'Cluster / Deployment Roles', number) + end end diff --git a/app/models/ems_cluster_performance.rb b/app/models/ems_cluster_performance.rb index c2e9a4e78f0c..3bb62336766b 100644 --- a/app/models/ems_cluster_performance.rb +++ b/app/models/ems_cluster_performance.rb @@ -2,4 +2,8 @@ class EmsClusterPerformance < MetricRollup default_scope { where("resource_type = 'EmsCluster' and resource_id IS NOT NULL") } belongs_to :ems_cluster, :foreign_key => :resource_id + + def self.display_name(number = 1) + n_('Performance - Cluster', 'Performance - Clusters', number) + end end diff --git a/app/models/ems_event.rb b/app/models/ems_event.rb index 89afbae05f38..fa2a6b6c9d76 100644 --- a/app/models/ems_event.rb +++ b/app/models/ems_event.rb @@ -222,6 +222,10 @@ def manager_refresh_targets ext_management_system.class::EventTargetParser.new(self).parse end + def self.display_name(number = 1) + n_('Management Event', 'Management Events', number) + end + private def self.create_event(event) diff --git a/app/models/ems_folder.rb b/app/models/ems_folder.rb index b0f7bcd53fc5..c132df578ae7 100644 --- a/app/models/ems_folder.rb +++ b/app/models/ems_folder.rb @@ -181,6 +181,10 @@ def self.child_folder_paths(folder, *args) child_folder_paths_recursive(subtree, options) end + def self.display_name(number = 1) + n_('Folder', 'Folders', number) + end + # Helper method for building the child folder paths given an arranged subtree. def self.child_folder_paths_recursive(subtree, options = {}) options[:prefix] ||= "" diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index f85c23b90efa..1c020909b83e 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -674,6 +674,10 @@ def tenant_identity User.super_admin.tap { |u| u.current_group = tenant.default_miq_group } end + def self.display_name(number = 1) + n_('Provider', 'Providers', number) + end + private def build_connection(options = {}) diff --git a/app/models/ext_management_system_performance.rb b/app/models/ext_management_system_performance.rb index d1116a8b0936..ecaa79acc0c7 100644 --- a/app/models/ext_management_system_performance.rb +++ b/app/models/ext_management_system_performance.rb @@ -2,4 +2,8 @@ class ExtManagementSystemPerformance < MetricRollup default_scope { where("resource_type = 'ExtManagementSystem' and resource_id IS NOT NULL") } belongs_to :ext_management_system, :foreign_key => :resource_id + + def self.display_name(number = 1) + n_('Performance - Provider', 'Performance - Providers', number) + end end diff --git a/app/models/file_depot_ftp.rb b/app/models/file_depot_ftp.rb index 7a18173ce23f..fa13047f5894 100644 --- a/app/models/file_depot_ftp.rb +++ b/app/models/file_depot_ftp.rb @@ -90,6 +90,10 @@ def file_exists?(file_or_directory) false end + def self.display_name(number = 1) + n_('FTP', 'FTPs', number) + end + private def create_directory_structure(directory_path) diff --git a/app/models/file_depot_ftp_anonymous.rb b/app/models/file_depot_ftp_anonymous.rb index 58638ab03807..11de5021062d 100644 --- a/app/models/file_depot_ftp_anonymous.rb +++ b/app/models/file_depot_ftp_anonymous.rb @@ -2,4 +2,8 @@ class FileDepotFtpAnonymous < FileDepotFtp def login_credentials ["anonymous", "anonymous"] end + + def self.display_name(number = 1) + n_('Anonymous FTP', 'Anonymous FTP', number) + end end diff --git a/app/models/file_depot_smb.rb b/app/models/file_depot_smb.rb index c8d89b2f3ef2..541849ab0ae2 100644 --- a/app/models/file_depot_smb.rb +++ b/app/models/file_depot_smb.rb @@ -14,4 +14,8 @@ def self.validate_settings(settings) def verify_credentials(_auth_type = nil, cred_hash = nil) self.class.validate_settings(cred_hash.merge(:uri => uri)) end + + def self.display_name(number = 1) + n_('Samba', 'Sambas', number) + end end diff --git a/app/models/filesystem.rb b/app/models/filesystem.rb index bc8a8ce90cc1..e843cebc6df1 100644 --- a/app/models/filesystem.rb +++ b/app/models/filesystem.rb @@ -150,4 +150,8 @@ def displayable_contents def permissions_str MiqLinux::Utils.octal_to_permissions(permissions) end + + def self.display_name(number = 1) + n_('File', 'Files', number) + end end diff --git a/app/models/flavor.rb b/app/models/flavor.rb index 62a5fa5258d1..dcb75ae6231b 100644 --- a/app/models/flavor.rb +++ b/app/models/flavor.rb @@ -112,4 +112,8 @@ def validate_unsupported(message_prefix) {:available => false, :message => _("%{message} is not available for %{name}.") % {:message => message_prefix, :name => name}} end + + def self.display_name(number = 1) + n_('Flavor', 'Flavors', number) + end end diff --git a/app/models/floating_ip.rb b/app/models/floating_ip.rb index d8944d1689b1..33fa7ceaf36b 100644 --- a/app/models/floating_ip.rb +++ b/app/models/floating_ip.rb @@ -23,4 +23,8 @@ def self.class_by_ems(ext_management_system) # TODO: use a factory on ExtManagementSystem side to return correct class for each provider ext_management_system && ext_management_system.class::FloatingIp end + + def self.display_name(number = 1) + n_('Floating IP', 'Floating IPs', number) + end end diff --git a/app/models/generic_object.rb b/app/models/generic_object.rb index 55dce8801819..a022366028b9 100644 --- a/app/models/generic_object.rb +++ b/app/models/generic_object.rb @@ -123,6 +123,10 @@ def ae_user_identity(*args) @tenant ||= @user.current_tenant end + def self.display_name(number = 1) + n_('Generic Object', 'Generic Objects', number) + end + private # The properties column contains raw data that are converted during read/write. diff --git a/app/models/generic_object_definition.rb b/app/models/generic_object_definition.rb index 16045809836e..cfe35e326b33 100644 --- a/app/models/generic_object_definition.rb +++ b/app/models/generic_object_definition.rb @@ -147,6 +147,10 @@ def generic_custom_buttons CustomButton.buttons_for("GenericObject") end + def self.display_name(number = 1) + n_('Generic Object Class', 'Generic Object Classes', number) + end + private def get_objects_of_association(attr, values) diff --git a/app/models/guest_application.rb b/app/models/guest_application.rb index f89454e959c2..bdbcbf2014a2 100644 --- a/app/models/guest_application.rb +++ b/app/models/guest_application.rb @@ -28,4 +28,8 @@ def v_unique_name return name if arch.blank? || arch == "noarch" "#{name} (#{arch})" end + + def self.display_name(number = 1) + n_('Guest Application', 'Guest Applications', number) + end end diff --git a/app/models/host.rb b/app/models/host.rb index 997919ac217a..1fd54755bc3d 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -1770,4 +1770,8 @@ def normalized_state def validate_destroy {:available => true, :message => nil} end + + def self.display_name(number = 1) + n_('Host / Node', 'Hosts / Nodes', number) + end end diff --git a/app/models/host_aggregate.rb b/app/models/host_aggregate.rb index 4aac3e5df414..c8dfc4c85f6f 100644 --- a/app/models/host_aggregate.rb +++ b/app/models/host_aggregate.rb @@ -30,4 +30,8 @@ def my_zone ems = ext_management_system ems ? ems.my_zone : MiqServer.my_zone end + + def self.display_name(number = 1) + n_('Host Aggregate', 'Host Aggregates', number) + end end diff --git a/app/models/host_performance.rb b/app/models/host_performance.rb index 83a643f1ffc3..4bac2ec65f23 100644 --- a/app/models/host_performance.rb +++ b/app/models/host_performance.rb @@ -3,4 +3,8 @@ class HostPerformance < MetricRollup belongs_to :ems_cluster, :foreign_key => :parent_ems_cluster_id belongs_to :host, :foreign_key => :resource_id + + def self.display_name(number = 1) + n_('Performance - Host', 'Performance - Hosts', number) + end end diff --git a/app/models/iso_datastore.rb b/app/models/iso_datastore.rb index 7c896e24a949..deab0423047f 100644 --- a/app/models/iso_datastore.rb +++ b/app/models/iso_datastore.rb @@ -44,4 +44,8 @@ def synchronize_advertised_images _log.info("Synchronizing images on #{log_for}...Complete") rescue ManageIQ::Providers::Redhat::InfraManager::OvirtServices::Error end + + def self.display_name(number = 1) + n_('ISO Datastore', 'ISO Datastores', number) + end end diff --git a/app/models/iso_image.rb b/app/models/iso_image.rb index 296c8bce47ff..d3b577318766 100644 --- a/app/models/iso_image.rb +++ b/app/models/iso_image.rb @@ -3,4 +3,8 @@ class IsoImage < ApplicationRecord belongs_to :pxe_image_type has_many :customization_templates, :through => :pxe_image_type + + def self.display_name(number = 1) + n_('ISO Image', 'ISO Images', number) + end end diff --git a/app/models/ldap_domain.rb b/app/models/ldap_domain.rb index 36f8566742dc..0253fe8efd7a 100644 --- a/app/models/ldap_domain.rb +++ b/app/models/ldap_domain.rb @@ -186,4 +186,8 @@ def manager_display_name_search(options, filter_key, filter_hash, base_search_fi end result end + + def self.display_name(number = 1) + n_('LDAP Domain', 'LDAP Domains', number) + end end diff --git a/app/models/ldap_region.rb b/app/models/ldap_region.rb index 6b5d4035b350..54a0e01b1f23 100644 --- a/app/models/ldap_region.rb +++ b/app/models/ldap_region.rb @@ -31,4 +31,8 @@ def user_search(options) end results end + + def self.display_name(number = 1) + n_('LDAP Region', 'LDAP Regions', number) + end end diff --git a/app/models/ldap_server.rb b/app/models/ldap_server.rb index 2b43285ec2cb..66d07c2e0bdd 100644 --- a/app/models/ldap_server.rb +++ b/app/models/ldap_server.rb @@ -29,4 +29,8 @@ def self.sync_data_from_timer(timestamp = Time.now) # Stub for now _log.info("time: #{timestamp}") end + + def self.display_name(number = 1) + n_('LDAP Server', 'LDAP Servers', number) + end end diff --git a/app/models/load_balancer.rb b/app/models/load_balancer.rb index 0fa0662a99d9..2fb873ce4ba4 100644 --- a/app/models/load_balancer.rb +++ b/app/models/load_balancer.rb @@ -82,4 +82,8 @@ def raw_status def raw_exists? raise NotImplementedError, _("raw_exists must be implemented in a subclass") end + + def self.display_name(number = 1) + n_('Load Balancer', 'Load Balancers', number) + end end diff --git a/app/models/manageiq/providers/automation_manager/authentication.rb b/app/models/manageiq/providers/automation_manager/authentication.rb index 31dc61803801..b45de93c3185 100644 --- a/app/models/manageiq/providers/automation_manager/authentication.rb +++ b/app/models/manageiq/providers/automation_manager/authentication.rb @@ -1,2 +1,5 @@ class ManageIQ::Providers::AutomationManager::Authentication < Authentication + def self.display_name(number = 1) + n_('Credential', 'Credentials', number) + end end diff --git a/app/models/manageiq/providers/base_manager.rb b/app/models/manageiq/providers/base_manager.rb index 8f963edb5f3a..5aba48bf1d0d 100644 --- a/app/models/manageiq/providers/base_manager.rb +++ b/app/models/manageiq/providers/base_manager.rb @@ -37,4 +37,8 @@ def self.options_description {} end end + + def self.display_name(number = 1) + n_('Provider', 'Providers', number) + end end diff --git a/app/models/manageiq/providers/cloud_manager.rb b/app/models/manageiq/providers/cloud_manager.rb index 9ea7c8d98fb0..e298a05a71e0 100644 --- a/app/models/manageiq/providers/cloud_manager.rb +++ b/app/models/manageiq/providers/cloud_manager.rb @@ -131,5 +131,9 @@ def sync_root_tenant def create_cloud_tenant(options) CloudTenant.create_cloud_tenant(self, options) end + + def self.display_name(number = 1) + n_('Cloud Provider', 'Cloud Providers', number) + end end end diff --git a/app/models/manageiq/providers/cloud_manager/auth_key_pair.rb b/app/models/manageiq/providers/cloud_manager/auth_key_pair.rb index fe949df1b4e4..d8e460d8d9b8 100644 --- a/app/models/manageiq/providers/cloud_manager/auth_key_pair.rb +++ b/app/models/manageiq/providers/cloud_manager/auth_key_pair.rb @@ -60,4 +60,8 @@ def delete_key_pair_queue(userid) def delete_key_pair raw_delete_key_pair end + + def self.display_name(number = 1) + n_('Key Pair', 'Key Pairs', number) + end end diff --git a/app/models/manageiq/providers/cloud_manager/orchestration_stack.rb b/app/models/manageiq/providers/cloud_manager/orchestration_stack.rb index 0e805a362707..f509be4a1df7 100644 --- a/app/models/manageiq/providers/cloud_manager/orchestration_stack.rb +++ b/app/models/manageiq/providers/cloud_manager/orchestration_stack.rb @@ -23,4 +23,8 @@ def self.create_stack(orchestration_manager, stack_name, template, options = {}) def self.orchestration_stack_class_factory(orchestration_manager, template) "#{orchestration_manager.class.name}::#{template.stack_type}".constantize end + + def self.display_name(number = 1) + n_('Orchestration Stack', 'Orchestration Stacks', number) + end end diff --git a/app/models/manageiq/providers/cloud_manager/template.rb b/app/models/manageiq/providers/cloud_manager/template.rb index 84c7f7140ba6..6c62f0347ea1 100644 --- a/app/models/manageiq/providers/cloud_manager/template.rb +++ b/app/models/manageiq/providers/cloud_manager/template.rb @@ -20,6 +20,10 @@ def self.eligible_for_provisioning ManageIQ::Providers::Openstack::CloudManager::VolumeSnapshotTemplate)) end + def self.display_name(number = 1) + n_('Image', 'Images', number) + end + private def raise_created_event diff --git a/app/models/manageiq/providers/cloud_manager/vm.rb b/app/models/manageiq/providers/cloud_manager/vm.rb index e74ca048fb79..225d879a3dd0 100644 --- a/app/models/manageiq/providers/cloud_manager/vm.rb +++ b/app/models/manageiq/providers/cloud_manager/vm.rb @@ -273,6 +273,10 @@ def self.evacuate(vm_id, options) vm.evacuate(options) end + def self.display_name(number = 1) + n_('Instance', 'Instances', number) + end + private def raise_created_event diff --git a/app/models/manageiq/providers/configuration_manager.rb b/app/models/manageiq/providers/configuration_manager.rb index 4151d91af9db..7970da7c281b 100644 --- a/app/models/manageiq/providers/configuration_manager.rb +++ b/app/models/manageiq/providers/configuration_manager.rb @@ -21,4 +21,8 @@ def total_configuration_profiles def total_configured_systems Rbac.filtered(configured_systems, :match_via_descendants => ConfiguredSystem).count end + + def self.display_name(number = 1) + n_('Configuration Manager', 'Configuration Managers', number) + end end diff --git a/app/models/manageiq/providers/container_manager.rb b/app/models/manageiq/providers/container_manager.rb index 64d73fcc2cfe..c4675d597c68 100644 --- a/app/models/manageiq/providers/container_manager.rb +++ b/app/models/manageiq/providers/container_manager.rb @@ -109,4 +109,8 @@ def endpoint_destroyed(role) virtualization_endpoint_destroyed(role) if respond_to?(:virtualization_endpoint_destroyed) end end + + def self.display_name(number = 1) + n_('Containers Provider', 'Containers Providers', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/amazon_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/amazon_credential.rb index d4972378cf67..c76acc704c6b 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/amazon_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/amazon_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::AmazonCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AmazonCredential + + def self.display_name(number = 1) + n_('Credential (Amazon)', 'Credentials (Amazon)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/azure_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/azure_credential.rb index 9a7e506d8a9a..cf5dc5fad642 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/azure_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/azure_credential.rb @@ -1,4 +1,8 @@ # This corresponds to Ansible Tower's Azure Resource Manager (azure_rm) type credential class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::AzureCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::AzureCredential + + def self.display_name(number = 1) + n_('Credential (Microsoft Azure)', 'Credentials (Microsoft Azure)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb index 19fadab5b3ad..76cef2fef6f1 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/configuration_script_source.rb @@ -4,4 +4,8 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScri include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::TowerApi FRIENDLY_NAME = "Ansible Automation Inside Project".freeze + + def self.display_name(number = 1) + n_('Repository (Embedded Ansible)', 'Repositories (Embedded Ansible)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/google_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/google_credential.rb index e0ea8258ece8..afde0868b6f4 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/google_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/google_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::GoogleCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::GoogleCredential + + def self.display_name(number = 1) + n_('Credential (Google)', 'Credentials (Google)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/machine_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/machine_credential.rb index 6fbd6c71adfe..80f7e61a2ed2 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/machine_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/machine_credential.rb @@ -1,4 +1,8 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::MachineCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Credential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::MachineCredential + + def self.display_name(number = 1) + n_('Credential (Machine)', 'Credentials (Machine)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/network_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/network_credential.rb index eaf3a86d6a6b..fc4b50bb6301 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/network_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/network_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::NetworkCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Credential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::NetworkCredential + + def self.display_name(number = 1) + n_('Credential (Network)', 'Credentials (Network)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/openstack_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/openstack_credential.rb index 1cd572124299..31ff6a41fc00 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/openstack_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/openstack_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::OpenstackCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::OpenstackCredential + + def self.display_name(number = 1) + n_('Credential (OpenStack)', 'Credentials (OpenStack)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/playbook.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/playbook.rb index 12c33ffbc6a7..b56cee2a4c3f 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/playbook.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/playbook.rb @@ -20,6 +20,10 @@ def raw_create_job_template(options) job_template_klass.raw_create_in_provider(manager, jt_options) end + def self.display_name(number = 1) + n_('Playbook (Embedded Ansible)', 'Playbooks (Embedded Ansible)', number) + end + private def build_parameter_list(options) diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/rackspace_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/rackspace_credential.rb index b38561845892..a2c463820d17 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/rackspace_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/rackspace_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::RackspaceCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::RackspaceCredential + + def self.display_name(number = 1) + n_('Credential (Rackspace)', 'Credentials (Rackspace)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb index 339b7bc60945..f10d9a1831a7 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/scm_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ScmCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Credential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::ScmCredential + + def self.display_name(number = 1) + n_('Credential (SCM)', 'Credentials (SCM)', number) + end end diff --git a/app/models/manageiq/providers/embedded_ansible/automation_manager/vmware_credential.rb b/app/models/manageiq/providers/embedded_ansible/automation_manager/vmware_credential.rb index cb28598ce461..452024d555ac 100644 --- a/app/models/manageiq/providers/embedded_ansible/automation_manager/vmware_credential.rb +++ b/app/models/manageiq/providers/embedded_ansible/automation_manager/vmware_credential.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::VmwareCredential < ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential include ManageIQ::Providers::AnsibleTower::Shared::AutomationManager::VmwareCredential + + def self.display_name(number = 1) + n_('Credential (VMware)', 'Credentials (VMware)', number) + end end diff --git a/app/models/manageiq/providers/embedded_automation_manager/authentication.rb b/app/models/manageiq/providers/embedded_automation_manager/authentication.rb index f0bfeb26408b..61f6ea98dfdc 100644 --- a/app/models/manageiq/providers/embedded_automation_manager/authentication.rb +++ b/app/models/manageiq/providers/embedded_automation_manager/authentication.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAutomationManager::Authentication < ManageIQ::Providers::AutomationManager::Authentication + + def self.display_name(number = 1) + n_('Credential', 'Credentials', number) + end end diff --git a/app/models/manageiq/providers/embedded_automation_manager/configuration_script_source.rb b/app/models/manageiq/providers/embedded_automation_manager/configuration_script_source.rb index 76923b911c81..4c048fc1c815 100644 --- a/app/models/manageiq/providers/embedded_automation_manager/configuration_script_source.rb +++ b/app/models/manageiq/providers/embedded_automation_manager/configuration_script_source.rb @@ -1,3 +1,7 @@ class ManageIQ::Providers::EmbeddedAutomationManager::ConfigurationScriptSource < ManageIQ::Providers::AutomationManager::ConfigurationScriptSource + + def self.display_name(number = 1) + n_('Repository', 'Repositories', number) + end end diff --git a/app/models/manageiq/providers/infra_manager.rb b/app/models/manageiq/providers/infra_manager.rb index aafad5dce7f9..67b10a6be963 100644 --- a/app/models/manageiq/providers/infra_manager.rb +++ b/app/models/manageiq/providers/infra_manager.rb @@ -54,4 +54,8 @@ def clusterless_hosts hosts.where(:ems_cluster => nil) end end + + def self.display_name(number = 1) + n_('Infrastructure Provider', 'Infrastructure Providers', number) + end end diff --git a/app/models/manageiq/providers/infra_manager/template.rb b/app/models/manageiq/providers/infra_manager/template.rb index 55be2d787b7b..c76253e0018d 100644 --- a/app/models/manageiq/providers/infra_manager/template.rb +++ b/app/models/manageiq/providers/infra_manager/template.rb @@ -5,6 +5,10 @@ def self.eligible_for_provisioning super.where(:type => %w(ManageIQ::Providers::Redhat::InfraManager::Template ManageIQ::Providers::Vmware::InfraManager::Template ManageIQ::Providers::Microsoft::InfraManager::Template)) end + def self.display_name(number = 1) + n_('Template', 'Templates', number) + end + private def raise_created_event diff --git a/app/models/manageiq/providers/infra_manager/vm.rb b/app/models/manageiq/providers/infra_manager/vm.rb index 68f7677d86dc..b222713b4fd5 100644 --- a/app/models/manageiq/providers/infra_manager/vm.rb +++ b/app/models/manageiq/providers/infra_manager/vm.rb @@ -15,6 +15,10 @@ def self.calculate_power_state(raw_power_state) super end + def self.display_name(number = 1) + n_('Virtual Machine', 'Virtual Machines', number) + end + private def raise_created_event diff --git a/app/models/manageiq/providers/network_manager.rb b/app/models/manageiq/providers/network_manager.rb index 099515b7cf41..20357804726d 100644 --- a/app/models/manageiq/providers/network_manager.rb +++ b/app/models/manageiq/providers/network_manager.rb @@ -87,4 +87,8 @@ def name "#{parent_manager.try(:name)} Network Manager" end end + + def self.display_name(number = 1) + n_('Network Manager', 'Network Managers', number) + end end diff --git a/app/models/manageiq/providers/physical_infra_manager.rb b/app/models/manageiq/providers/physical_infra_manager.rb index 2c075a16ae83..5dd178a50d5e 100644 --- a/app/models/manageiq/providers/physical_infra_manager.rb +++ b/app/models/manageiq/providers/physical_infra_manager.rb @@ -48,5 +48,9 @@ def console_supported? def console_url raise MiqException::Error, _("Console not supported") end + + def self.display_name(number = 1) + n_('Physical Infrastructure Provider', 'Physical Infrastructure Providers', number) + end end end diff --git a/app/models/manageiq/providers/storage_manager.rb b/app/models/manageiq/providers/storage_manager.rb index ec8995b17965..53383e8144ba 100644 --- a/app/models/manageiq/providers/storage_manager.rb +++ b/app/models/manageiq/providers/storage_manager.rb @@ -15,5 +15,9 @@ class StorageManager < ManageIQ::Providers::BaseManager :foreign_key => :parent_ems_id, :class_name => "ManageIQ::Providers::BaseManager", :autosave => true + + def self.display_name(number = 1) + n_('Storage Manager', 'Storage Managers', number) + end end end diff --git a/app/models/manageiq/providers/storage_manager/cinder_manager.rb b/app/models/manageiq/providers/storage_manager/cinder_manager.rb index b7c9ecddc975..73afb4e0d800 100644 --- a/app/models/manageiq/providers/storage_manager/cinder_manager.rb +++ b/app/models/manageiq/providers/storage_manager/cinder_manager.rb @@ -67,4 +67,8 @@ def supports_security_protocol? def supports_provider_id? true end + + def self.display_name(number = 1) + n_('Storage Manager (Cinder)', 'Storage Managers (Cinder)', number) + end end diff --git a/app/models/manageiq/providers/storage_manager/swift_manager.rb b/app/models/manageiq/providers/storage_manager/swift_manager.rb index 94f5732cbe33..fca644b6080d 100644 --- a/app/models/manageiq/providers/storage_manager/swift_manager.rb +++ b/app/models/manageiq/providers/storage_manager/swift_manager.rb @@ -67,4 +67,8 @@ def supports_provider_id? def self.event_monitor_class ManageIQ::Providers::StorageManager::SwiftManager::EventCatcher end + + def self.display_name(number = 1) + n_('Storage Manager (Swift)', 'Storage Managers (Swift)', number) + end end diff --git a/app/models/metering_container_image.rb b/app/models/metering_container_image.rb index b486630fc01c..f443dcf7fe63 100644 --- a/app/models/metering_container_image.rb +++ b/app/models/metering_container_image.rb @@ -21,4 +21,8 @@ def self.report_col_options def self.build_results_for_report_MeteringContainerImage(options) build_results_for_report_ChargebackContainerImage(options) end + + def self.display_name(number = 1) + n_('Metering for Image', 'Metering for Images', number) + end end diff --git a/app/models/metering_container_project.rb b/app/models/metering_container_project.rb index 0bfa34022535..c327053aebbd 100644 --- a/app/models/metering_container_project.rb +++ b/app/models/metering_container_project.rb @@ -19,4 +19,8 @@ def self.report_col_options def self.build_results_for_report_MeteringContainerProject(options) build_results_for_report_ChargebackContainerProject(options) end + + def self.display_name(number = 1) + n_('Metering for Project', 'Metering for Projects', number) + end end diff --git a/app/models/metering_vm.rb b/app/models/metering_vm.rb index d32b89370eb5..e46b145b9d48 100644 --- a/app/models/metering_vm.rb +++ b/app/models/metering_vm.rb @@ -24,4 +24,8 @@ def self.report_col_options def self.build_results_for_report_MeteringVm(options) build_results_for_report_ChargebackVm(options) end + + def self.display_name(number = 1) + n_('Metering for VM', 'Metering for VMs', number) + end end diff --git a/app/models/miq_action.rb b/app/models/miq_action.rb index f75e3724dab2..c3ae0d782a46 100644 --- a/app/models/miq_action.rb +++ b/app/models/miq_action.rb @@ -986,6 +986,10 @@ def self.fixture_path FIXTURE_DIR.join("#{to_s.pluralize.underscore}.csv") end + def self.display_name(number = 1) + n_('Action', 'Actions', number) + end + private def invoke_or_queue( diff --git a/app/models/miq_ae_class.rb b/app/models/miq_ae_class.rb index 7484622d6f69..e97e964c6cde 100644 --- a/app/models/miq_ae_class.rb +++ b/app/models/miq_ae_class.rb @@ -155,6 +155,10 @@ def self.waypoint_ids_for_state_machines end end + def self.display_name(number = 1) + n_('Automate Class', 'Automate Classes', number) + end + private def self.sub_namespaces(ns_obj, ids) diff --git a/app/models/miq_ae_instance.rb b/app/models/miq_ae_instance.rb index cdb3fe949849..1cc2ff5788ee 100644 --- a/app/models/miq_ae_instance.rb +++ b/app/models/miq_ae_instance.rb @@ -136,6 +136,10 @@ def self.get_homonymic_across_domains(user, fqname, enabled = nil) MiqAeDatastore.get_homonymic_across_domains(user, ::MiqAeInstance, fqname, enabled) end + def self.display_name(number = 1) + n_('Automate Instance', 'Automate Instances', number) + end + private def validate_field(field) diff --git a/app/models/miq_ae_method.rb b/app/models/miq_ae_method.rb index 743c1d21047d..5c03e09cf317 100644 --- a/app/models/miq_ae_method.rb +++ b/app/models/miq_ae_method.rb @@ -125,4 +125,8 @@ def self.find_by_class_id_and_name(class_id, name) ae_method_filter = ::MiqAeMethod.arel_table[:name].lower.matches(name) ::MiqAeMethod.where(ae_method_filter).where(:class_id => class_id).first end + + def self.display_name(number = 1) + n_('Automate Method', 'Automate Methods', number) + end end diff --git a/app/models/miq_ae_namespace.rb b/app/models/miq_ae_namespace.rb index fe9ec429ddbd..5b9f72fabbcc 100644 --- a/app/models/miq_ae_namespace.rb +++ b/app/models/miq_ae_namespace.rb @@ -113,4 +113,8 @@ def domain def domain? parent_id.nil? && name != '$' end + + def self.display_name(number = 1) + n_('Automate Namespace', 'Automate Namespaces', number) + end end diff --git a/app/models/miq_alert.rb b/app/models/miq_alert.rb index 35fc07e11514..e33160e9b791 100644 --- a/app/models/miq_alert.rb +++ b/app/models/miq_alert.rb @@ -32,10 +32,6 @@ def self.base_tables BASE_TABLES end - def self.display_name - "Alert" - end - acts_as_miq_set_member ASSIGNMENT_PARENT_ASSOCIATIONS = [:host, :ems_cluster, :ext_management_system, :my_enterprise] @@ -859,4 +855,8 @@ def self.import_from_yaml(fd) stat end end + + def self.display_name(number = 1) + n_('Alert', 'Alerts', number) + end end diff --git a/app/models/miq_alert_set.rb b/app/models/miq_alert_set.rb index 753a43a93c08..cb85e36f169d 100644 --- a/app/models/miq_alert_set.rb +++ b/app/models/miq_alert_set.rb @@ -49,6 +49,10 @@ def self.seed File.open(fixture_file) { |fd| MiqAlertSet.import_from_yaml(fd, :save => true) } end + def self.display_name(number = 1) + n_('Alert Profile', 'Alert Profiles', number) + end + private def default_name_to_description diff --git a/app/models/miq_dialog.rb b/app/models/miq_dialog.rb index 6dc4c318766f..6c4bd42980d8 100644 --- a/app/models/miq_dialog.rb +++ b/app/models/miq_dialog.rb @@ -49,4 +49,8 @@ def self.sync_from_file(filename, root) create(item) end end + + def self.display_name(number = 1) + n_('Dialog', 'Dialogs', number) + end end diff --git a/app/models/miq_enterprise.rb b/app/models/miq_enterprise.rb index 4e748d9325f1..5054f9d33a0e 100644 --- a/app/models/miq_enterprise.rb +++ b/app/models/miq_enterprise.rb @@ -103,4 +103,8 @@ def perf_capture_enabled? end alias_method :perf_capture_enabled, :perf_capture_enabled? Vmdb::Deprecation.deprecate_methods(self, :perf_capture_enabled => :perf_capture_enabled?) + + def self.display_name(number = 1) + n_('Enterprise', 'Enterprises', number) + end end # class MiqEnterprise diff --git a/app/models/miq_event_definition.rb b/app/models/miq_event_definition.rb index 17831e81e541..37487bf1a27c 100644 --- a/app/models/miq_event_definition.rb +++ b/app/models/miq_event_definition.rb @@ -170,4 +170,8 @@ def self.seed_default_definitions(event_defs) end end end + + def self.display_name(number = 1) + n_('Event', 'Events', number) + end end # class MiqEventDefinition diff --git a/app/models/miq_group.rb b/app/models/miq_group.rb index cec640ce867c..62a0180bd493 100644 --- a/app/models/miq_group.rb +++ b/app/models/miq_group.rb @@ -260,6 +260,10 @@ def single_group_users? users.includes(:miq_groups).where(:id => group_user_ids).where.not(:miq_groups => {:id => id}).count != group_user_ids.size end + def self.display_name(number = 1) + n_('Group', 'Groups', number) + end + private # if this tenant is changing, make sure this is not a default group diff --git a/app/models/miq_policy.rb b/app/models/miq_policy.rb index 55eeeafdbd91..b7d132e27f1c 100644 --- a/app/models/miq_policy.rb +++ b/app/models/miq_policy.rb @@ -84,10 +84,6 @@ def self.clean_attrs(attrs) attrs end - def self.display_name - "Policy" - end - def copy(new_fields) npolicy = self.class.new(self.class.clean_attrs(attributes).merge(new_fields)) npolicy.conditions = conditions @@ -182,6 +178,11 @@ def self.find_event_def(event) MiqEventDefinition.find_by(:name => event) end end + + def self.display_name(number = 1) + n_('Policy', 'Policies', number) + end + private_class_method :find_event_def def self.evaluate_conditions(plist, target, mode, inputs, result) diff --git a/app/models/miq_policy_set.rb b/app/models/miq_policy_set.rb index dcf807f7c8b2..0010b7037e89 100644 --- a/app/models/miq_policy_set.rb +++ b/app/models/miq_policy_set.rb @@ -85,6 +85,10 @@ def self.seed end end + def self.display_name(number = 1) + n_('Policy Profile', 'Policy Profiles', number) + end + private def default_name_to_description diff --git a/app/models/miq_provision.rb b/app/models/miq_provision.rb index 9e2f50b9f525..3413fbc2f52f 100644 --- a/app/models/miq_provision.rb +++ b/app/models/miq_provision.rb @@ -91,4 +91,8 @@ def self.get_description(prov_obj, vm_name) :name => prov_obj.vm_template.name, :vm_name => vm_name} end + + def self.display_name(number = 1) + n_('Provision', 'Provisions', number) + end end diff --git a/app/models/miq_region.rb b/app/models/miq_region.rb index 056752d22f97..bbf2892c7b92 100644 --- a/app/models/miq_region.rb +++ b/app/models/miq_region.rb @@ -301,6 +301,10 @@ def perf_capture_always=(options) @perf_capture_always = options.freeze end + def self.display_name(number = 1) + n_('Region', 'Regions', number) + end + private def clear_my_region_cache diff --git a/app/models/miq_report.rb b/app/models/miq_report.rb index ab03217f1759..cb333780aa12 100644 --- a/app/models/miq_report.rb +++ b/app/models/miq_report.rb @@ -222,4 +222,8 @@ def chart_header_column column_index = col_order.index { |col| col.include?(chart_column) } headers[column_index] end + + def self.display_name(number = 1) + n_('Report', 'Reports', number) + end end diff --git a/app/models/miq_request.rb b/app/models/miq_request.rb index 5eb1637cab33..2625699c0a4d 100644 --- a/app/models/miq_request.rb +++ b/app/models/miq_request.rb @@ -537,6 +537,10 @@ def my_records "#{self.class::SOURCE_CLASS_NAME}:#{requested_task_idx.inspect}" end + def self.display_name(number = 1) + n_('Request', 'Requests', number) + end + private def clean_up_keys_for_request_task diff --git a/app/models/miq_schedule.rb b/app/models/miq_schedule.rb index dc5ba2c4e6d6..9981daec4b14 100644 --- a/app/models/miq_schedule.rb +++ b/app/models/miq_schedule.rb @@ -441,4 +441,8 @@ def v_zone_name return "" if zone.nil? zone.name end + + def self.display_name(number = 1) + n_('Schedule', 'Schedules', number) + end end # class MiqSchedule diff --git a/app/models/miq_search.rb b/app/models/miq_search.rb index 893090147a8f..5eb3a340c1e1 100644 --- a/app/models/miq_search.rb +++ b/app/models/miq_search.rb @@ -105,4 +105,8 @@ def self.seed end end end + + def self.display_name(number = 1) + n_('Search', 'Searches', number) + end end diff --git a/app/models/miq_server.rb b/app/models/miq_server.rb index 5ebb7d24b1d0..098acd48e4fc 100644 --- a/app/models/miq_server.rb +++ b/app/models/miq_server.rb @@ -627,4 +627,8 @@ def tenant_identity def miq_region ::MiqRegion.my_region end + + def self.display_name(number = 1) + n_('Server', 'Servers', number) + end end # class MiqServer diff --git a/app/models/miq_task.rb b/app/models/miq_task.rb index e23528ff155f..824539cf8f0d 100644 --- a/app/models/miq_task.rb +++ b/app/models/miq_task.rb @@ -350,6 +350,10 @@ def process_cancel end end + def self.display_name(number = 1) + n_('Task', 'Tasks', number) + end + private def initialize_attributes diff --git a/app/models/miq_template.rb b/app/models/miq_template.rb index c5cb2ffb997b..8ee38e806c4c 100644 --- a/app/models/miq_template.rb +++ b/app/models/miq_template.rb @@ -37,4 +37,8 @@ def self.without_volume_templates end def active?; false; end + + def self.display_name(number = 1) + n_('VM Template and Image', 'VM Templates and Images', number) + end end diff --git a/app/models/miq_user_role.rb b/app/models/miq_user_role.rb index aa4db4de9ae2..4561e1df37ca 100644 --- a/app/models/miq_user_role.rb +++ b/app/models/miq_user_role.rb @@ -116,4 +116,8 @@ def admin_user? def self.default_tenant_role find_by(:name => DEFAULT_TENANT_ROLE_NAME) end + + def self.display_name(number = 1) + n_('Role', 'Roles', number) + end end diff --git a/app/models/miq_widget.rb b/app/models/miq_widget.rb index e477fe5224e9..c6bb9b40a2ad 100644 --- a/app/models/miq_widget.rb +++ b/app/models/miq_widget.rb @@ -576,6 +576,10 @@ def timezone_matters? options.fetch(:timezone_matters, true) end + def self.display_name(number = 1) + n_('Widget', 'Widgets', number) + end + private def content_generator diff --git a/app/models/miq_widget_set.rb b/app/models/miq_widget_set.rb index 6523c2619735..56e548e8e24d 100644 --- a/app/models/miq_widget_set.rb +++ b/app/models/miq_widget_set.rb @@ -74,4 +74,8 @@ def self.find_with_same_order(ids) recs = where(:id => ids).index_by(&:id) ids.map { |id| recs[id.to_i] } end + + def self.display_name(number = 1) + n_('Dashboard', 'Dashboards', number) + end end diff --git a/app/models/miq_worker.rb b/app/models/miq_worker.rb index 9ce35f0d7ed3..36bfa4a1cafa 100644 --- a/app/models/miq_worker.rb +++ b/app/models/miq_worker.rb @@ -588,5 +588,10 @@ def self.nice_increment delta = worker_settings[:nice_delta] delta.kind_of?(Integer) ? delta.to_s : "+10" end + + def self.display_name(number = 1) + n_('Worker', 'Workers', number) + end + private_class_method :nice_increment end diff --git a/app/models/network_port.rb b/app/models/network_port.rb index 89897b633734..30e1f329c72d 100644 --- a/app/models/network_port.rb +++ b/app/models/network_port.rb @@ -61,6 +61,10 @@ def cloud_subnets_names end end + def self.display_name(number = 1) + n_('Network Port', 'Network Ports', number) + end + private def extra_attributes_save(key, value) diff --git a/app/models/network_router.rb b/app/models/network_router.rb index cc0dc56ed710..c7c67769efa8 100644 --- a/app/models/network_router.rb +++ b/app/models/network_router.rb @@ -49,6 +49,10 @@ def self.class_by_ems(ext_management_system) ext_management_system && ext_management_system.class::NetworkRouter end + def self.display_name(number = 1) + n_('Network Router', 'Network Routers', number) + end + private def extra_attributes_save(key, value) diff --git a/app/models/orchestration_stack.rb b/app/models/orchestration_stack.rb index a74d36ab56f1..c0662f731c9c 100644 --- a/app/models/orchestration_stack.rb +++ b/app/models/orchestration_stack.rb @@ -86,6 +86,10 @@ def stdout(format = nil) format.nil? ? try(:raw_stdout) : try(:raw_stdout, format) end + def self.display_name(number = 1) + n_('Orchestration Stack', 'Orchestration Stacks', number) + end + private :directs_and_indirects def self.create_stack(orchestration_manager, stack_name, template, options = {}) diff --git a/app/models/orchestration_template.rb b/app/models/orchestration_template.rb index 696a84bfe0ce..86bc1a5dd753 100644 --- a/app/models/orchestration_template.rb +++ b/app/models/orchestration_template.rb @@ -169,6 +169,10 @@ def save_as_orderable! new_record? ? replace_with_old_template(old_template) : transfer_stacks(old_template) end + def self.display_name(number = 1) + n_('Orchestration Template', 'Orchestration Templates', number) + end + private # This is an unsaved template. Replace with an existing one after it is updated diff --git a/app/models/persistent_volume.rb b/app/models/persistent_volume.rb index 7f2a2bbcd445..9dc1340eef3c 100644 --- a/app/models/persistent_volume.rb +++ b/app/models/persistent_volume.rb @@ -6,4 +6,8 @@ class PersistentVolume < ContainerVolume has_many :container_volumes, -> { where(:type => 'ContainerVolume') }, :through => :persistent_volume_claim has_many :parents, -> { distinct }, :through => :container_volumes, :source_type => 'ContainerGroup' alias_attribute :container_groups, :parents + + def self.display_name(number = 1) + n_('Persistent Volume', 'Persistent Volumes', number) + end end diff --git a/app/models/physical_server.rb b/app/models/physical_server.rb index fc5dee64c691..c0a43ae0eb47 100644 --- a/app/models/physical_server.rb +++ b/app/models/physical_server.rb @@ -90,4 +90,8 @@ def refresh_ems end EmsRefresh.queue_refresh(self) end + + def self.display_name(number = 1) + n_('Physical Server', 'Physical Servers', number) + end end diff --git a/app/models/policy_event.rb b/app/models/policy_event.rb index cc58e34dae1a..cb99cfe6433c 100644 --- a/app/models/policy_event.rb +++ b/app/models/policy_event.rb @@ -52,4 +52,8 @@ def miq_actions def miq_policy_sets contents.collect { |c| c.resource if c.resource.kind_of?(MiqPolicySet) }.compact end + + def self.display_name(number = 1) + n_('Policy Event', 'Policy Events', number) + end end diff --git a/app/models/pxe_image.rb b/app/models/pxe_image.rb index 1ecc48062c9f..d8b9afc448e5 100644 --- a/app/models/pxe_image.rb +++ b/app/models/pxe_image.rb @@ -59,6 +59,10 @@ def delete_files_on_server(pxe_server, mac_address) pxe_server.delete_file(filepath) end + def self.display_name(number = 1) + n_('PXE Image', 'PXE Images', number) + end + private def update_pxe_content_option(options, key, value) diff --git a/app/models/pxe_image_type.rb b/app/models/pxe_image_type.rb index 84579b322f1f..54e6d4335f72 100644 --- a/app/models/pxe_image_type.rb +++ b/app/models/pxe_image_type.rb @@ -30,4 +30,8 @@ def images def esx? name.to_s.downcase == 'esx' end + + def self.display_name(number = 1) + n_('System Image Type', 'System Image Types', number) + end end diff --git a/app/models/pxe_server.rb b/app/models/pxe_server.rb index 2a9e31c4b486..53fb6a28bf20 100644 --- a/app/models/pxe_server.rb +++ b/app/models/pxe_server.rb @@ -197,4 +197,8 @@ def delete_provisioning_files(pxe_image, mac_address, windows_image = nil, custo end _log.info("#{log_message}...Complete") end + + def self.display_name(number = 1) + n_('PXE Server', 'PXE Servers', number) + end end diff --git a/app/models/resource_pool.rb b/app/models/resource_pool.rb index 9c838871175a..aee647a22a48 100644 --- a/app/models/resource_pool.rb +++ b/app/models/resource_pool.rb @@ -199,4 +199,8 @@ def absolute_path_objs(*args) def absolute_path(*args) absolute_path_objs(*args).collect(&:name).join("/") end + + def self.display_name(number = 1) + n_('Resource Pool', 'Resource Pools', number) + end end diff --git a/app/models/scan_item.rb b/app/models/scan_item.rb index 5588b079af35..3b0e619ef24c 100644 --- a/app/models/scan_item.rb +++ b/app/models/scan_item.rb @@ -133,4 +133,8 @@ def self.add_elements(vm, xmlNode) end end end + + def self.display_name(number = 1) + n_('Scan Item', 'Scan Items', number) + end end diff --git a/app/models/scan_item_set.rb b/app/models/scan_item_set.rb index 73ced8228a65..6d0e8573f908 100644 --- a/app/models/scan_item_set.rb +++ b/app/models/scan_item_set.rb @@ -1,3 +1,7 @@ class ScanItemSet < ApplicationRecord acts_as_miq_set + + def self.display_name(number = 1) + n_('Analysis Profile', 'Analysis Profiles', number) + end end diff --git a/app/models/security_group.rb b/app/models/security_group.rb index d19764586ebc..65084575fc99 100644 --- a/app/models/security_group.rb +++ b/app/models/security_group.rb @@ -28,4 +28,8 @@ def self.class_by_ems(ext_management_system) # TODO: use a factory on ExtManagementSystem side to return correct class for each provider ext_management_system && ext_management_system.class::SecurityGroup end + + def self.display_name(number = 1) + n_('Security Group', 'Security Groups', number) + end end diff --git a/app/models/service.rb b/app/models/service.rb index bd2993198c66..3afb4a0768d9 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -435,6 +435,10 @@ def remove_from_service(parent_service) parent_service.remove_resource(self) end + def self.display_name(number = 1) + n_('Service', 'Services', number) + end + private def apply_dialog_settings diff --git a/app/models/service_template.rb b/app/models/service_template.rb index 3ff2139f426f..d81bbb7da0ea 100644 --- a/app/models/service_template.rb +++ b/app/models/service_template.rb @@ -402,6 +402,10 @@ def add_resource(rsc, options = {}) set_service_type end + def self.display_name(number = 1) + n_('Service Catalog Item', 'Service Catalog Items', number) + end + private def update_service_resources(config_info, auth_user = nil) diff --git a/app/models/service_template_catalog.rb b/app/models/service_template_catalog.rb index 02cba8c7700a..15cc0f51538c 100644 --- a/app/models/service_template_catalog.rb +++ b/app/models/service_template_catalog.rb @@ -7,4 +7,8 @@ class ServiceTemplateCatalog < ApplicationRecord has_many :service_templates, :dependent => :nullify acts_as_miq_taggable + + def self.display_name(number = 1) + n_('Catalog', 'Catalogs', number) + end end diff --git a/app/models/snapshot.rb b/app/models/snapshot.rb index f2acdac574eb..def32812fadc 100644 --- a/app/models/snapshot.rb +++ b/app/models/snapshot.rb @@ -94,6 +94,10 @@ def not_recently_created? !self.recently_created? end + def self.display_name(number = 1) + n_('Snapshot', 'Snapshots', number) + end + def self.xml_to_hashes(xmlNode, vm_or_template_id) return nil unless MiqXml.isXmlElement?(xmlNode) diff --git a/app/models/storage.rb b/app/models/storage.rb index 249ef3b1d2c6..cb5181d73387 100644 --- a/app/models/storage.rb +++ b/app/models/storage.rb @@ -848,4 +848,8 @@ def self.batch_operation_supported?(operation, ids) def self.supports?(store_type) Storage::SUPPORTED_STORAGE_TYPES.include?(store_type) end + + def self.display_name(number = 1) + n_('Datastore', 'Datastores', number) + end end diff --git a/app/models/storage_file.rb b/app/models/storage_file.rb index cdcb08dfa88f..2103f99b8f04 100644 --- a/app/models/storage_file.rb +++ b/app/models/storage_file.rb @@ -70,4 +70,8 @@ def is_directory? def v_size_numeric size.to_i end + + def self.display_name(number = 1) + n_('Datastore File', 'Datastore Files', number) + end end diff --git a/app/models/storage_performance.rb b/app/models/storage_performance.rb index eb8f6ded898e..89ad80c7d09d 100644 --- a/app/models/storage_performance.rb +++ b/app/models/storage_performance.rb @@ -2,4 +2,8 @@ class StoragePerformance < MetricRollup default_scope { where("resource_type = 'Storage' and resource_id IS NOT NULL") } belongs_to :storage, :foreign_key => :resource_id + + def self.display_name(number = 1) + n_('Performance - Datastore', 'Performance - Datastores', number) + end end diff --git a/app/models/switch.rb b/app/models/switch.rb index b49723022622..da23195d89e5 100644 --- a/app/models/switch.rb +++ b/app/models/switch.rb @@ -12,4 +12,8 @@ class Switch < ApplicationRecord scope :with_id, ->(id) { where(:id => id) } acts_as_miq_taggable + + def self.display_name(number = 1) + n_('Switch', 'Switches', number) + end end diff --git a/app/models/tenant.rb b/app/models/tenant.rb index 851cb12c25c7..1e0b2432d248 100644 --- a/app/models/tenant.rb +++ b/app/models/tenant.rb @@ -287,6 +287,10 @@ def allowed? Rbac::Filterer.filtered_object(self).present? end + def self.display_name(number = 1) + n_('Tenant', 'Tenants', number) + end + private # when a root tenant has an attribute with a nil value, diff --git a/app/models/time_profile.rb b/app/models/time_profile.rb index a37bd7a6d4b7..5853fde358d9 100644 --- a/app/models/time_profile.rb +++ b/app/models/time_profile.rb @@ -149,6 +149,10 @@ def match_user_tz?(user_id, user_tz) (profile_type == "user" && profile_key == user_id)) end + def self.display_name(number = 1) + n_('Time Profile', 'Time Profiles', number) + end + private def rebuild_daily_metrics_on_create diff --git a/app/models/user.rb b/app/models/user.rb index a283299d3144..39e655a0a377 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -315,6 +315,10 @@ def self.seed end end + def self.display_name(number = 1) + n_('User', 'Users', number) + end + def self.seed_file_name @seed_file_name ||= Rails.root.join("db", "fixtures", "#{table_name}.yml") end diff --git a/app/models/vim_performance_trend.rb b/app/models/vim_performance_trend.rb index a8d4bb745154..b5af28123a1b 100644 --- a/app/models/vim_performance_trend.rb +++ b/app/models/vim_performance_trend.rb @@ -269,4 +269,8 @@ def self.report_title(options) title end + + def self.display_name(number = 1) + n_('Performance Trend', 'Performance Trends', number) + end end diff --git a/app/models/vm.rb b/app/models/vm.rb index 067349fc8362..0af0e129c14f 100644 --- a/app/models/vm.rb +++ b/app/models/vm.rb @@ -121,6 +121,10 @@ def supported_consoles } end + def self.display_name(number = 1) + n_('VM and Instance', 'VMs and Instances', number) + end + private def vnc_support diff --git a/app/models/vm_or_template.rb b/app/models/vm_or_template.rb index 45e10f70aff7..e6447f5bc09e 100644 --- a/app/models/vm_or_template.rb +++ b/app/models/vm_or_template.rb @@ -1755,6 +1755,10 @@ def parent_resource parent end + def self.display_name(number = 1) + n_('VM or Template', 'VMs or Templates', number) + end + private def set_tenant_from_group diff --git a/app/models/vm_performance.rb b/app/models/vm_performance.rb index ad0e8820d27d..1bca8a14e85a 100644 --- a/app/models/vm_performance.rb +++ b/app/models/vm_performance.rb @@ -5,4 +5,8 @@ class VmPerformance < MetricRollup belongs_to :ems_cluster, :foreign_key => :parent_ems_cluster_id belongs_to :storage, :foreign_key => :parent_storage_id belongs_to :vm, :foreign_key => :resource_id, :class_name => 'VmOrTemplate' + + def self.display_name(number = 1) + n_('Performance - VM', 'Performance - VMs', number) + end end diff --git a/app/models/vmdb_index.rb b/app/models/vmdb_index.rb index 131369ce2a7c..84aa0373f033 100644 --- a/app/models/vmdb_index.rb +++ b/app/models/vmdb_index.rb @@ -15,4 +15,8 @@ class VmdbIndex < ApplicationRecord def my_metrics vmdb_metrics end + + def self.display_name(number = 1) + n_('Index', 'Indexes', number) + end end diff --git a/app/models/vmdb_table.rb b/app/models/vmdb_table.rb index 7cdc0b92af72..3459edc007b7 100644 --- a/app/models/vmdb_table.rb +++ b/app/models/vmdb_table.rb @@ -15,4 +15,8 @@ class VmdbTable < ApplicationRecord def my_metrics vmdb_metrics end + + def self.display_name(number = 1) + n_('Table', 'Tables', number) + end end diff --git a/app/models/windows_image.rb b/app/models/windows_image.rb index c984e69f6fcf..d63f288d0a7f 100644 --- a/app/models/windows_image.rb +++ b/app/models/windows_image.rb @@ -3,4 +3,8 @@ class WindowsImage < ApplicationRecord belongs_to :pxe_image_type has_many :customization_templates, :through => :pxe_image_type + + def self.display_name(number = 1) + n_('Windows Image', 'Windows Images', number) + end end diff --git a/app/models/zone.rb b/app/models/zone.rb index b4dd26599a7a..b102ed6c1770 100644 --- a/app/models/zone.rb +++ b/app/models/zone.rb @@ -192,6 +192,10 @@ def ntp_reload_queue servers.each(&:ntp_reload_queue) end + def self.display_name(number = 1) + n_('Zone', 'Zones', number) + end + protected def check_zone_in_use_on_destroy