michael-s-molina commented on a change in pull request #16992:
URL: https://github.com/apache/superset/pull/16992#discussion_r727541889
##########
File path: superset-frontend/src/components/Modal/Modal.tsx
##########
@@ -51,6 +51,7 @@ export interface ModalProps {
centered?: boolean;
footer?: React.ReactNode;
wrapProps?: object;
+ maskStyle?: object;
Review comment:
@graceguo-supercat Is there a reason to keep the menu bar out of the
modal mask? If the user can do other actions instead of interacting with the
modal we probably should use a
[notification](https://ant.design/components/notification/) instead.
##########
File path: superset-frontend/src/components/Modal/Modal.tsx
##########
@@ -51,6 +51,7 @@ export interface ModalProps {
centered?: boolean;
footer?: React.ReactNode;
wrapProps?: object;
+ maskStyle?: object;
Review comment:
@graceguo-supercat Is there a reason to keep the menu bar out of the
modal mask? If the user can do other actions instead of interacting with the
modal then we probably should use a
[notification](https://ant.design/components/notification/) instead.
##########
File path: superset-frontend/src/components/Modal/Modal.tsx
##########
@@ -51,6 +51,7 @@ export interface ModalProps {
centered?: boolean;
footer?: React.ReactNode;
wrapProps?: object;
+ maskStyle?: object;
Review comment:
@graceguo-supercat Is there a reason to keep the menu bar out of the
modal mask? If the user can perform other actions instead of interacting with
the modal, we should probably use a
[notification](https://ant.design/components/notification/).
##########
File path: superset-frontend/src/components/Modal/Modal.tsx
##########
@@ -51,6 +51,7 @@ export interface ModalProps {
centered?: boolean;
footer?: React.ReactNode;
wrapProps?: object;
+ maskStyle?: object;
Review comment:
> what if user opens on a dashboard_1, feels too much work to do, and
decided to do some other work, like another dashboard or chart, or sql lab? If
i cover whole page with modal (default behavior), user have no way to get out
of this situation right?
In this case, can't the user just click on Cancel or Remind me in 24 hours?
By the way, what's the difference between Cancel and Remind me in 24 hours? If
I click on Cancel, shouldn't we remind the user again about the pending
migration?
##########
File path: superset-frontend/src/dashboard/actions/hydrate.js
##########
@@ -227,19 +231,25 @@ export const hydrateDashboard = (dashboardData,
chartData) => (
const componentId = chartIdToLayoutId[key];
const directPathToFilter = (layout[componentId].parents || []).slice();
directPathToFilter.push(componentId);
- dashboardFilters[key] = {
- ...dashboardFilter,
- chartId: key,
- componentId,
- datasourceId: slice.form_data.datasource,
- filterName: slice.slice_name,
- directPathToFilter,
- columns,
- labels,
- scopes: scopesByChartId,
- isInstantFilter: !!slice.form_data.instant_filtering,
- isDateFilter: Object.keys(columns).includes(TIME_RANGE),
- };
+ if (
+ [
+ FILTER_BOX_MIGRATION_STATES.NOOP,
+ FILTER_BOX_MIGRATION_STATES.SNOOZED,
+ ].includes(filterboxMigrationState)
+ ) {
+ dashboardFilters[key] = {
Review comment:
Currently, `dashboardFilters[key]` is always filled. What's the
consequence of not setting this information when the migration state is
CONVERTED, REVIEWING, or UNDECIDED?
##########
File path: superset-frontend/src/common/hooks/apiResources/dashboards.ts
##########
@@ -17,19 +17,33 @@
* under the License.
*/
-import { Dashboard, Datasource } from 'src/dashboard/types';
+import { Dashboard, DashboardMetadata, Datasource } from 'src/dashboard/types';
import { Chart } from 'src/types/Chart';
import { useApiV1Resource, useTransformedResource } from './apiResources';
export const useDashboard = (idOrSlug: string | number) =>
useTransformedResource(
useApiV1Resource<Dashboard>(`/api/v1/dashboard/${idOrSlug}`),
- dashboard => ({
- ...dashboard,
- metadata: dashboard.json_metadata && JSON.parse(dashboard.json_metadata),
- position_data:
- dashboard.position_json && JSON.parse(dashboard.position_json),
- }),
+ dashboard => {
+ let metadata: DashboardMetadata = {};
+ let position_data = {};
+ try {
+ // need handle data parsing error
+ if (dashboard.json_metadata) {
+ metadata = JSON.parse(dashboard.json_metadata);
+ }
+ if (dashboard.position_json) {
+ position_data = JSON.parse(dashboard.position_json);
+ }
+ } catch (e) {
+ console.error('can not parse dashboard metadata.');
Review comment:
We should avoid the use of `console` statements. For this case, one
solution would be to modify `useTransformedResource` to account for
transformation errors:
```
export function useTransformedResource<IN, OUT>(
resource: Resource<IN>,
transformFn: (result: IN) => OUT,
): Resource<OUT> {
return useMemo(() => {
if (resource.status !== ResourceStatus.COMPLETE) {
// While incomplete, there is no result - no need to transform.
return resource;
}
try {
return {
...resource,
result: transformFn(resource.result),
};
} catch (e) {
return {
status: ResourceStatus.ERROR,
result: null,
error: e,
};
}
}, [resource, transformFn]);
}
```
You can find one example of a component handling this type of error in
`DashboardPage`:
```
const { result: dashboard, error: dashboardApiError } = useDashboard(
idOrSlug,
);
```
--
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]