alexandrusoare commented on code in PR #35343:
URL: https://github.com/apache/superset/pull/35343#discussion_r2419046002


##########
superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.jsx:
##########
@@ -378,20 +392,139 @@ const Chart = props => {
         slice_id: slice.slice_id,
         is_cached: isCached,
       });
+
+      let ownState = dataMask[props.id]?.ownState || {};
+
+      // For AG Grid tables, convert AG Grid state to backend-compatible format
+      if (slice.viz_type === 'ag-grid-table' && chartStates[props.id]?.state) {
+        const agGridState = chartStates[props.id].state;
+
+        // Convert AG Grid sortModel to backend sortBy format
+        if (agGridState.sortModel && agGridState.sortModel.length > 0) {
+          const sortItem = agGridState.sortModel[0];
+          ownState = {
+            ...ownState,
+            sortBy: [
+              {
+                id: sortItem.colId,
+                key: sortItem.colId,
+                desc: sortItem.sort === 'desc',
+              },
+            ],
+          };
+        }
+
+        // Store column order for backend processing
+        if (agGridState.columnState && agGridState.columnState.length > 0) {
+          ownState = {
+            ...ownState,
+            columnOrder: agGridState.columnState.map(col => col.colId),
+          };
+        }
+
+        if (
+          agGridState.filterModel &&
+          Object.keys(agGridState.filterModel).length > 0
+        ) {
+          const agGridFilters = [];
+
+          Object.keys(agGridState.filterModel).forEach(colId => {
+            const filter = agGridState.filterModel[colId];
+
+            // Text filter
+            if (filter.filterType === 'text' && filter.filter) {
+              const clause = {
+                expressionType: 'SIMPLE',
+                subject: colId,
+                operator:
+                  filter.type === 'equals'
+                    ? '=='
+                    : filter.type === 'notEqual'
+                      ? '!='
+                      : filter.type === 'contains'
+                        ? 'ILIKE'
+                        : filter.type === 'notContains'
+                          ? 'NOT ILIKE'
+                          : filter.type === 'startsWith'
+                            ? 'ILIKE'
+                            : filter.type === 'endsWith'
+                              ? 'ILIKE'
+                              : 'ILIKE',
+                comparator:
+                  filter.type === 'contains' || filter.type === 'notContains'
+                    ? `%${filter.filter}%`
+                    : filter.type === 'startsWith'
+                      ? `${filter.filter}%`
+                      : filter.type === 'endsWith'
+                        ? `%${filter.filter}`
+                        : filter.filter,
+              };
+              agGridFilters.push(clause);
+            } else if (
+              filter.filterType === 'number' &&
+              filter.filter !== undefined
+            ) {
+              const clause = {
+                expressionType: 'SIMPLE',
+                subject: colId,
+                operator:
+                  filter.type === 'equals'
+                    ? '=='
+                    : filter.type === 'notEqual'
+                      ? '!='
+                      : filter.type === 'lessThan'
+                        ? '<'
+                        : filter.type === 'lessThanOrEqual'
+                          ? '<='
+                          : filter.type === 'greaterThan'
+                            ? '>'
+                            : filter.type === 'greaterThanOrEqual'
+                              ? '>='
+                              : '==',
+                comparator: filter.filter,
+              };
+              agGridFilters.push(clause);
+            } else if (
+              filter.filterType === 'set' &&
+              Array.isArray(filter.values) &&
+              filter.values.length > 0
+            ) {
+              const clause = {
+                expressionType: 'SIMPLE',
+                subject: colId,
+                operator: 'IN',
+                comparator: filter.values,
+              };
+              agGridFilters.push(clause);
+            }
+          });
+
+          if (agGridFilters.length > 0) {
+            ownState = {
+              ...ownState,
+              agGridFilters,
+            };
+          }
+        }
+      }

Review Comment:
   We still need to send the type of filter and so on, changed a few a things



##########
superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx:
##########
@@ -58,20 +58,39 @@ export const useShareMenuItems = (props: 
ShareMenuItemProps): MenuItem => {
     disabled,
     ...rest
   } = props;
-  const { dataMask, activeTabs } = useSelector(
+  const { dataMask, activeTabs, chartStates, sliceEntities } = useSelector(
     (state: RootState) => ({
       dataMask: state.dataMask,
       activeTabs: state.dashboardState.activeTabs,
+      chartStates: state.dashboardState.chartStates,
+      sliceEntities: state.sliceEntities,
     }),
     shallowEqual,
   );
 
   async function generateUrl() {
+    // Check if dashboard has AG Grid tables
+    const hasAgGridTables =
+      sliceEntities &&
+      Object.values(sliceEntities).some(
+        slice =>
+          slice &&
+          typeof slice === 'object' &&
+          'viz_type' in slice &&
+          slice.viz_type === 'ag_grid_table',
+      );
+

Review Comment:
   Done, thanks



-- 
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]

Reply via email to