This repository has been archived by the owner on Oct 9, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref #9492 - serve gutterball reports
- Loading branch information
1 parent
3c84b55
commit e6b1bc1
Showing
13 changed files
with
201 additions
and
60 deletions.
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
Empty file.
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
20 changes: 20 additions & 0 deletions
20
app/lib/actions/foreman_gutterball/content_reports/report.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Actions | ||
module ForemanGutterball | ||
module ContentReports | ||
class Report < Actions::EntryAction | ||
def plan(report_type, params) | ||
plan_self(:report_type => report_type, :params => params) | ||
end | ||
|
||
def run | ||
service = ::ForemanGutterball::GutterballService.new | ||
output[:report_data] = service.report(input[:report_type], input[:params]) | ||
end | ||
|
||
def humanized_output | ||
'' | ||
end | ||
end | ||
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
foreman_gutterball: | ||
url: https://localhost:8443/gutterball |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module ForemanGutterball | ||
module Apipie | ||
module Validators | ||
class DateValidator < ::Apipie::Validator::BaseValidator | ||
def initialize(param_description, argument) | ||
super(param_description) | ||
@type = argument | ||
end | ||
|
||
def validate(value) | ||
return false if value.nil? | ||
return false unless value =~ /\A\d{4}(-\d{1,2}){2}\z/ | ||
begin | ||
Date.parse(value) # make sure this is a valid date and not 2015-02-45, etc. | ||
rescue | ||
return false | ||
end | ||
true | ||
end | ||
|
||
def self.build(param_description, argument, _options, _block) | ||
if argument == Date | ||
new(param_description, argument) | ||
end | ||
end | ||
|
||
def description | ||
"Must be a #{@type} in the form of YYYY-MM-DD." | ||
end | ||
end | ||
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