Class: Kanaui::ReportsController
- Inherits:
-
EngineController
- Object
- EngineController
- Kanaui::ReportsController
- Defined in:
- app/controllers/kanaui/reports_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #refresh ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/kanaui/reports_controller.rb', line 20 def create Kanaui::DashboardHelper::DashboardApi.create_report(report_from_params.to_json, ) redirect_to_index_with_notice(:created) end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'app/controllers/kanaui/reports_controller.rb', line 38 def destroy Kanaui::DashboardHelper::DashboardApi.delete_report(params.require(:id), ) redirect_to_index_with_notice(:deleted) end |
#edit ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/kanaui/reports_controller.rb', line 14 def edit @report = JSON.parse(Kanaui::DashboardHelper::DashboardApi.available_reports()) .find { |x| x['reportName'] == params.require(:id) } .deep_symbolize_keys end |
#index ⇒ Object
5 6 7 8 |
# File 'app/controllers/kanaui/reports_controller.rb', line 5 def index @reports = JSON.parse(Kanaui::DashboardHelper::DashboardApi.available_reports()).map(&:deep_symbolize_keys) @report_notice = report_notice_from_flash end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/kanaui/reports_controller.rb', line 10 def new @report = {} end |
#refresh ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/kanaui/reports_controller.rb', line 32 def refresh Kanaui::DashboardHelper::DashboardApi.refresh_report(params.require(:id), ) redirect_to_index_with_notice(:refresh_scheduled) end |
#update ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/kanaui/reports_controller.rb', line 26 def update Kanaui::DashboardHelper::DashboardApi.update_report(params.require(:id), report_from_params.to_json, ) redirect_to_index_with_notice(:updated) end |