michael-s-molina commented on a change in pull request #16992: URL: https://github.com/apache/superset/pull/16992#discussion_r728416256
########## File path: superset-frontend/src/dashboard/components/FilterBoxMigrationModal.tsx ########## @@ -0,0 +1,97 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { FunctionComponent } from 'react'; +import { styled, t } from '@superset-ui/core'; + +import Modal from 'src/components/Modal'; +import Button from 'src/components/Button'; + +const StyledFilterBoxMigrationModal = styled(Modal)` + .modal-content { + height: 900px; + display: flex; + flex-direction: column; + align-items: stretch; + } + + .modal-header { + flex: 0 1 auto; + } + .modal-body { + flex: 1 1 auto; + overflow: auto; + } + + .modal-footer { + flex: 0 1 auto; + } + + .ant-modal-body { + overflow: visible; + } +`; + +interface FilterBoxMigrationModalProps { + onHide: () => void; + onClickReview: () => void; + onClickSnooze: () => void; + show: boolean; + hideFooter: boolean; +} + +const FilterBoxMigrationModal: FunctionComponent<FilterBoxMigrationModalProps> = ({ + onClickReview, + onClickSnooze, + onHide, + show, + hideFooter = false, +}) => ( + <StyledFilterBoxMigrationModal + maskStyle={{ top: '50px' }} + show={show} + onHide={onHide} + title="Ready to review filters in this dashboard?" Review comment: ```suggestion title={t('Ready to review filters in this dashboard?')} ``` ########## File path: superset-frontend/src/dashboard/components/gridComponents/Chart.jsx ########## @@ -98,6 +100,11 @@ const ChartOverlay = styled.div` top: 0; left: 0; z-index: 5; + + &.is-deactivated { + opacity: 0.25; + background-color: #000; Review comment: Can we use a color from our theme? Perhaps if you use one from our grayscale you won't even need to set the opacity. ########## File path: superset-frontend/src/dashboard/actions/sliceEntities.js ########## @@ -71,34 +71,38 @@ export function fetchAllSlices(userId) { }) .then(({ json }) => { const slices = {}; - json.result.forEach(slice => { - let form_data = JSON.parse(slice.params); - form_data = { - ...form_data, - // force using datasource stored in relational table prop - datasource: - getDatasourceParameter( - slice.datasource_id, - slice.datasource_type, - ) || form_data.datasource, - }; - slices[slice.id] = { - slice_id: slice.id, - slice_url: slice.url, - slice_name: slice.slice_name, - form_data, - datasource_name: slice.datasource_name_text, - datasource_url: slice.datasource_url, - datasource_id: slice.datasource_id, - datasource_type: slice.datasource_type, - changed_on: new Date(slice.changed_on_utc).getTime(), - description: slice.description, - description_markdown: slice.description_markeddown, - viz_type: slice.viz_type, - modified: slice.changed_on_delta_humanized, - changed_on_humanized: slice.changed_on_delta_humanized, - }; - }); + json.result Review comment: I think here we can filter only if `excludeFilterBox` is `true`: ``` let { result } = json; if (excludeFilterBox) { result = result.filter(slice => slice.viz_type !== 'filter_box'); } result.forEach(slice => { ... ``` ########## File path: superset-frontend/src/dashboard/components/FilterBoxMigrationModal.tsx ########## @@ -0,0 +1,97 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { FunctionComponent } from 'react'; +import { styled, t } from '@superset-ui/core'; + +import Modal from 'src/components/Modal'; +import Button from 'src/components/Button'; + +const StyledFilterBoxMigrationModal = styled(Modal)` + .modal-content { + height: 900px; + display: flex; + flex-direction: column; + align-items: stretch; + } + + .modal-header { + flex: 0 1 auto; + } + .modal-body { + flex: 1 1 auto; + overflow: auto; + } + + .modal-footer { + flex: 0 1 auto; + } + + .ant-modal-body { + overflow: visible; + } +`; + +interface FilterBoxMigrationModalProps { + onHide: () => void; + onClickReview: () => void; + onClickSnooze: () => void; + show: boolean; + hideFooter: boolean; +} + +const FilterBoxMigrationModal: FunctionComponent<FilterBoxMigrationModalProps> = ({ + onClickReview, + onClickSnooze, + onHide, + show, + hideFooter = false, +}) => ( + <StyledFilterBoxMigrationModal + maskStyle={{ top: '50px' }} + show={show} + onHide={onHide} + title="Ready to review filters in this dashboard?" + hideFooter={hideFooter} + footer={ + <> + <Button buttonSize="small" onClick={onClickSnooze}> + {t('Remind me in 24 hours')} + </Button> + <Button buttonSize="small" onClick={onHide}> + {t('Cancel')} + </Button> + <Button + buttonSize="small" + buttonStyle="primary" + onClick={onClickReview} + > + {t('Start Review')} + </Button> + </> + } + responsive + > + <div> Review comment: Can we add support for translation here? ########## File path: superset-frontend/src/dashboard/util/filterboxMigrationHelper.ts ########## @@ -0,0 +1,526 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import shortid from 'shortid'; +import { find, isEmpty } from 'lodash'; + +import { + Filter, + NativeFilterType, +} from 'src/dashboard/components/nativeFilters/types'; +import { + FILTER_CONFIG_ATTRIBUTES, + TIME_FILTER_LABELS, + TIME_FILTER_MAP, +} from 'src/explore/constants'; +import { DASHBOARD_FILTER_SCOPE_GLOBAL } from 'src/dashboard/reducers/dashboardFilters'; +import { TimeGranularity } from '@superset-ui/core'; +import { getChartIdsInFilterScope } from './activeDashboardFilters'; +import getFilterConfigsFromFormdata from './getFilterConfigsFromFormdata'; + +interface FilterConfig { Review comment: It's very important to add a test file for these helper functions. ########## File path: superset-frontend/src/dashboard/components/FilterBoxMigrationModal.tsx ########## @@ -0,0 +1,97 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React, { FunctionComponent } from 'react'; +import { styled, t } from '@superset-ui/core'; + +import Modal from 'src/components/Modal'; +import Button from 'src/components/Button'; + +const StyledFilterBoxMigrationModal = styled(Modal)` + .modal-content { + height: 900px; + display: flex; + flex-direction: column; + align-items: stretch; + } + + .modal-header { + flex: 0 1 auto; + } + .modal-body { Review comment: ```suggestion } .modal-body { ``` ########## File path: superset-frontend/src/dashboard/components/gridComponents/Chart.jsx ########## @@ -38,6 +38,7 @@ import { slicePropShape, chartPropShape } from '../../util/propShapes'; import { isFilterBox } from '../../util/activeDashboardFilters'; import getFilterValuesByFilterId from '../../util/getFilterValuesByFilterId'; +import { FILTER_BOX_MIGRATION_STATES } from '../../../explore/constants'; Review comment: Can we use the absolute path here `src/explore/constants`? -- 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]
