Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
revert apache#13306 and related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace committed Apr 19, 2021
1 parent 4e7bd90 commit 41419db
Show file tree
Hide file tree
Showing 34 changed files with 197 additions and 613 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,12 @@ import {
} from './dashboard.helper';

describe('Dashboard load', () => {
beforeEach(() => {
before(() => {
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
});

it('should load dashboard', () => {
cy.visit(WORLD_HEALTH_DASHBOARD);
WORLD_HEALTH_CHARTS.forEach(waitForChartLoad);
});

it('should load in edit mode', () => {
cy.visit(`${WORLD_HEALTH_DASHBOARD}?edit=true&standalone=true`);
cy.get('[data-test="discard-changes-button"]').should('be.visible');
});

it('should load in standalone mode', () => {
cy.visit(`${WORLD_HEALTH_DASHBOARD}?edit=true&standalone=true`);
cy.get('#app-menu').should('not.exist');
});

it('should load in edit/standalone mode', () => {
cy.visit(`${WORLD_HEALTH_DASHBOARD}?edit=true&standalone=true`);
cy.get('[data-test="discard-changes-button"]').should('be.visible');
cy.get('#app-menu').should('not.exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,9 @@ describe('Nativefilters', () => {
.click()
.type('Country name');

cy.get('.ant-modal')
.find('[data-test="datasource-input"]')
.click()
.type('wb_health_population');
cy.get('.ant-modal').find('[data-test="datasource-input"]').click();

cy.get('.ant-modal [data-test="datasource-input"] .Select__menu')
cy.get('[data-test="datasource-input"]')
.contains('wb_health_population')
.click();

Expand Down Expand Up @@ -158,12 +155,9 @@ describe('Nativefilters', () => {
.click()
.type('Country name');

cy.get('.ant-modal')
.find('[data-test="datasource-input"]')
.click()
.type('wb_health_population');
cy.get('.ant-modal').find('[data-test="datasource-input"]').click();

cy.get('.ant-modal [data-test="datasource-input"] .Select__menu')
cy.get('[data-test="datasource-input"]')
.contains('wb_health_population')
.click();

Expand Down Expand Up @@ -193,10 +187,9 @@ describe('Nativefilters', () => {
cy.get('.ant-modal')
.find('[data-test="datasource-input"]')
.last()
.click()
.type('wb_health_population');
.click();

cy.get('.ant-modal [data-test="datasource-input"] .Select__menu')
cy.get('[data-test="datasource-input"]')
.last()
.contains('wb_health_population')
.click();
Expand Down
40 changes: 14 additions & 26 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions superset-frontend/src/chart/chartReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
*/
/* eslint camelcase: 0 */
import { t } from '@superset-ui/core';
import { HYDRATE_DASHBOARD } from 'src/dashboard/actions/hydrate';
import { ChartState } from 'src/explore/types';
import { getFormDataFromControls } from 'src/explore/controlUtils';
import { now } from 'src/modules/dates';
import { now } from '../modules/dates';
import * as actions from './chartAction';

export const chart: ChartState = {
Expand Down Expand Up @@ -193,9 +192,7 @@ export default function chartReducer(
delete charts[key];
return charts;
}
if (action.type === HYDRATE_DASHBOARD) {
return { ...action.data.charts };
}

if (action.type in actionHandlers) {
return {
...charts,
Expand Down
41 changes: 0 additions & 41 deletions superset-frontend/src/common/hooks/apiResources/dashboards.ts

This file was deleted.

3 changes: 1 addition & 2 deletions superset-frontend/src/common/hooks/apiResources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ export {
// A central catalog of API Resource hooks.
// Add new API hooks here, organized under
// different files for different resource types.
export * from './charts';
export * from './dashboards';
export { useChartOwnerNames } from './charts';
2 changes: 1 addition & 1 deletion superset-frontend/src/components/ErrorBoundary/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class ErrorBoundary extends React.Component {
}

componentDidCatch(error, info) {
if (this.props.onError) this.props.onError(error, info);
this.props.onError(error, info);
this.setState({ error, info });
}

Expand Down
30 changes: 12 additions & 18 deletions superset-frontend/src/dashboard/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,22 @@ import { HTML5Backend } from 'react-dnd-html5-backend';
import { DynamicPluginProvider } from 'src/components/DynamicPlugins';
import setupApp from '../setup/setupApp';
import setupPlugins from '../setup/setupPlugins';
import DashboardPage from './containers/DashboardPage';
import DashboardContainer from './containers/Dashboard';
import { theme } from '../preamble';

setupApp();
setupPlugins();

const App = ({ store }) => {
const dashboardIdOrSlug = window.location.pathname.split('/')[3];
return (
<Provider store={store}>
<DndProvider backend={HTML5Backend}>
<ThemeProvider theme={theme}>
<DynamicPluginProvider>
<DashboardPage
store={store}
dashboardIdOrSlug={dashboardIdOrSlug}
/>
</DynamicPluginProvider>
</ThemeProvider>
</DndProvider>
</Provider>
);
};
const App = ({ store }) => (
<Provider store={store}>
<DndProvider backend={HTML5Backend}>
<ThemeProvider theme={theme}>
<DynamicPluginProvider>
<DashboardContainer />
</DynamicPluginProvider>
</ThemeProvider>
</DndProvider>
</Provider>
);

export default hot(App);
21 changes: 2 additions & 19 deletions superset-frontend/src/dashboard/actions/nativeFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@

import { makeApi } from '@superset-ui/core';
import { Dispatch } from 'redux';
import {
Filter,
FilterConfiguration,
} from 'src/dashboard/components/nativeFilters/types';
import { FilterConfiguration } from 'src/dashboard/components/nativeFilters/types';
import { DataMaskType, DataMaskStateWithId } from 'src/dataMask/types';
import {
SET_DATA_MASK_FOR_FILTER_CONFIG_COMPLETE,
SET_DATA_MASK_FOR_FILTER_CONFIG_FAIL,
} from 'src/dataMask/actions';
import { HYDRATE_DASHBOARD } from './hydrate';
import { dashboardInfoChanged } from './dashboardInfo';
import { DashboardInfo, FilterSet } from '../reducers/types';

Expand Down Expand Up @@ -109,18 +105,6 @@ export const setFilterConfiguration = (
}
};

type BootstrapData = {
nativeFilters: {
filters: Filter;
filtersState: object;
};
};

export interface SetBooststapData {
type: typeof HYDRATE_DASHBOARD;
data: BootstrapData;
}

export const setFilterSetsConfiguration = (
filterSetsConfig: FilterSet[],
) => async (dispatch: Dispatch, getState: () => any) => {
Expand Down Expand Up @@ -189,5 +173,4 @@ export type AnyFilterAction =
| SetFilterSetsConfigBegin
| SetFilterSetsConfigComplete
| SetFilterSetsConfigFail
| SaveFilterSets
| SetBooststapData;
| SaveFilterSets;
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class DashboardGrid extends React.PureComponent {
width,
isComponentVisible,
} = this.props;

const columnPlusGutterWidth =
(width + GRID_GUTTER_SIZE) / GRID_COLUMN_COUNT;

Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/components/SaveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class SaveModal extends React.PureComponent<SaveModalProps, SaveModalState> {
// check refresh frequency is for current session or persist
const refreshFrequency = shouldPersistRefreshFrequency
? currentRefreshFrequency
: dashboardInfo.metadata?.refresh_frequency; // eslint-disable camelcase
: dashboardInfo.metadata.refresh_frequency; // eslint-disable camelcase

const data = {
positions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function mapStateToProps({
maxUndoHistoryExceeded: !!dashboardState.maxUndoHistoryExceeded,
lastModifiedTime: Math.max(
dashboardState.lastModifiedTime,
dashboardInfo.last_modified_time,
dashboardInfo.lastModifiedTime,
),
editMode: !!dashboardState.editMode,
slug: dashboardInfo.slug,
Expand Down
Loading

0 comments on commit 41419db

Please sign in to comment.