You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/07/18 23:58:25 UTC

[GitHub] williaster commented on a change in pull request #5425: set default charts layout

williaster commented on a change in pull request #5425: set default charts layout
URL: https://github.com/apache/incubator-superset/pull/5425#discussion_r203567193
 
 

 ##########
 File path: superset/assets/src/dashboard/reducers/getInitialState.js
 ##########
 @@ -98,20 +102,22 @@ export default function(bootstrapData) {
 
       sliceIds.add(key);
 
-      // if chart is newly added from explore view, add a row in layout
+      // if there are newly added slices from explore view, add 3 slices-per-row into layout
       if (!chartIdToLayoutId[key] && layout[parentId]) {
-        const parent = layout[parentId];
-        const rowContainer = newComponentFactory(ROW_TYPE);
-        layout[rowContainer.id] = rowContainer;
-        parent.children.push(rowContainer.id);
+        if (newSlicesCounter % 3 === 0) {
 
 Review comment:
   I think a more robust way to do this is to use the values from `constants.js` and the actual width of the newly-created `chartHolder` component. If the current row doesn't have enough width for the new component, then you can add a new row.
   
   Your approach would break if someone unknowingly changed the default chart width.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org