Skip to content

Commit

Permalink
Merge pull request #23074 from liu-samuel/annotations-summary-page
Browse files Browse the repository at this point in the history
Add has_many for annotations custom attribute each summary page that contains labels
  • Loading branch information
agrare committed Jul 10, 2024
2 parents f133c62 + 2cbd5fb commit 5f2d274
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/container_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class ContainerGroup < ApplicationRecord
has_many :containers, :dependent => :destroy
has_many :container_images, -> { distinct }, :through => :containers
belongs_to :ext_management_system, :foreign_key => "ems_id"
has_many :annotations, -> { where(:section => "annotations") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
:inverse_of => :resource
has_many :labels, -> { where(:section => "labels") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
Expand Down
4 changes: 4 additions & 0 deletions app/models/container_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class ContainerNode < ApplicationRecord
has_many :container_services, -> { distinct }, :through => :container_groups
has_many :container_routes, -> { distinct }, :through => :container_services
has_many :container_replicators, -> { distinct }, :through => :container_groups
has_many :annotations, -> { where(:section => "annotations") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
:inverse_of => :resource
has_many :labels, -> { where(:section => "labels") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
Expand Down
4 changes: 4 additions & 0 deletions app/models/container_replicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ class ContainerReplicator < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id"
has_many :container_groups
belongs_to :container_project
has_many :annotations, -> { where(:section => "annotations") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
:inverse_of => :resource
has_many :labels, -> { where(:section => "labels") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
Expand Down
4 changes: 4 additions & 0 deletions app/models/container_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class ContainerRoute < ApplicationRecord
belongs_to :container_service
has_many :container_nodes, -> { distinct }, :through => :container_service
has_many :container_groups, -> { distinct }, :through => :container_service
has_many :annotations, -> { where(:section => "annotations") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
:inverse_of => :resource
has_many :labels, -> { where(:section => "labels") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
Expand Down
4 changes: 4 additions & 0 deletions app/models/container_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class ContainerService < ApplicationRecord
has_many :container_routes
has_many :container_service_port_configs, :dependent => :destroy
belongs_to :container_project
has_many :annotations, -> { where(:section => "annotations") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
:inverse_of => :resource
has_many :labels, -> { where(:section => "labels") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
Expand Down
4 changes: 4 additions & 0 deletions app/models/container_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class ContainerTemplate < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id"
belongs_to :container_project
has_many :container_template_parameters, :dependent => :destroy
has_many :annotations, -> { where(:section => "annotations") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
:inverse_of => :resource
has_many :labels, -> { where(:section => "labels") }, # rubocop:disable Rails/HasManyOrHasOneDependent
:class_name => "CustomAttribute",
:as => :resource,
Expand Down

0 comments on commit 5f2d274

Please sign in to comment.