Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service display has been renamed to visible. #19211

Merged
merged 2 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Service < ApplicationRecord
include CiFeatureMixin
include CustomActionsMixin
include CustomAttributeMixin
include DeprecationMixin
include ExternalUrlMixin
include LifecycleMixin
include Metric::CiMixin
Expand Down Expand Up @@ -108,6 +109,7 @@ class Service < ApplicationRecord
alias parent_service parent
alias_attribute :service, :parent
virtual_belongs_to :service
deprecate_attribute :display, :visible
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lfu Does deprecate_attribute allow visible to be exposed through the Automate service model?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecate_attribute calls virtual_attribute that would allow visible to be exposed to automate.


def power_states
vms.map(&:power_state)
Expand Down
10 changes: 7 additions & 3 deletions app/models/service_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,18 @@ def config_info

def create_service(service_task, parent_svc = nil)
nh = attributes.dup

# Service#display was renamed to #visible in https://github.com/ManageIQ/manageiq-schema/pull/410
nh['visible'] = nh.delete('display') if nh.key?('display')

nh['options'][:dialog] = service_task.options[:dialog]
(nh.keys - Service.column_names + %w(created_at guid service_template_id updated_at id type prov_type)).each { |key| nh.delete(key) }

# Hide child services by default
nh['display'] = false if parent_svc
nh['visible'] = false if parent_svc

# If display is nil, set it to false
nh['display'] ||= false
# If visible is nil, set it to false
nh['visible'] ||= false

# convert template class name to service class name by naming convention
nh['type'] = self.class.name.sub('Template', '')
Expand Down