Last active
April 8, 2019 14:36
-
-
Save adamruzicka/2448651e379ec7e9f82be6a7d64a4080 to your computer and use it in GitHub Desktop.
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
# app/lib/actions/my_action.rb | |
module Actions | |
class FailAction < Actions::EntryAction | |
def run | |
error! "This is an error" | |
end | |
def troubleshooting_info | |
ForemanTasks::TroubleshootingHelpGenerator::Info.new.tap do |i| | |
i.add_line _('This task requires special handling.') | |
i.add_link(ForemanTasks::TroubleshootingHelpGenerator::Link.new( | |
name: :custom_link, | |
title: _('custom link inner'), | |
href: "/additional_troubleshooting_page/myaction", | |
description: _("Investigate %{link} on more details for this custom error. FailAction") | |
)) | |
end | |
end | |
end | |
class SuccessfulParentAction < Actions::EntryAction | |
def plan | |
plan_self | |
plan_action MyAction | |
end | |
def run | |
end | |
def troubleshooting_info | |
ForemanTasks::TroubleshootingHelpGenerator::Info.new.tap do |i| | |
i.add_line _('This task requires special handling. Handle with care.') | |
i.add_link(ForemanTasks::TroubleshootingHelpGenerator::Link.new( | |
name: :custom_link, | |
title: _('custom link'), | |
href: "/additional_troubleshooting_page/", | |
description: _("Investigate %{link} on more details for this custom error. SuccessfulParentAction") | |
)) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment