-
Notifications
You must be signed in to change notification settings - Fork 356
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
Add class decorator support #237
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
de35610
Add class decorator support
himdel 304bc4e
MiqDecorator - a superclass for all our decorators
himdel 8562276
Replace Draper by implementing instance.decorate the same as class.de…
himdel 900e2a1
MiqDecorator - move the logic to find the right decorator class to Mi…
himdel 88d2b39
Replace .decorator_class? with .decorate
himdel 14462aa
Decorators - inherit from MiqDecorator instead of Draper::Decorator
himdel ce35a6b
fix decorate to handle missing decorator class
himdel 85447ce
decorators - fix wrongly namespaced decorators
himdel 8e3f93d
Rename initializer to decorate, since it no longer deals only with cl…
himdel ab54a9a
Move `decorate` method defs to MiqDecorator::Instance and MiqDecorato…
himdel 5c1fec0
MiqDecorator - specs
himdel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
class HostDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
class HostDecorator < MiqDecorator | ||
def fonticon | ||
nil | ||
end | ||
|
16 changes: 8 additions & 8 deletions
16
...ors/manageiq/providers/ansible_tower/automation_manager/configuration_script_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::ConfigurationScriptDecorator < Draper::Decorator | ||
delegate_all | ||
module ManageIQ::Providers::AnsibleTower | ||
class AutomationManager::ConfigurationScriptDecorator < MiqDecorator | ||
def fonticon | ||
'product product-template' | ||
end | ||
|
||
def fonticon | ||
'product product-template'.freeze | ||
end | ||
|
||
def listicon_image | ||
'100/configuration_script.png' | ||
def listicon_image | ||
'100/configuration_script.png' | ||
end | ||
end | ||
end |
16 changes: 8 additions & 8 deletions
16
app/decorators/manageiq/providers/ansible_tower/automation_manager/job_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::JobDecorator < Draper::Decorator | ||
delegate_all | ||
module ManageIQ::Providers::AnsibleTower | ||
class AutomationManager::JobDecorator < MiqDecorator | ||
def fonticon | ||
'product product-orchestration_stack' | ||
end | ||
|
||
def fonticon | ||
'product product-orchestration_stack'.freeze | ||
end | ||
|
||
def listicon_image | ||
'100/orchestration_stack.png' | ||
def listicon_image | ||
'100/orchestration_stack.png' | ||
end | ||
end | ||
end |
16 changes: 8 additions & 8 deletions
16
app/decorators/manageiq/providers/ansible_tower/automation_manager/playbook_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class ManageIQ::Providers::AnsibleTower::AutomationManager::PlaybookDecorator < Draper::Decorator | ||
delegate_all | ||
module ManageIQ::Providers::AnsibleTower | ||
class AutomationManager::PlaybookDecorator < MiqDecorator | ||
def fonticon | ||
nil | ||
end | ||
|
||
def fonticon | ||
nil | ||
end | ||
|
||
def listicon_image | ||
'svg/vendor-ansible_tower_automation.svg' | ||
def listicon_image | ||
'svg/vendor-ansible_tower_automation.svg' | ||
end | ||
end | ||
end |
16 changes: 8 additions & 8 deletions
16
app/decorators/manageiq/providers/automation_manager/inventory_group_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class ManageIQ::Providers::AutomationManager::InventoryGroupDecorator < Draper::Decorator | ||
delegate_all | ||
module ManageIQ::Providers::AutomationManager | ||
class InventoryGroupDecorator < MiqDecorator | ||
def fonticon | ||
'pficon pficon-folder-close' | ||
end | ||
|
||
def fonticon | ||
'pficon pficon-folder-close'.freeze | ||
end | ||
|
||
def listicon_image | ||
'100/inventory_group.png' | ||
def listicon_image | ||
'100/inventory_group.png' | ||
end | ||
end | ||
end |
16 changes: 8 additions & 8 deletions
16
app/decorators/manageiq/providers/automation_manager/inventory_root_group_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class ManageIQ::Providers::AutomationManager::InventoryRootGroupDecorator < Draper::Decorator | ||
delegate_all | ||
module ManageIQ::Providers::AutomationManager | ||
class InventoryRootGroupDecorator < MiqDecorator | ||
def fonticon | ||
'pficon pficon-folder-close' | ||
end | ||
|
||
def fonticon | ||
'pficon pficon-folder-close'.freeze | ||
end | ||
|
||
def listicon_image | ||
'100/inventory_group.png' | ||
def listicon_image | ||
'100/inventory_group.png' | ||
end | ||
end | ||
end |
4 changes: 1 addition & 3 deletions
4
app/decorators/manageiq/providers/automation_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
app/decorators/manageiq/providers/cloud_manager/orchestration_stack_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
class ManageIQ::Providers::CloudManager::OrchestrationStackDecorator < Draper::Decorator | ||
def fonticon | ||
'product product-orchestration_stack'.freeze | ||
end | ||
module ManageIQ::Providers | ||
class CloudManager::OrchestrationStackDecorator < MiqDecorator | ||
def fonticon | ||
'product product-orchestration_stack' | ||
end | ||
|
||
def listicon_image | ||
"100/orchestration_stack.png" | ||
def listicon_image | ||
"100/orchestration_stack.png" | ||
end | ||
end | ||
end |
4 changes: 1 addition & 3 deletions
4
app/decorators/manageiq/providers/configuration_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/decorators/manageiq/providers/hawkular/middleware_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
app/decorators/manageiq/providers/kubernetes/container_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ManageIQ::Providers::Kubernetes::ContainerManagerDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
def listicon_image | ||
"svg/vendor-kubernetes.svg" | ||
module ManageIQ::Providers::Kubernetes | ||
class ContainerManagerDecorator < MiqDecorator | ||
def listicon_image | ||
"svg/vendor-kubernetes.svg" | ||
end | ||
end | ||
end |
10 changes: 5 additions & 5 deletions
10
app/decorators/manageiq/providers/openshift/container_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ManageIQ::Providers::Openshift::ContainerManagerDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
def listicon_image | ||
"svg/vendor-openshift.svg" | ||
module ManageIQ::Providers::Openshift | ||
class ContainerManagerDecorator < MiqDecorator | ||
def listicon_image | ||
"svg/vendor-openshift.svg" | ||
end | ||
end | ||
end |
10 changes: 5 additions & 5 deletions
10
app/decorators/manageiq/providers/openshift_enterprise/container_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ManageIQ::Providers::OpenshiftEnterprise::ContainerManagerDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
def listicon_image | ||
"svg/vendor-openshift_enterprise.svg" | ||
module ManageIQ::Providers::OpenshiftEnterprise | ||
class ContainerManagerDecorator < MiqDecorator | ||
def listicon_image | ||
"svg/vendor-openshift_enterprise.svg" | ||
end | ||
end | ||
end |
10 changes: 5 additions & 5 deletions
10
app/decorators/manageiq/providers/storage_manager/cinder_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ManageIQ::Providers::StorageManager::CinderManagerDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
def listicon_image | ||
"svg/vendor-openstack.svg" | ||
module ManageIQ::Providers | ||
class StorageManager::CinderManagerDecorator < MiqDecorator | ||
def listicon_image | ||
"svg/vendor-openstack.svg" | ||
end | ||
end | ||
end |
10 changes: 5 additions & 5 deletions
10
app/decorators/manageiq/providers/storage_manager/swift_manager_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ManageIQ::Providers::StorageManager::SwiftManagerDecorator < Draper::Decorator | ||
delegate_all | ||
|
||
def listicon_image | ||
"svg/vendor-openstack.svg" | ||
module ManageIQ::Providers | ||
class StorageManager::SwiftManagerDecorator < MiqDecorator | ||
def listicon_image | ||
"svg/vendor-openstack.svg" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my other comments addressed, this now becomes a non-patched call, entirely dependent on the UI's own code, with
MiqDecorator.decorate(item)
. You of course can feel free to create a top level controller helper likedecorate_model
that does the same thing withoutMiqDecorator
explicitly.