framework icon indicating copy to clipboard operation
framework copied to clipboard

Directory Route: Move needed actions to consumers and subroutes

Open mtgraham opened this issue 6 years ago • 0 comments

Problem: The new directory route does not have the actions defined that are required for the navi-actions-list and dashboard-actions-list components.

These actions are defined as actions in the reports and dashboards routes.

Simple Solution: Add all route actions from reports and dashboards routes to the directory route.

Problems with this solution:

  • Fills the directory route with route-actions used for deleting reports/dashboards and handling their delivery rules
  • Multiple copies of these same actions will be necessary to support use in the report/dashboard view as well as in the directory view
    • E.g. deleteReport will be an action defined in the directory route and the reports route.
    • This wouldn’t be a problem if the report view route was a child of the directory route, but that isn’t necessarily a good solution either.

Solution to avoid these problems: Create consumers to handle any report or dashboard actions (this will just include their deletion actions for now) and create a subroute for the schedule modal that will contain the actions needed for handling delivery rules.

Necessary changes:

  • Two new action consumers
    • navi-reports/consumers/report/report
    • navi-dashboards/consumers/dashboard/dashboard
  • One new action dispatcher service
    • navi-reports/services/report-action-dispatcher (Already exists, will just register new consumer with this)
    • navi-dashboards/services/dashboard-action-dispatcher
  • Two new helpers
    • navi-dashboards/helpers/dashboard-action
      • Validates an action name and then passes it to dashboard-action-dispatcher for dispatching
    • navi-reports/helpers/report-action
      • This helper already exists, but the existing helper will be renamed to “update-report-action”. This is because the existing helper sends an action to the route that will dispatch when the route-action “onUpdateReport” is called.
      • Validates an action name and then passes it to report-action-dispatcher for immediate dispatching
  • One new route
    • navi-reports/routes/schedule
      • Will use the routable modal from liquid-tether and contain all the delivery-rule actions

UPDATE: We are going to consolidate the report/dashboard action dispatchers, consumers, and helpers into one since they only handle the delete action for reports/dashboards and that action is identical for both. We will call these item-action-dispatcher.js, item.js, and item-action.js.

mtgraham avatar Aug 21 '18 18:08 mtgraham