diff --git a/app/models/availability_zone.rb b/app/models/availability_zone.rb index 630caf7baaf..82af032ae1a 100644 --- a/app/models/availability_zone.rb +++ b/app/models/availability_zone.rb @@ -4,6 +4,7 @@ class AvailabilityZone < ApplicationRecord include Metric::CiMixin include EventMixin include ProviderObjectMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/cloud_network.rb b/app/models/cloud_network.rb index fbfb2cce117..887fcc4dc17 100644 --- a/app/models/cloud_network.rb +++ b/app/models/cloud_network.rb @@ -2,6 +2,7 @@ class CloudNetwork < ApplicationRecord include NewWithTypeStiMixin include SupportsFeatureMixin include CloudTenancyMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/cloud_object_store_container.rb b/app/models/cloud_object_store_container.rb index 47d1d94a1d1..642a01838fa 100644 --- a/app/models/cloud_object_store_container.rb +++ b/app/models/cloud_object_store_container.rb @@ -10,6 +10,7 @@ class CloudObjectStoreContainer < ApplicationRecord include NewWithTypeStiMixin include ProcessTasksMixin include SupportsFeatureMixin + include CustomActionsMixin include_concern 'Operations' diff --git a/app/models/cloud_subnet.rb b/app/models/cloud_subnet.rb index e42c202206d..8762ab1e8d3 100644 --- a/app/models/cloud_subnet.rb +++ b/app/models/cloud_subnet.rb @@ -2,6 +2,7 @@ class CloudSubnet < ApplicationRecord include NewWithTypeStiMixin include SupportsFeatureMixin include CloudTenancyMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/cloud_tenant.rb b/app/models/cloud_tenant.rb index 4042d0d1902..1fa881695ed 100644 --- a/app/models/cloud_tenant.rb +++ b/app/models/cloud_tenant.rb @@ -3,6 +3,7 @@ class CloudTenant < ApplicationRecord TENANT_MAPPING_ASSOCIATIONS = %i(vms_and_templates).freeze include NewWithTypeStiMixin + include CustomActionsMixin extend ActsAsTree::TreeWalker belongs_to :ext_management_system, :foreign_key => "ems_id" diff --git a/app/models/cloud_volume.rb b/app/models/cloud_volume.rb index 5331da891b0..13e79e13528 100644 --- a/app/models/cloud_volume.rb +++ b/app/models/cloud_volume.rb @@ -7,6 +7,7 @@ class CloudVolume < ApplicationRecord include AvailabilityMixin include SupportsFeatureMixin include CloudTenancyMixin + include CustomActionsMixin belongs_to :ext_management_system, :foreign_key => :ems_id, :class_name => "ExtManagementSystem" belongs_to :availability_zone diff --git a/app/models/container_group.rb b/app/models/container_group.rb index c48f05a7eca..d63f4599b72 100644 --- a/app/models/container_group.rb +++ b/app/models/container_group.rb @@ -6,6 +6,7 @@ class ContainerGroup < ApplicationRecord include NewWithTypeStiMixin include TenantIdentityMixin include ArchivedMixin + include CustomActionsMixin include_concern 'Purging' # :name, :uid, :creation_timestamp, :resource_version, :namespace diff --git a/app/models/container_image.rb b/app/models/container_image.rb index bf5f7c32aeb..c8b78f83bbf 100644 --- a/app/models/container_image.rb +++ b/app/models/container_image.rb @@ -6,6 +6,7 @@ class ContainerImage < ApplicationRecord include CustomAttributeMixin include ArchivedMixin include NewWithTypeStiMixin + include CustomActionsMixin include_concern 'Purging' DOCKER_IMAGE_PREFIX = "docker://" diff --git a/app/models/container_node.rb b/app/models/container_node.rb index 5e351a0a79a..400a5b1a017 100644 --- a/app/models/container_node.rb +++ b/app/models/container_node.rb @@ -7,6 +7,7 @@ class ContainerNode < ApplicationRecord include SupportsFeatureMixin include ArchivedMixin include CockpitMixin + include CustomActionsMixin include_concern 'Purging' EXTERNAL_LOGGING_PATH = "/#/discover?_g=()&_a=(columns:!(hostname,level,kubernetes.pod_name,message),filters:!((meta:(disabled:!f,index:'%{index}',key:hostname,negate:!f),%{query})),index:'%{index}',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'*')),sort:!(time,desc))".freeze diff --git a/app/models/container_project.rb b/app/models/container_project.rb index d6f1ac5010c..addc703e831 100644 --- a/app/models/container_project.rb +++ b/app/models/container_project.rb @@ -2,6 +2,7 @@ class ContainerProject < ApplicationRecord include SupportsFeatureMixin include CustomAttributeMixin include ArchivedMixin + include CustomActionsMixin include_concern 'Purging' belongs_to :ext_management_system, :foreign_key => "ems_id" has_many :container_groups, -> { active } diff --git a/app/models/container_template.rb b/app/models/container_template.rb index 9166bd9f7f3..172d2eba6de 100644 --- a/app/models/container_template.rb +++ b/app/models/container_template.rb @@ -1,5 +1,6 @@ class ContainerTemplate < ApplicationRecord include CustomAttributeMixin + include CustomActionsMixin belongs_to :ext_management_system, :foreign_key => "ems_id" belongs_to :container_project diff --git a/app/models/container_volume.rb b/app/models/container_volume.rb index 4254ac8b84c..8844518e7bd 100644 --- a/app/models/container_volume.rb +++ b/app/models/container_volume.rb @@ -1,4 +1,5 @@ class ContainerVolume < ApplicationRecord + include CustomActionsMixin acts_as_miq_taggable belongs_to :parent, :polymorphic => true belongs_to :persistent_volume_claim, :dependent => :destroy diff --git a/app/models/ems_cluster.rb b/app/models/ems_cluster.rb index e1a1eb123e4..cb6784f51ca 100644 --- a/app/models/ems_cluster.rb +++ b/app/models/ems_cluster.rb @@ -4,6 +4,7 @@ class EmsCluster < ApplicationRecord include_concern 'CapacityPlanning' include EventMixin include TenantIdentityMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index cd32c4c9f9b..eda5beb144e 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -1,4 +1,6 @@ class ExtManagementSystem < ApplicationRecord + include CustomActionsMixin + def self.types leaf_subclasses.collect(&:ems_type) end diff --git a/app/models/host.rb b/app/models/host.rb index 5ea0e5e78ce..10ddaa77ff3 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -11,6 +11,7 @@ class Host < ApplicationRecord include NewWithTypeStiMixin include TenantIdentityMixin include DeprecationMixin + include CustomActionsMixin VENDOR_TYPES = { # DB Displayed diff --git a/app/models/load_balancer.rb b/app/models/load_balancer.rb index 8da32fbdd85..0fa0662a99d 100644 --- a/app/models/load_balancer.rb +++ b/app/models/load_balancer.rb @@ -5,6 +5,7 @@ class LoadBalancer < ApplicationRecord include RetirementMixin include TenantIdentityMixin include CloudTenancyMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/miq_group.rb b/app/models/miq_group.rb index c53597f52d1..8848c21f4df 100644 --- a/app/models/miq_group.rb +++ b/app/models/miq_group.rb @@ -36,6 +36,7 @@ class MiqGroup < ApplicationRecord include ActiveVmAggregationMixin include TimezoneMixin include TenancyMixin + include CustomActionsMixin alias_method :current_tenant, :tenant diff --git a/app/models/miq_template.rb b/app/models/miq_template.rb index 64719b7860f..c5cb2ffb997 100644 --- a/app/models/miq_template.rb +++ b/app/models/miq_template.rb @@ -1,4 +1,6 @@ class MiqTemplate < VmOrTemplate + include CustomActionsMixin + default_scope { where(:template => true) } include_concern 'Operations' diff --git a/app/models/mixins/custom_actions_mixin.rb b/app/models/mixins/custom_actions_mixin.rb index b8bd515a262..615d0710444 100644 --- a/app/models/mixins/custom_actions_mixin.rb +++ b/app/models/mixins/custom_actions_mixin.rb @@ -48,6 +48,6 @@ def serialize_button(button) end def generic_custom_buttons - raise "called abstract method generic_custom_buttons" + CustomButton.buttons_for(self.class.name) end end diff --git a/app/models/network_router.rb b/app/models/network_router.rb index 723254979a7..cc0dc56ed71 100644 --- a/app/models/network_router.rb +++ b/app/models/network_router.rb @@ -2,6 +2,7 @@ class NetworkRouter < ApplicationRecord include NewWithTypeStiMixin include SupportsFeatureMixin include CloudTenancyMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/orchestration_stack.rb b/app/models/orchestration_stack.rb index e5290e36cd5..a74d36ab56f 100644 --- a/app/models/orchestration_stack.rb +++ b/app/models/orchestration_stack.rb @@ -7,6 +7,7 @@ class OrchestrationStack < ApplicationRecord include ProcessTasksMixin include RetirementMixin include TenantIdentityMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/security_group.rb b/app/models/security_group.rb index e94ecbc2f69..d19764586eb 100644 --- a/app/models/security_group.rb +++ b/app/models/security_group.rb @@ -2,6 +2,7 @@ class SecurityGroup < ApplicationRecord include NewWithTypeStiMixin include SupportsFeatureMixin include CloudTenancyMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/storage.rb b/app/models/storage.rb index cab026d0980..548f75be774 100644 --- a/app/models/storage.rb +++ b/app/models/storage.rb @@ -41,6 +41,7 @@ class Storage < ApplicationRecord include AsyncDeleteMixin include AvailabilityMixin include TenantIdentityMixin + include CustomActionsMixin virtual_column :v_used_space, :type => :integer virtual_column :v_used_space_percent_of_total, :type => :integer diff --git a/app/models/switch.rb b/app/models/switch.rb index 266964f55e0..b4972302262 100644 --- a/app/models/switch.rb +++ b/app/models/switch.rb @@ -1,4 +1,6 @@ class Switch < ApplicationRecord + include CustomActionsMixin + has_many :host_switches, :dependent => :destroy has_many :hosts, :through => :host_switches diff --git a/app/models/tenant.rb b/app/models/tenant.rb index 176c6afc574..7f9771f2c31 100644 --- a/app/models/tenant.rb +++ b/app/models/tenant.rb @@ -6,6 +6,7 @@ class Tenant < ApplicationRecord DEFAULT_URL = nil include ActiveVmAggregationMixin + include CustomActionsMixin acts_as_miq_taggable diff --git a/app/models/user.rb b/app/models/user.rb index b97b8f200d8..378bf909d26 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,6 +5,7 @@ class User < ApplicationRecord include CustomAttributeMixin include ActiveVmAggregationMixin include TimezoneMixin + include CustomActionsMixin has_many :miq_approvals, :as => :approver has_many :miq_approval_stamps, :class_name => "MiqApproval", :foreign_key => :stamper_id diff --git a/app/models/vm.rb b/app/models/vm.rb index e338943511f..c24652bf60b 100644 --- a/app/models/vm.rb +++ b/app/models/vm.rb @@ -112,8 +112,4 @@ def remote_console_url=(url, user_id) ) console.id end - - def generic_custom_buttons - CustomButton.buttons_for("Vm") - end end