michael-s-molina commented on code in PR #34606:
URL: https://github.com/apache/superset/pull/34606#discussion_r2271023190


##########
superset-frontend/src/explore/components/ExploreChartPanel/index.tsx:
##########
@@ -43,43 +43,60 @@ import { SaveDatasetModal } from 
'src/SqlLab/components/SaveDatasetModal';
 import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils';
 import { buildV1ChartDataPayload } from 'src/explore/exploreUtils';
 import { getChartRequiredFieldsMissingMessage } from 
'src/utils/getChartRequiredFieldsMissingMessage';
+import type { ChartState, Datasource } from 'src/explore/types';
+import type { Slice } from 'src/types/Chart';
 import { DataTablesPane } from '../DataTablesPane';
 import { ChartPills } from '../ChartPills';
 import { ExploreAlert } from '../ExploreAlert';
 import useResizeDetectorByObserver from './useResizeDetectorByObserver';
 
-const propTypes = {
-  actions: PropTypes.object.isRequired,
-  onQuery: PropTypes.func,
-  can_overwrite: PropTypes.bool.isRequired,
-  can_download: PropTypes.bool.isRequired,
-  datasource: PropTypes.object,
-  dashboardId: PropTypes.number,
-  column_formats: PropTypes.object,
-  containerId: PropTypes.string.isRequired,
-  isStarred: PropTypes.bool.isRequired,
-  slice: PropTypes.object,
-  sliceName: PropTypes.string,
-  table_name: PropTypes.string,
-  vizType: PropTypes.string.isRequired,
-  form_data: PropTypes.object,
-  ownState: PropTypes.object,
-  standalone: PropTypes.bool,
-  force: PropTypes.bool,
-  timeout: PropTypes.number,
-  chartIsStale: PropTypes.bool,
-  chart: chartPropShape,
-  errorMessage: PropTypes.node,
-  triggerRender: PropTypes.bool,
-};
+export interface ExploreChartPanelProps {
+  actions: {
+    setForceQuery: (force: boolean) => void;
+    postChartFormData: (
+      formData: QueryFormData,
+      force: boolean,
+      timeout: number,
+      chartId: number,
+      dashboardId?: number,
+      ownState?: JsonObject,
+    ) => void;
+    updateQueryFormData: (formData: QueryFormData, chartId: number) => void;
+    setControlValue: (controlName: string, value: any, chartId: number) => 
void;
+  };
+  onQuery?: () => void;
+  can_overwrite: boolean;
+  can_download: boolean;
+  datasource: Datasource;
+  dashboardId?: number;
+  column_formats?: Record<string, any>;
+  containerId: string;
+  isStarred: boolean;
+  slice?: Slice;
+  sliceName?: string;
+  table_name?: string;
+  vizType: string;
+  form_data: QueryFormData;
+  ownState?: JsonObject;
+  standalone?: boolean;
+  force?: boolean;
+  timeout?: number;
+  chartIsStale?: boolean;
+  chart: ChartState;
+  errorMessage?: ReactNode;
+  triggerRender?: boolean;
+  chartAlert?: string;
+}
+
+type PANEL_SIZES = [number, number];

Review Comment:
   Should this be `PanelSizes` instead?



##########
superset-frontend/src/explore/components/ExploreAlert.tsx:
##########
@@ -23,7 +23,7 @@ import { ErrorAlert } from 'src/components';
 
 interface ControlPanelAlertProps {
   title: string;
-  bodyText: string;
+  bodyText: string | React.ReactNode;

Review Comment:
   `ReactNode` already covers the `string` case.
   
   ```suggestion
     bodyText: React.ReactNode;
   ```



##########
superset-frontend/packages/superset-ui-core/src/query/types/QueryFormData.ts:
##########
@@ -204,6 +204,15 @@ export interface SqlaFormData extends BaseFormData {
 
 export type QueryFormData = SqlaFormData;
 
+export type LatestQueryFormData =

Review Comment:
   The `{}` union could be risky, as it allows any object. If you want to 
require at least `datasource` and one of `viz_type` or `vizType`, you could do:
   
   ```
   type LatestQueryFormDataBase = Partial<QueryFormData> & { datasource: 
QueryFormData['datasource'] };
   
   export type LatestQueryFormData =
     | (LatestQueryFormDataBase & { viz_type: QueryFormData['viz_type'] })
     | (LatestQueryFormDataBase & { vizType: QueryFormData['vizType'] });
   ```



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to