Skip to content

Commit

Permalink
Merge pull request #16371 from d-m-u/refactor_generic_custom_button_i…
Browse files Browse the repository at this point in the history
…n_custom_action_mixin

Refactors custom action mixin method
  • Loading branch information
gmcculloug authored Nov 1, 2017
2 parents 425e8fa + 029abc9 commit aea2443
Show file tree
Hide file tree
Showing 27 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/models/availability_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class AvailabilityZone < ApplicationRecord
include Metric::CiMixin
include EventMixin
include ProviderObjectMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/cloud_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class CloudNetwork < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/cloud_object_store_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class CloudObjectStoreContainer < ApplicationRecord
include NewWithTypeStiMixin
include ProcessTasksMixin
include SupportsFeatureMixin
include CustomActionsMixin

include_concern 'Operations'

Expand Down
1 change: 1 addition & 0 deletions app/models/cloud_subnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class CloudSubnet < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/cloud_tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions app/models/cloud_volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/container_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/container_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ContainerImage < ApplicationRecord
include CustomAttributeMixin
include ArchivedMixin
include NewWithTypeStiMixin
include CustomActionsMixin
include_concern 'Purging'

DOCKER_IMAGE_PREFIX = "docker://"
Expand Down
1 change: 1 addition & 0 deletions app/models/container_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/container_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions app/models/container_template.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ContainerTemplate < ApplicationRecord
include CustomAttributeMixin
include CustomActionsMixin

belongs_to :ext_management_system, :foreign_key => "ems_id"
belongs_to :container_project
Expand Down
1 change: 1 addition & 0 deletions app/models/container_volume.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/ems_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class EmsCluster < ApplicationRecord
include_concern 'CapacityPlanning'
include EventMixin
include TenantIdentityMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
2 changes: 2 additions & 0 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ExtManagementSystem < ApplicationRecord
include CustomActionsMixin

def self.types
leaf_subclasses.collect(&:ems_type)
end
Expand Down
1 change: 1 addition & 0 deletions app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Host < ApplicationRecord
include NewWithTypeStiMixin
include TenantIdentityMixin
include DeprecationMixin
include CustomActionsMixin

VENDOR_TYPES = {
# DB Displayed
Expand Down
1 change: 1 addition & 0 deletions app/models/load_balancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class LoadBalancer < ApplicationRecord
include RetirementMixin
include TenantIdentityMixin
include CloudTenancyMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/miq_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MiqGroup < ApplicationRecord
include ActiveVmAggregationMixin
include TimezoneMixin
include TenancyMixin
include CustomActionsMixin

alias_method :current_tenant, :tenant

Expand Down
2 changes: 2 additions & 0 deletions app/models/miq_template.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class MiqTemplate < VmOrTemplate
include CustomActionsMixin

default_scope { where(:template => true) }

include_concern 'Operations'
Expand Down
2 changes: 1 addition & 1 deletion app/models/mixins/custom_actions_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions app/models/network_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class NetworkRouter < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/orchestration_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class OrchestrationStack < ApplicationRecord
include ProcessTasksMixin
include RetirementMixin
include TenantIdentityMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/security_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class SecurityGroup < ApplicationRecord
include NewWithTypeStiMixin
include SupportsFeatureMixin
include CloudTenancyMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/models/switch.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Switch < ApplicationRecord
include CustomActionsMixin

has_many :host_switches, :dependent => :destroy
has_many :hosts, :through => :host_switches

Expand Down
1 change: 1 addition & 0 deletions app/models/tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Tenant < ApplicationRecord
DEFAULT_URL = nil

include ActiveVmAggregationMixin
include CustomActionsMixin

acts_as_miq_taggable

Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions app/models/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,4 @@ def remote_console_url=(url, user_id)
)
console.id
end

def generic_custom_buttons
CustomButton.buttons_for("Vm")
end
end

0 comments on commit aea2443

Please sign in to comment.