insights: API modifications to support Limited Access Mode
Created by: CristinaBirkel
High level summary: we will add some logic in the backend API mutations for creating insights that will ensure they are attached to a global dashboard if needed, in Limited Access Mode.
Details:
- Add a new column to the
dashboardtable calledtypewhich we can use to denote that a dashboard is this specific auto-created LAM dashboard. I think this might be more generally useful than a boolean field foris_lam_dashboard, if we end up with other kinds of special dashboard types that we want to keep track of. Thoughts? - Update the
createLineChartSearchInsightandcreatePieChartSearchInsightmutations to do the following: a. Check for LAM. If not LAM, proceed as normal, but if LAM:- Are 2 insights already unfrozen?
- Return an error message. Cannot create any more than 2 insights in LAM.
- Is this insight being attached to a non-global dashboard?
- Return an error message. Can only create global insights in LAM.
- Otherwise, create the insight as normal.
- If the LAM dashboard doesn't exist, create it.
- Attach the insight to the LAM dashboard.
- Are 2 insights already unfrozen?
- Update the
deleteInsightsDashboardmutation to do the following: a. If in LAM:- Do not allow the user to delete the LAM dashboard.