kgabryje commented on a change in pull request #17570:
URL: https://github.com/apache/superset/pull/17570#discussion_r763778818
##########
File path: superset-frontend/src/dashboard/actions/dashboardState.js
##########
@@ -194,52 +196,176 @@ export function saveDashboardRequest(data, id, saveType)
{
const serializedFilters = serializeActiveFilterValues(getActiveFilters());
// serialize filter scope for each filter field, grouped by filter id
const serializedFilterScopes = serializeFilterScopes(dashboardFilters);
+ const {
+ certified_by,
+ certification_details,
+ css,
+ dashboard_title,
+ owners,
+ roles,
+ slug,
+ } = data;
+
+ // making sure the data is what the backend expects
+ const cleanedData = {
+ ...data,
+ certified_by: certified_by || '',
+ certification_details:
+ certified_by && certification_details ? certification_details : '',
+ css: css || '',
+ dashboard_title: dashboard_title || t('[ untitled dashboard ]'),
+ owners: owners && owners.length ? owners.map(o => (o.id ? o.id : o)) :
[],
Review comment:
`owners && owners.length ? owners.map(o => (o.id ? o.id : o)) : []` ->
`ensureIsArray(owners).map(o => (o.id ? o.id : o))`
`owners.map(o => (o.id ? o.id : o))` - I assume that means that owner can
either be a string or an object with id? Maybe we could use a type guard to
make it a bit clearer?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]