Skip to content

Commit

Permalink
retire dashboard v1 (js and python) (#5418)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored Jul 24, 2018
1 parent fd2d4b0 commit 3f2fc8f
Show file tree
Hide file tree
Showing 43 changed files with 106 additions and 4,211 deletions.
1 change: 0 additions & 1 deletion superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"react-dnd-html5-backend": "^2.5.4",
"react-dom": "^15.6.2",
"react-gravatar": "^2.6.1",
"react-grid-layout": "0.16.6",
"react-map-gl": "^3.0.4",
"react-markdown": "^3.3.0",
"react-redux": "^5.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export default {
maxUndoHistoryExceeded: false,
isStarred: true,
css: '',
isV2Preview: false, // @TODO remove upon v1 deprecation
};
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ describe('dashboardState reducer', () => {
hasUnsavedChanges: false,
maxUndoHistoryExceeded: false,
editMode: false,
isV2Preview: false, // @TODO remove upon v1 deprecation
});
});

Expand Down
7 changes: 2 additions & 5 deletions superset/assets/src/dashboard/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ class Dashboard extends React.PureComponent {

componentWillReceiveProps(nextProps) {
if (!nextProps.dashboardState.editMode) {
const version = nextProps.dashboardState.isV2Preview
? 'v2-preview'
: 'v2';
// log pane loads
const loadedPaneIds = [];
let minQueryStartTime = Infinity;
Expand All @@ -107,7 +104,7 @@ class Dashboard extends React.PureComponent {
Logger.append(LOG_ACTIONS_LOAD_DASHBOARD_PANE, {
...restStats,
duration: new Date().getTime() - paneMinQueryStart,
version,
version: 'v2',
});

if (!this.isFirstLoad) {
Expand All @@ -128,7 +125,7 @@ class Dashboard extends React.PureComponent {
Logger.append(LOG_ACTIONS_FIRST_DASHBOARD_LOAD, {
pane_ids: loadedPaneIds,
duration: new Date().getTime() - minQueryStartTime,
version,
version: 'v2',
});
Logger.send(this.actionLog);
this.isFirstLoad = false;
Expand Down
46 changes: 3 additions & 43 deletions superset/assets/src/dashboard/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import EditableTitle from '../../components/EditableTitle';
import Button from '../../components/Button';
import FaveStar from '../../components/FaveStar';
import UndoRedoKeylisteners from './UndoRedoKeylisteners';
import V2PreviewModal from '../deprecated/V2PreviewModal';

import { chartPropShape } from '../util/propShapes';
import { t } from '../../locales';
Expand All @@ -32,7 +31,6 @@ const propTypes = {
startPeriodicRender: PropTypes.func.isRequired,
updateDashboardTitle: PropTypes.func.isRequired,
editMode: PropTypes.bool.isRequired,
isV2Preview: PropTypes.bool.isRequired,
setEditMode: PropTypes.func.isRequired,
showBuilderPane: PropTypes.bool.isRequired,
toggleBuilderPane: PropTypes.func.isRequired,
Expand Down Expand Up @@ -60,7 +58,6 @@ class Header extends React.PureComponent {
didNotifyMaxUndoHistoryToast: false,
emphasizeUndo: false,
hightlightRedo: false,
showV2PreviewModal: props.isV2Preview,
};

this.handleChangeText = this.handleChangeText.bind(this);
Expand All @@ -69,7 +66,6 @@ class Header extends React.PureComponent {
this.toggleEditMode = this.toggleEditMode.bind(this);
this.forceRefresh = this.forceRefresh.bind(this);
this.overwriteDashboard = this.overwriteDashboard.bind(this);
this.toggleShowV2PreviewModal = this.toggleShowV2PreviewModal.bind(this);
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -129,10 +125,6 @@ class Header extends React.PureComponent {
this.props.setEditMode(!this.props.editMode);
}

toggleShowV2PreviewModal() {
this.setState({ showV2PreviewModal: !this.state.showV2PreviewModal });
}

overwriteDashboard() {
const {
dashboardTitle,
Expand Down Expand Up @@ -161,7 +153,6 @@ class Header extends React.PureComponent {
filters,
expandedSlices,
css,
isV2Preview,
onUndo,
onRedo,
undoLength,
Expand All @@ -177,7 +168,7 @@ class Header extends React.PureComponent {

const userCanEdit = dashboardInfo.dash_edit_perm;
const userCanSaveAs = dashboardInfo.dash_save_perm;
const popButton = hasUnsavedChanges || isV2Preview;
const popButton = hasUnsavedChanges;

return (
<div className="dashboard-header">
Expand All @@ -196,20 +187,6 @@ class Header extends React.PureComponent {
isStarred={this.props.isStarred}
/>
</span>
{isV2Preview && (
<div
role="none"
className="v2-preview-badge"
onClick={this.toggleShowV2PreviewModal}
>
{t('v2 Preview')}
<span className="fa fa-info-circle m-l-5" />
</div>
)}
{isV2Preview &&
this.state.showV2PreviewModal && (
<V2PreviewModal onClose={this.toggleShowV2PreviewModal} />
)}
</div>

{userCanSaveAs && (
Expand Down Expand Up @@ -245,32 +222,17 @@ class Header extends React.PureComponent {
)}

{editMode &&
(hasUnsavedChanges || isV2Preview) && (
hasUnsavedChanges && (
<Button
bsSize="small"
bsStyle={popButton ? 'primary' : undefined}
onClick={this.overwriteDashboard}
>
{isV2Preview
? t('Persist as Dashboard v2')
: t('Save changes')}
</Button>
)}

{!editMode &&
isV2Preview && (
<Button
bsSize="small"
onClick={this.toggleEditMode}
bsStyle={popButton ? 'primary' : undefined}
disabled={!userCanEdit}
>
{t('Edit to persist Dashboard v2')}
{t('Save changes')}
</Button>
)}

{!editMode &&
!isV2Preview &&
!hasUnsavedChanges && (
<Button
bsSize="small"
Expand All @@ -283,7 +245,6 @@ class Header extends React.PureComponent {
)}

{editMode &&
!isV2Preview &&
!hasUnsavedChanges && (
<Button
bsSize="small"
Expand Down Expand Up @@ -312,7 +273,6 @@ class Header extends React.PureComponent {
editMode={editMode}
hasUnsavedChanges={hasUnsavedChanges}
userCanEdit={userCanEdit}
isV2Preview={isV2Preview}
/>

{editMode && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const propTypes = {
filters: PropTypes.object.isRequired,
expandedSlices: PropTypes.object.isRequired,
onSave: PropTypes.func.isRequired,
isV2Preview: PropTypes.bool.isRequired,
};

const defaultProps = {};
Expand Down Expand Up @@ -83,7 +82,6 @@ class HeaderActionsDropdown extends React.PureComponent {
expandedSlices,
onSave,
userCanEdit,
isV2Preview,
} = this.props;

const emailBody = t('Check out this dashboard: %s', window.location.href);
Expand All @@ -93,7 +91,7 @@ class HeaderActionsDropdown extends React.PureComponent {
<DropdownButton
title=""
id="save-dash-split-button"
bsStyle={hasUnsavedChanges || isV2Preview ? 'primary' : undefined}
bsStyle={hasUnsavedChanges ? 'primary' : undefined}
bsSize="small"
pullRight
>
Expand All @@ -111,9 +109,8 @@ class HeaderActionsDropdown extends React.PureComponent {
isMenuItem
triggerNode={<span>{t('Save as')}</span>}
canOverwrite={userCanEdit}
isV2Preview={isV2Preview}
/>
{(isV2Preview || hasUnsavedChanges) && (
{hasUnsavedChanges && (
<MenuItem
eventKey="discard"
onSelect={HeaderActionsDropdown.discardChanges}
Expand Down
9 changes: 2 additions & 7 deletions superset/assets/src/dashboard/components/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const propTypes = {
onSave: PropTypes.func.isRequired,
isMenuItem: PropTypes.bool,
canOverwrite: PropTypes.bool.isRequired,
isV2Preview: PropTypes.bool.isRequired,
};

const defaultProps = {
Expand Down Expand Up @@ -104,16 +103,12 @@ class SaveModal extends React.PureComponent {
}

render() {
const { isV2Preview } = this.props;
return (
<ModalTrigger
ref={this.setModalRef}
isMenuItem={this.props.isMenuItem}
triggerNode={this.props.triggerNode}
modalTitle={t(
'Save Dashboard%s',
isV2Preview ? ' (⚠️ all saved dashboards will be V2)' : '',
)}
modalTitle={t('Save Dashboard')}
modalBody={
<FormGroup>
<Radio
Expand Down Expand Up @@ -144,7 +139,7 @@ class SaveModal extends React.PureComponent {
checked={this.state.duplicateSlices}
onChange={this.toggleDuplicateSlices}
/>
<span className="m-l-5">also copy (duplicate) charts</span>
<span className="m-l-5">{t('also copy (duplicate) charts')}</span>
</div>
</FormGroup>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function mapStateToProps({
maxUndoHistoryExceeded: !!dashboardState.maxUndoHistoryExceeded,
editMode: !!dashboardState.editMode,
showBuilderPane: !!dashboardState.showBuilderPane,
isV2Preview: dashboardState.isV2Preview,
};
}

Expand Down
102 changes: 0 additions & 102 deletions superset/assets/src/dashboard/deprecated/PromptV2ConversionModal.jsx

This file was deleted.

Loading

0 comments on commit 3f2fc8f

Please sign in to comment.